Skip to content

Commit

Permalink
Merge pull request #1 from Adainish/1.20.1-1.4
Browse files Browse the repository at this point in the history
FEAT:
  • Loading branch information
Adainish authored Oct 18, 2023
2 parents 7923734 + a11464a commit c955aa5
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 32 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {


group = 'io.github.adainish'
version = '1.0-SNAPSHOT'
version = '1.1.0-SNAPSHOT'

java {
archivesBaseName = 'CobbleClearForge'
Expand All @@ -26,7 +26,7 @@ minecraft {
//
// Use non-default mappings at your own risk. They may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'official', version: '1.19.2'
mappings channel: 'official', version: '1.20.1'

// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

Expand Down Expand Up @@ -130,7 +130,7 @@ dependencies {
// Specify the version of Minecraft to use. If this is any group other than 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.19.2-43.2.8'
minecraft 'net.minecraftforge:forge:1.20.1-47.1.8'
implementation fileTree(dir: 'libs', include: '*.jar')
// Real mod deobf dependency examples - these get remapped to your current mappings
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
Expand Down
Binary file not shown.
Binary file removed libs/architectury-6.5.69-forge.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,19 @@

import io.github.adainish.cobbleclearforge.command.Command;
import io.github.adainish.cobbleclearforge.config.Config;
import io.github.adainish.cobbleclearforge.config.LanguageConfig;
import io.github.adainish.cobbleclearforge.manager.WipeManager;
import net.minecraft.client.Minecraft;
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.minecraftforge.event.server.ServerStartedEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.InterModComms;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
import net.minecraftforge.event.server.ServerStartingEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.loading.FMLConfig;
import net.minecraftforge.fml.loading.FMLPaths;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
import net.minecraftforge.server.ServerLifecycleHooks;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand All @@ -39,14 +31,15 @@ public class CobbleClearForge {

public static CobbleClearForge instance;
public static final String MOD_NAME = "CobblemonClear";
public static final String VERSION = "1.0.0-Beta";
public static final String VERSION = "1.1.0-Beta";
public static final String AUTHORS = "Winglet";
public static final String YEAR = "2023";
private static final Logger log = LogManager.getLogger(MOD_NAME);
private static File configDir;
private static File storage;
private static MinecraftServer server;
public static Config config;
public static LanguageConfig languageConfig;

public static WipeManager manager;
public static Logger getLog() {
Expand Down Expand Up @@ -81,12 +74,7 @@ public static void setStorage(File storage) {
public CobbleClearForge() {
instance = this;
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();

// Register the commonSetup method for modloading
modEventBus.addListener(this::commonSetup);


// Register ourselves for server and other game events we are interested in
MinecraftForge.EVENT_BUS.register(this);
}

Expand All @@ -103,10 +91,8 @@ private void commonSetup(final FMLCommonSetupEvent event) {

@SubscribeEvent
public void onCommandRegistry(RegisterCommandsEvent event) {

//register commands
event.getDispatcher().register(Command.getCommand());

}

// You can use SubscribeEvent and let the Event Bus discover methods to call
Expand All @@ -130,6 +116,8 @@ public void initDirs() {
public void initConfigs() {
Config.writeConfig();
config = Config.getConfig();
LanguageConfig.writeConfig();
languageConfig = LanguageConfig.getConfig();
}

public void reload() {
Expand All @@ -140,6 +128,4 @@ public void reload() {
manager.init();
}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package io.github.adainish.cobbleclearforge.config;

import com.google.gson.Gson;
import com.google.gson.stream.JsonReader;
import io.github.adainish.cobbleclearforge.CobbleClearForge;
import io.github.adainish.cobbleclearforge.util.Adapters;

import java.io.*;

public class LanguageConfig
{
public String prefix = "&c&l[&b&lCobbleClear&c&l]";
public String splitter = " » ";

public static void writeConfig()
{
File dir = CobbleClearForge.getConfigDir();
dir.mkdirs();
Gson gson = Adapters.PRETTY_MAIN_GSON;
LanguageConfig config = new LanguageConfig();
try {
File file = new File(dir, "language.json");
if (file.exists())
return;
file.createNewFile();
FileWriter writer = new FileWriter(file);
String json = gson.toJson(config);
writer.write(json);
writer.close();
} catch (IOException e)
{
CobbleClearForge.getLog().warn(e);
}
}

public static LanguageConfig getConfig()
{
File dir = CobbleClearForge.getConfigDir();
dir.mkdirs();
Gson gson = Adapters.PRETTY_MAIN_GSON;
File file = new File(dir, "language.json");
JsonReader reader = null;
try {
reader = new JsonReader(new FileReader(file));
} catch (FileNotFoundException e) {
CobbleClearForge.getLog().error("Something went wrong attempting to read the Config");
return null;
}

return gson.fromJson(reader, LanguageConfig.class);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import io.github.adainish.cobbleclearforge.CobbleClearForge;
import io.github.adainish.cobbleclearforge.util.Util;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.item.ItemEntity;
import org.apache.commons.lang3.time.DurationFormatUtils;

Expand Down Expand Up @@ -83,7 +84,7 @@ public void wipe()
continue;
}
}
e.kill();
e.remove(Entity.RemovalReason.DISCARDED);
wipedCount.getAndIncrement();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import io.github.adainish.cobbleclearforge.CobbleClearForge;
import io.github.adainish.cobbleclearforge.util.Util;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
import org.apache.commons.lang3.time.DurationFormatUtils;


Expand Down Expand Up @@ -95,7 +96,7 @@ public void wipe()
continue;
}
}
e.kill();
e.remove(Entity.RemovalReason.DISCARDED);
wipedCount.getAndIncrement();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.adainish.cobbleclearforge.util;

import io.github.adainish.cobbleclearforge.CobbleClearForge;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.Style;
Expand Down Expand Up @@ -39,19 +40,19 @@ public static Component parseHexCodes(String text, boolean removeItalics) {

public static final TextColor BLUE = TextColor.parseColor("#00AFFC");
public static final TextColor ORANGE = TextColor.parseColor("#FF6700");
private static final MutableComponent PLUGIN_PREFIX = Component.literal(Util.formattedString("&c&l[&b&lCobbleClear&c&l]")).setStyle(Style.EMPTY.withColor(BLUE));
private static final MutableComponent PLUGIN_PREFIX = Component.literal(Util.formattedString(CobbleClearForge.languageConfig.prefix)).setStyle(Style.EMPTY.withColor(BLUE));

private static final MutableComponent MESSAGE_PREFIX = getPluginPrefix().append(Component.literal(" » ").setStyle(Style.EMPTY.withColor(ORANGE)));
private static final MutableComponent MESSAGE_PREFIX = getPluginPrefix().append(Component.literal(CobbleClearForge.languageConfig.splitter).setStyle(Style.EMPTY.withColor(ORANGE)));

/**
* @return a copy of the coloured OutBreaks TextComponent
* @return a copy of the coloured CobbleClear TextComponent
*/
public static MutableComponent getPluginPrefix() {
return PLUGIN_PREFIX.copy();
}

/**
* @return a copy of the coloured OutBreaks prefix
* @return a copy of the coloured CobbleClear prefix
*/
public static MutableComponent getMessagePrefix() {
return MESSAGE_PREFIX.copy();
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader = "javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion = "[43,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
loaderVersion = "[47,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
license = "All Rights Reserved"
Expand All @@ -19,7 +19,7 @@ modId = "cobbleclearforge" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata
# see the associated build.gradle script for how to populate this completely automatically during a build
version = "${file.jarVersion}" #mandatory
version = "1.1.0" #mandatory
# A display name for the mod
displayName = "CobbleClearForge" #mandatory
# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/
Expand Down Expand Up @@ -51,7 +51,7 @@ modId = "forge" #mandatory
# Does this dependency have to exist - if not, ordering below must be specified
mandatory = true #mandatory
# The version range of the dependency
versionRange = "[43,)" #mandatory
versionRange = "[47,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering = "NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
Expand All @@ -61,6 +61,6 @@ side = "BOTH"
modId = "minecraft"
mandatory = true
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange = "[1.19.2)"
versionRange = "[1.20.1)"
ordering = "NONE"
side = "BOTH"

0 comments on commit c955aa5

Please sign in to comment.