From b794a287cf18e68cb4c14628073d148982d6f935 Mon Sep 17 00:00:00 2001 From: Alexander Minkin Date: Fri, 2 Jun 2023 21:53:33 +0300 Subject: [PATCH] Clean traces of unused config system --- .../ru/weryskok/mtrrumetro/MainClient.java | 2 - .../ru/weryskok/mtrrumetro/config/Config.java | 49 ------------------- .../ru/weryskok/mtrrumetro/ModMenuConfig.java | 12 ----- 3 files changed, 63 deletions(-) delete mode 100644 common/src/main/java/ru/weryskok/mtrrumetro/config/Config.java delete mode 100644 fabric/src/main/java/ru/weryskok/mtrrumetro/ModMenuConfig.java diff --git a/common/src/main/java/ru/weryskok/mtrrumetro/MainClient.java b/common/src/main/java/ru/weryskok/mtrrumetro/MainClient.java index 6de86ff..d2cd31f 100644 --- a/common/src/main/java/ru/weryskok/mtrrumetro/MainClient.java +++ b/common/src/main/java/ru/weryskok/mtrrumetro/MainClient.java @@ -4,7 +4,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderType; import ru.weryskok.mtrrumetro.render.*; -//import ru.weryskok.mtrrumetro.config.Config; public class MainClient { public static void init() { @@ -20,7 +19,6 @@ public static void init() { RegistryClient.registerBlockRenderType(RenderType.cutoutMipped(), Blocks.SPB_HORIZONTAL_ELEVATOR_DOOR.get()); RegistryClient.registerTileEntityRenderer(BlockEntityTypes.SPB_HORIZONTAL_ELEVATOR_DOOR_TILE_ENTITY.get(), RenderSPBHorizontalElevatorDoor::new); -// Config.refreshProperties(); } public static void registerItemModelPredicates() { diff --git a/common/src/main/java/ru/weryskok/mtrrumetro/config/Config.java b/common/src/main/java/ru/weryskok/mtrrumetro/config/Config.java deleted file mode 100644 index b1397e8..0000000 --- a/common/src/main/java/ru/weryskok/mtrrumetro/config/Config.java +++ /dev/null @@ -1,49 +0,0 @@ -package ru.weryskok.mtrrumetro.config; - -import com.google.gson.GsonBuilder; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import net.minecraft.client.Minecraft; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Collections; - -public class Config { - private static final Logger LOGGER = LogManager.getLogger(); - - private static final Path CONFIG_PATH = Minecraft.getInstance().gameDirectory.toPath().resolve("config").resolve("russianmetro.json"); - - - public static void refreshProperties() { - LOGGER.info("Refreshed Russian Metro config"); - try { - final JsonObject jsonConfig = new JsonParser().parse(String.join("", Files.readAllLines(CONFIG_PATH))).getAsJsonObject(); - } catch (Exception e) { - writeToFile(); - refreshProperties(); - } - } - - private static void writeToFile() { - LOGGER.info("Wrote Russian Metro config to file"); - final JsonObject jsonConfig = new JsonObject(); - try { - if (!Files.exists(CONFIG_PATH.getParent())) { - Files.createDirectories(CONFIG_PATH.getParent()); - } - Files.write(CONFIG_PATH, Collections.singleton(prettyPrint(jsonConfig))); - } catch (IOException e) { - LOGGER.error("Configuration file write exception"); - e.printStackTrace(); - } - } - - private static String prettyPrint(JsonElement jsonElement) { - return new GsonBuilder().setPrettyPrinting().create().toJson(jsonElement); - } -} \ No newline at end of file diff --git a/fabric/src/main/java/ru/weryskok/mtrrumetro/ModMenuConfig.java b/fabric/src/main/java/ru/weryskok/mtrrumetro/ModMenuConfig.java deleted file mode 100644 index b0c19d9..0000000 --- a/fabric/src/main/java/ru/weryskok/mtrrumetro/ModMenuConfig.java +++ /dev/null @@ -1,12 +0,0 @@ -package ru.weryskok.mtrrumetro; - -import com.terraformersmc.modmenu.api.ConfigScreenFactory; -import com.terraformersmc.modmenu.api.ModMenuApi; -//import ru.weryskok.mtrrumetro.screen.ConfigScreen; - -public class ModMenuConfig implements ModMenuApi { -// @Override -// public ConfigScreenFactory getModConfigScreenFactory() { -// return parent -> new ConfigScreen(); -// } -} \ No newline at end of file