diff --git a/src/main/java/com/laosun/stackone/Stack.java b/src/main/java/com/laosun/stackone/Stack.java deleted file mode 100644 index c936190..0000000 --- a/src/main/java/com/laosun/stackone/Stack.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.laosun.stackone; - -import com.google.gson.Gson; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonParser; - -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import static com.laosun.stackone.StackOneMod.LOGGER; - -public class Stack { - public String item; - public short max_stack_size; - - public static Map getStackList() { - Map map = new HashMap<>(); - File dir = new File("config/stackone"); - if (!dir.exists()) { - dir.mkdirs(); - } - File file = new File(dir, "max_stack_size.json"); - if (!file.isFile()) { - try { - if (!file.createNewFile()) { - LOGGER.error("Fail to create file!"); - } - } catch (IOException e) { - LOGGER.error("Fail to create file!"); - e.printStackTrace(); - } - } - char[] a1 = null; - try { - FileReader fileReader = new FileReader(file); - a1 = new char[(int) file.length()]; - fileReader.read(a1); - } catch (IOException e) { - LOGGER.error("Fail to open file!"); - e.printStackTrace(); - } - Gson gson = new Gson(); - JsonArray jsonArray; - try { - if (a1 != null) { - jsonArray = JsonParser.parseString(String.copyValueOf(a1)).getAsJsonArray(); - for (JsonElement user : jsonArray) { - Stack ignore = gson.fromJson(user, Stack.class); - map.put(ignore.item, ignore.max_stack_size); - } - } - - } catch (Exception e) { - LOGGER.error("Json has syntax error!"); - e.printStackTrace(); - } - return map; - } -} diff --git a/src/main/java/com/laosun/stackone/StackOneMod.java b/src/main/java/com/laosun/stackone/StackOneMod.java index 9f847e0..7fe60bd 100644 --- a/src/main/java/com/laosun/stackone/StackOneMod.java +++ b/src/main/java/com/laosun/stackone/StackOneMod.java @@ -14,16 +14,12 @@ @Mod(StackOneMod.MODID) public class StackOneMod { - // Define mod id in a common place for everything to reference public static final String MODID = "stackone"; - // Directly reference a slf4j logger public static final Logger LOGGER = LogUtils.getLogger(); - // Create a Deferred Register to hold Blocks which will all be registered under the "examplemod" namespace public StackOneMod() { IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); - // Register the commonSetup method for modloading modEventBus.addListener(this::commonSetup); }