diff options
author | syeyoung <cyong06@naver.com> | 2020-12-24 11:15:04 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2020-12-24 11:15:04 +0900 |
commit | 4bf3172187396e9eedb852a887f98d7eb276f459 (patch) | |
tree | f5ff2ad06d8fe4e04aac3a4a176af55413d8652a /src/main | |
parent | 8a2635e8d7c7b47eb9236f89cd4cc0ab851f4da1 (diff) | |
download | Skyblock-Dungeons-Guide-4bf3172187396e9eedb852a887f98d7eb276f459.tar.gz Skyblock-Dungeons-Guide-4bf3172187396e9eedb852a887f98d7eb276f459.tar.bz2 Skyblock-Dungeons-Guide-4bf3172187396e9eedb852a887f98d7eb276f459.zip |
toggles
Diffstat (limited to 'src/main')
21 files changed, 244 insertions, 170 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/Config.java b/src/main/java/kr/syeyoung/dungeonsguide/Config.java new file mode 100644 index 00000000..07dc6d41 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/Config.java @@ -0,0 +1,50 @@ +package kr.syeyoung.dungeonsguide; + +import net.minecraftforge.common.config.Configuration; + +public class Config { + public static Configuration configuration; + + public static final String CATEGORY_ADVANCED = "advanced"; + public static final String CATEGORY_PUZZLE_SOLVER = "solver"; + + public static boolean DEBUG = true; + + public static boolean solver_riddle; + public static boolean solver_kahoot; + public static boolean solver_blaze; + public static boolean solver_tictactoe; + public static boolean solver_icepath; + public static boolean solver_icesilverfish; + public static boolean solver_waterpuzzle; + public static boolean solver_box; + public static boolean solver_creeper; + public static boolean solver_teleport; + + public static void syncConfig(Configuration configuration) { // Gets called from preInit + try { + Config.configuration = configuration; + // Load config + configuration.load(); + + // Read props from config + DEBUG = configuration.get(Config.CATEGORY_ADVANCED, "debug","false", "Enable debug mode").getBoolean(); // Comment + + solver_riddle = configuration.get(Config.CATEGORY_PUZZLE_SOLVER, "riddle", "true", "Riddle puzzle solver").getBoolean(); + solver_kahoot = configuration.get(Config.CATEGORY_PUZZLE_SOLVER, "kahoot", "true", "Omnicrescent puzzle solver").getBoolean(); + solver_teleport = configuration.get(Config.CATEGORY_PUZZLE_SOLVER, "teleport", "true", "Teleport puzzle solver").getBoolean(); + solver_creeper = configuration.get(Config.CATEGORY_PUZZLE_SOLVER, "creeper", "true", "Creeper puzzle solver (Advanced)").getBoolean(); + solver_blaze = configuration.get(Config.CATEGORY_PUZZLE_SOLVER, "blaze", "true", "Blaze puzzle solver").getBoolean(); + solver_tictactoe = configuration.get(Config.CATEGORY_PUZZLE_SOLVER, "tictactoe", "true", "Tictactoe puzzle solver (Advanced)").getBoolean(); + solver_icepath = configuration.get(Config.CATEGORY_PUZZLE_SOLVER, "icepath", "true", "Icepath puzzle solver (Advanced)").getBoolean(); + solver_icesilverfish = configuration.get(Config.CATEGORY_PUZZLE_SOLVER, "silverfish", "true", "Silverfish puzzle solver (Advanced)").getBoolean(); + solver_waterpuzzle = configuration.get(Config.CATEGORY_PUZZLE_SOLVER, "water", "true", "Water puzzle solver (Advanced)").getBoolean(); + solver_box = configuration.get(Config.CATEGORY_PUZZLE_SOLVER, "box", "true", "Box puzzle solver (Advanced)").getBoolean(); + } catch (Exception e) { + // Failed reading/writing, just continue + } finally { + // Save props to config IF config changed + if (configuration.hasChanged()) configuration.save(); + } + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java b/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java index 0d4fa68d..8b7273c5 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java @@ -74,7 +74,7 @@ public class EventListener { if (postRender.type != RenderGameOverlayEvent.ElementType.TEXT) return; SkyblockStatus skyblockStatus = (SkyblockStatus) e.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnDungeon()) return; - if (e.DEBUG) { + if (Config.DEBUG) { int[] textureData = dynamicTexture.getTextureData(); MapUtils.getImage().getRGB(0, 0, 128, 128, textureData, 0, 128); dynamicTexture.updateDynamicTexture(); @@ -91,10 +91,10 @@ public class EventListener { DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; if (dungeonRoom == null) { - if (e.DEBUG) + if (Config.DEBUG) fontRenderer.drawString("Where are you?!", 5, 128, 0xFFFFFF); } else { - if (e.DEBUG) { + if (Config.DEBUG) { fontRenderer.drawString("you're in the room... " + dungeonRoom.getColor() + " / " + dungeonRoom.getShape(), 5, 128, 0xFFFFFF); fontRenderer.drawString("room uuid: " + dungeonRoom.getDungeonRoomInfo().getUuid() + (dungeonRoom.getDungeonRoomInfo().isRegistered() ? "" : " (not registered)"), 5, 138, 0xFFFFFF); fontRenderer.drawString("room name: " + dungeonRoom.getDungeonRoomInfo().getName(), 5, 148, 0xFFFFFF); @@ -158,7 +158,7 @@ public class EventListener { DungeonContext context = skyblockStatus.getContext(); if (context == null) return; - if (e.DEBUG) { + if (Config.DEBUG) { for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { for(DungeonDoor door : dungeonRoom.getDoors()) { RenderUtils.renderDoor(door, renderWorldLastEvent.partialTicks); @@ -204,7 +204,7 @@ public class EventListener { @SubscribeEvent public void onKeyInput(InputEvent.KeyInputEvent keyInputEvent) { - if (e.DEBUG &&Keybinds.editingSession.isKeyDown() ){ + if (Config.DEBUG &&Keybinds.editingSession.isKeyDown() ){ EditingContext ec = EditingContext.getEditingContext(); if (ec == null) { DungeonContext context = e.getDungeonsGuide().getSkyblockStatus().getContext(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/Keybinds.java b/src/main/java/kr/syeyoung/dungeonsguide/Keybinds.java index 91ab880e..43e67eac 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/Keybinds.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/Keybinds.java @@ -11,9 +11,7 @@ public class Keybinds public static void register() { - if (e.DEBUG) { - editingSession = new KeyBinding("start editing session", Keyboard.KEY_NONE, "key.categories.misc"); - ClientRegistry.registerKeyBinding(editingSession); - } + editingSession = new KeyBinding("start editing session", Keyboard.KEY_NONE, "key.categories.misc"); + ClientRegistry.registerKeyBinding(editingSession); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/a.java b/src/main/java/kr/syeyoung/dungeonsguide/a.java index 2ce0e96c..23875cb7 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/a.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/a.java @@ -40,77 +40,77 @@ public class a d.init(a); } - @EventHandler - public void a(FMLPreInitializationEvent a) { - b b = new b(); - String c = null; - try { - c = b.b(); - if (c != null) { - this.a = this; - URL.setURLStreamHandlerFactory(new c(b)); - LaunchClassLoader d = (LaunchClassLoader) a.class.getClassLoader(); - d.addURL(new URL("z:///")); - - try { - this.d = new e(b); - this.d.pre(a); - } catch (Exception e) { - e.printStackTrace(); - - a(new String[]{ - "Couldn't load Dungeons Guide", - "Please contact developer if this problem persists after restart" - }); - } - return; - } - } catch (IOException e) { - e.printStackTrace(); - } catch (AuthenticationException e) { - e.printStackTrace(); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (NoSuchPaddingException e) { - e.printStackTrace(); - } catch (InvalidKeyException e) { - e.printStackTrace(); - } catch (InvalidAlgorithmParameterException e) { - e.printStackTrace(); - } catch (IllegalBlockSizeException e) { - e.printStackTrace(); - } catch (BadPaddingException e) { - e.printStackTrace(); - } catch (CertificateException e) { - e.printStackTrace(); - } catch (KeyStoreException e) { - e.printStackTrace(); - } catch (KeyManagementException e) { - e.printStackTrace(); - } - - a(new String[]{ - "Can't validate current installation of Dungeons Guide", - "Steps to fix", - "1. check if other people can't join minecraft servers.", - "2. restart minecraft launcher", - "3. make sure you're on the right account", - "4. restart your computer", - "If the problem persists after following these steps, please contact developer", - "If you haven't purchased the mod, please consider doing so" - }); - } // @EventHandler -// public void pre(FMLPreInitializationEvent event) { -// a = this; -// URL.setURLStreamHandlerFactory(new c(null)); +// public void a(FMLPreInitializationEvent a) { +// b b = new b(); +// String c = null; +// try { +// c = b.b(); +// if (c != null) { +// this.a = this; +// URL.setURLStreamHandlerFactory(new c(b)); +// LaunchClassLoader d = (LaunchClassLoader) a.class.getClassLoader(); +// d.addURL(new URL("z:///")); +// // try { -// d = new e(null); -// d.pre(event); +// this.d = new e(b); +// this.d.pre(a); // } catch (Exception e) { // e.printStackTrace(); +// +// a(new String[]{ +// "Couldn't load Dungeons Guide", +// "Please contact developer if this problem persists after restart" +// }); // } +// return; +// } +// } catch (IOException e) { +// e.printStackTrace(); +// } catch (AuthenticationException e) { +// e.printStackTrace(); +// } catch (NoSuchAlgorithmException e) { +// e.printStackTrace(); +// } catch (NoSuchPaddingException e) { +// e.printStackTrace(); +// } catch (InvalidKeyException e) { +// e.printStackTrace(); +// } catch (InvalidAlgorithmParameterException e) { +// e.printStackTrace(); +// } catch (IllegalBlockSizeException e) { +// e.printStackTrace(); +// } catch (BadPaddingException e) { +// e.printStackTrace(); +// } catch (CertificateException e) { +// e.printStackTrace(); +// } catch (KeyStoreException e) { +// e.printStackTrace(); +// } catch (KeyManagementException e) { +// e.printStackTrace(); +// } +// +// a(new String[]{ +// "Can't validate current installation of Dungeons Guide", +// "Steps to fix", +// "1. check if other people can't join minecraft servers.", +// "2. restart minecraft launcher", +// "3. make sure you're on the right account", +// "4. restart your computer", +// "If the problem persists after following these steps, please contact developer", +// "If you haven't purchased the mod, please consider doing so" +// }); // } + @EventHandler + public void pre(FMLPreInitializationEvent event) { + a = this; + URL.setURLStreamHandlerFactory(new c(null)); + try { + d = new e(null); + d.pre(event); + } catch (Exception e) { + e.printStackTrace(); + } + } public void a(final String[] a) { final GuiScreen b = new GuiErrorScreen(null, null) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java new file mode 100644 index 00000000..a9308f4c --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java @@ -0,0 +1,67 @@ +package kr.syeyoung.dungeonsguide.commands; + +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; +import kr.syeyoung.dungeonsguide.e; +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; +import net.minecraft.util.ChatComponentText; + +import javax.crypto.BadPaddingException; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import java.io.IOException; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; + +public class CommandDungeonsGuide extends CommandBase { + @Override + public String getCommandName() { + return "dg"; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return "dg"; + } + + @Override + public void processCommand(ICommandSender sender, String[] args) { + if (args.length == 0) { + // open config + } else if (args[0].equalsIgnoreCase("saverooms")) { + DungeonRoomInfoRegistry.saveAll(e.getDungeonsGuide().getConfigDir()); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSuccessfully saved user generated roomdata")); + } else if (args[0].equalsIgnoreCase("loadrooms")) { + try { + DungeonRoomInfoRegistry.loadAll(e.getDungeonsGuide().getConfigDir()); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSuccessfully loaded roomdatas")); + return; + } catch (BadPaddingException e) { + e.printStackTrace(); + } catch (InvalidAlgorithmParameterException e) { + e.printStackTrace(); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } catch (IllegalBlockSizeException e) { + e.printStackTrace(); + } catch (NoSuchPaddingException e) { + e.printStackTrace(); + } catch (InvalidKeyException e) { + e.printStackTrace(); + } + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cAn error has occurred while loading roomdata")); + } else { + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg §7-§fOpens configuration gui")); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg help §7-§fShows command help")); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg saverooms §7-§f Saves usergenerated dungeon roomdata.")); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg loadrooms §7-§f Reloads dungeon roomdata.")); + } + } + @Override + public int getRequiredPermissionLevel() { + return 0; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandLoadData.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandLoadData.java deleted file mode 100755 index 4705259f..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandLoadData.java +++ /dev/null @@ -1,50 +0,0 @@ -package kr.syeyoung.dungeonsguide.commands; - -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; -import net.minecraft.command.CommandBase; -import net.minecraft.command.ICommandSender; - -import javax.crypto.BadPaddingException; -import javax.crypto.IllegalBlockSizeException; -import javax.crypto.NoSuchPaddingException; -import java.io.IOException; -import java.security.InvalidAlgorithmParameterException; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; - -public class CommandLoadData extends CommandBase { - @Override - public String getCommandName() { - return "loadrooms"; - } - - @Override - public String getCommandUsage(ICommandSender sender) { - return "loadrooms"; - } - - @Override - public void processCommand(ICommandSender sender, String[] args) { - try { - DungeonRoomInfoRegistry.loadAll(); - } catch (BadPaddingException e) { - e.printStackTrace(); - } catch (InvalidAlgorithmParameterException e) { - e.printStackTrace(); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (IllegalBlockSizeException e) { - e.printStackTrace(); - } catch (NoSuchPaddingException e) { - e.printStackTrace(); - } catch (InvalidKeyException e) { - e.printStackTrace(); - } - } - @Override - public int getRequiredPermissionLevel() { - return 0; - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandSaveData.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandSaveData.java deleted file mode 100755 index e7fdc454..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandSaveData.java +++ /dev/null @@ -1,28 +0,0 @@ -package kr.syeyoung.dungeonsguide.commands; - -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; -import net.minecraft.command.CommandBase; -import net.minecraft.command.ICommandSender; - -public class CommandSaveData extends CommandBase { - @Override - public String getCommandName() { - return "saverooms"; - } - - @Override - public String getCommandUsage(ICommandSender sender) { - return "saverooms"; - } - - @Override - public void processCommand(ICommandSender sender, String[] args) { - if (e.DEBUG) - DungeonRoomInfoRegistry.saveAll(e.getDungeonsGuide().getConfigDir()); - } - @Override - public int getRequiredPermissionLevel() { - return 0; - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/DungeonRoomInfo.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/DungeonRoomInfo.java index a57e33b7..83427c14 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/DungeonRoomInfo.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/DungeonRoomInfo.java @@ -12,6 +12,7 @@ import java.util.UUID; @Getter @Setter public class DungeonRoomInfo implements Serializable { + private static final long serialVersionUID = 42L; public DungeonRoomInfo(short shape, byte color) { this.uuid = UUID.randomUUID(); @@ -22,6 +23,8 @@ public class DungeonRoomInfo implements Serializable { private transient boolean registered; + private boolean isUserMade = false; + private short shape; private byte color; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java index 2bf62add..4a4def5d 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java @@ -50,10 +50,10 @@ public class DungeonRoomInfoRegistry { } public static void saveAll(File dir) { - if (!e.DEBUG) return; dir.mkdirs(); for (DungeonRoomInfo dungeonRoomInfo : registered) { try { + if (!dungeonRoomInfo.isUserMade()) continue; FileOutputStream fos = new FileOutputStream(new File(dir, dungeonRoomInfo.getUuid().toString() + ".roomdata")); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(dungeonRoomInfo); @@ -63,7 +63,7 @@ public class DungeonRoomInfoRegistry { } } - public static void loadAll() throws BadPaddingException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException, IllegalBlockSizeException, NoSuchPaddingException, InvalidKeyException { + public static void loadAll(File dir) throws BadPaddingException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException, IllegalBlockSizeException, NoSuchPaddingException, InvalidKeyException { registered.clear(); shapeMap.clear(); uuidMap.clear(); @@ -80,5 +80,17 @@ public class DungeonRoomInfoRegistry { register(dri); } catch (Exception e) {e.printStackTrace();} } + for (File f : dir.listFiles()) { + if (!f.getName().endsWith(".roomdata")) continue; + try { + InputStream fis = new FileInputStream(f); + ObjectInputStream ois = new ObjectInputStream(fis); + DungeonRoomInfo dri = (DungeonRoomInfo) ois.readObject(); + ois.close(); + fis.close(); + register(dri); + } catch (Exception e) {e.printStackTrace();} + } } + } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/e.java b/src/main/java/kr/syeyoung/dungeonsguide/e.java index a1d28103..f818d35b 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/e.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/e.java @@ -7,7 +7,9 @@ import net.minecraft.client.Minecraft; import net.minecraft.util.IChatComponent; import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.config.Property; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import org.apache.commons.io.IOUtils; @@ -29,20 +31,16 @@ public class e implements c { private static e dungeonsGuide; - public static final boolean DEBUG = false; @Getter private b authenticator; - @Getter - private Configuration configuration; - public e(b authenticator) { this.authenticator = authenticator; } public static void sendDebugChat(IChatComponent iChatComponent) { - if (DEBUG) + if (Config.DEBUG) Minecraft.getMinecraft().thePlayer.addChatMessage(iChatComponent); } @@ -52,11 +50,10 @@ public class e implements c { skyblockStatus = new SkyblockStatus(); MinecraftForge.EVENT_BUS.register(new EventListener()); - ClientCommandHandler.instance.registerCommand(new CommandLoadData()); - ClientCommandHandler.instance.registerCommand(new CommandSaveData()); + ClientCommandHandler.instance.registerCommand(new CommandDungeonsGuide()); try { - DungeonRoomInfoRegistry.loadAll(); + DungeonRoomInfoRegistry.loadAll(configDir); } catch (BadPaddingException e) { e.printStackTrace(); } catch (InvalidAlgorithmParameterException e) { @@ -80,14 +77,8 @@ public class e implements c { File configFile = new File(configDir, "config.conf"); if (!configFile.exists()) { configDir.mkdirs(); - try { - copy(e.class.getResourceAsStream("/defaultConfig.conf"), configFile); - } catch (IOException e) { - e.printStackTrace(); - } } - configuration = new Configuration(configFile); - configuration.load(); + Config.syncConfig( new Configuration(configFile) ); } private void copy(InputStream inputStream, File f) throws IOException { FileOutputStream fos = new FileOutputStream(f); @@ -97,6 +88,9 @@ public class e implements c { inputStream.close(); } + private void combineConfig(Configuration saved, Configuration newest) { + } + @Getter private File configDir; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java index 3abd5bb4..4bd7993e 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java @@ -1,5 +1,6 @@ package kr.syeyoung.dungeonsguide.roomprocessor; +import kr.syeyoung.dungeonsguide.Config; import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; @@ -33,7 +34,7 @@ public class GeneralRoomProcessor implements RoomProcessor { @Override public void drawWorld(float partialTicks) { - if (e.DEBUG && (EditingContext.getEditingContext() == null || EditingContext.getEditingContext().getCurrent() instanceof GuiDungeonRoomEdit)) { + if (Config.DEBUG && (EditingContext.getEditingContext() == null || EditingContext.getEditingContext().getCurrent() instanceof GuiDungeonRoomEdit)) { for (Map.Entry<String, DungeonMechanic> value : dungeonRoom.getDungeonRoomInfo().getMechanics().entrySet()) { if (value.getValue() == null) continue;; value.getValue().highlight(new Color(0,255,255,50), value.getKey(), dungeonRoom, partialTicks); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java index fbcdb244..f3b0cf4b 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java @@ -1,6 +1,7 @@ package kr.syeyoung.dungeonsguide.roomprocessor; import com.google.common.base.Predicate; +import kr.syeyoung.dungeonsguide.Config; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.utils.RenderUtils; import kr.syeyoung.dungeonsguide.utils.TextUtils; @@ -77,6 +78,7 @@ public class RoomProcessorBlazeSolver extends GeneralRoomProcessor { @Override public void drawWorld(float partialTicks) { super.drawWorld(partialTicks); + if (!Config.solver_blaze) return; if (next == null) return; Vec3 pos = next.getPositionEyes(partialTicks); RenderUtils.highlightBox(next, new Color(0,255,0,100), partialTicks, false); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorCreeperSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorCreeperSolver.java index cb3ef000..a6653fdc 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorCreeperSolver.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorCreeperSolver.java @@ -1,6 +1,7 @@ package kr.syeyoung.dungeonsguide.roomprocessor; import com.google.common.base.Predicate; +import kr.syeyoung.dungeonsguide.Config; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; @@ -115,6 +116,7 @@ public class RoomProcessorCreeperSolver extends GeneralRoomProcessor { @Override public void drawWorld(float partialTicks) { super.drawWorld(partialTicks); + if (!Config.solver_creeper) return; World w = getDungeonRoom().getContext().getWorld(); for (int i = 0; i < poses.size(); i++) { BlockPos[] poset = poses.get(i); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorIcePath.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorIcePath.java index c2572a32..2f30c506 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorIcePath.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorIcePath.java @@ -1,6 +1,7 @@ package kr.syeyoung.dungeonsguide.roomprocessor; import com.google.common.base.Predicate; +import kr.syeyoung.dungeonsguide.Config; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; @@ -118,6 +119,7 @@ public class RoomProcessorIcePath extends GeneralRoomProcessor { @Override public void drawWorld(float partialTicks) { super.drawWorld(partialTicks); + if (!Config.solver_icesilverfish) return; if (!err) RenderUtils.drawLines(solution, new Color(0,255,0, 255), partialTicks, false); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRiddle.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRiddle.java index d73e4300..5ebec35d 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRiddle.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRiddle.java @@ -1,6 +1,7 @@ package kr.syeyoung.dungeonsguide.roomprocessor; import com.google.common.base.Predicate; +import kr.syeyoung.dungeonsguide.Config; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.roomedit.Parameter; import kr.syeyoung.dungeonsguide.utils.RenderUtils; @@ -38,6 +39,7 @@ public class RoomProcessorRiddle extends GeneralRoomProcessor { @Override public void chatReceived(IChatComponent chat) { super.chatReceived(chat); + if (!Config.solver_riddle) return; String ch2 = chat.getUnformattedText(); if (!ch2.startsWith("§e[NPC] ")) { return; @@ -86,6 +88,7 @@ public class RoomProcessorRiddle extends GeneralRoomProcessor { @Override public void drawWorld(float partialTicks) { super.drawWorld(partialTicks); + if (!Config.solver_riddle) return; if (chest != null) { RenderUtils.highlightBlock(chest, new Color(0,255,0, 50),partialTicks); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTeleportMazeSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTeleportMazeSolver.java index 6aaf2ba8..844789fb 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTeleportMazeSolver.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTeleportMazeSolver.java @@ -1,5 +1,6 @@ package kr.syeyoung.dungeonsguide.roomprocessor; +import kr.syeyoung.dungeonsguide.Config; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.block.Block; @@ -62,6 +63,7 @@ public class RoomProcessorTeleportMazeSolver extends GeneralRoomProcessor { @Override public void drawWorld(float partialTicks) { super.drawWorld(partialTicks); + if (!Config.solver_teleport) return; for (BlockPos bpos:visitedPortals) { RenderUtils.highlightBlock(bpos, new Color(255,0,0,100), partialTicks); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTicTacToeSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTicTacToeSolver.java index b7aa4781..353a3ed6 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTicTacToeSolver.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTicTacToeSolver.java @@ -1,5 +1,6 @@ package kr.syeyoung.dungeonsguide.roomprocessor; +import kr.syeyoung.dungeonsguide.Config; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; @@ -138,6 +139,7 @@ public class RoomProcessorTicTacToeSolver extends GeneralRoomProcessor { @Override public void tick() { super.tick(); + if (!Config.solver_tictactoe) return; if (board == null) return; if (gameEnded) return; byte[][] board = buildBoardState(); @@ -168,6 +170,7 @@ public class RoomProcessorTicTacToeSolver extends GeneralRoomProcessor { @Override public void drawWorld(float partialTicks) { super.drawWorld(partialTicks); + if (!Config.solver_tictactoe) return; if (chosePos != -1) { BlockPos block = board.getOffsetPointList().get(chosePos).getBlockPos(getDungeonRoom()); RenderUtils.highlightBlock(block, new Color(0,255,255,50), partialTicks); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTrivia.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTrivia.java index 983ca771..1b56768a 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTrivia.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTrivia.java @@ -1,5 +1,6 @@ package kr.syeyoung.dungeonsguide.roomprocessor; +import kr.syeyoung.dungeonsguide.Config; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.utils.RenderUtils; @@ -72,6 +73,7 @@ public class RoomProcessorTrivia extends GeneralRoomProcessor { @Override public void chatReceived(IChatComponent chat) { super.chatReceived(chat); + if (!Config.solver_kahoot) return; String ch2 = chat.getUnformattedText(); if (chat.getFormattedText().contains("§r§6§lQuestion ")) { questionDialogStart = true; @@ -147,6 +149,7 @@ public class RoomProcessorTrivia extends GeneralRoomProcessor { @Override public void drawWorld(float partialTicks) { super.drawWorld(partialTicks); + if (!Config.solver_kahoot) return; if (correctAnswer == null) return; OffsetPoint op = (OffsetPoint) getDungeonRoom().getDungeonRoomInfo().getProperties().get(correctAnswer); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java index 9b45b4a9..1ed35e55 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java @@ -1,5 +1,6 @@ package kr.syeyoung.dungeonsguide.roomprocessor.boxpuzzle; +import kr.syeyoung.dungeonsguide.Config; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; @@ -78,6 +79,7 @@ public class RoomProcessorBoxSolver extends GeneralRoomProcessor { @Override public void tick() { super.tick(); + if (!Config.solver_box) return; if (bugged) return; byte[][] currboard = buildCurrentState(); if (puzzleSolvingThread == null) { @@ -294,6 +296,7 @@ public class RoomProcessorBoxSolver extends GeneralRoomProcessor { @Override public void chatReceived(IChatComponent chat) { + if (!Config.solver_box) return; if (chat.getFormattedText().toLowerCase().contains("recalc")) { if (calcDone) { calcReq = true; @@ -308,6 +311,7 @@ public class RoomProcessorBoxSolver extends GeneralRoomProcessor { @Override public void drawScreen(float partialTicks) { super.drawScreen(partialTicks); + if (!Config.solver_box) return; FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; fr.drawString("Type \"recalc\" in chat to recalculate the solution", 0, 0, 0xFFFFFFFF); } @@ -315,6 +319,7 @@ public class RoomProcessorBoxSolver extends GeneralRoomProcessor { @Override public void drawWorld(float partialTicks) { super.drawWorld(partialTicks); + if (!Config.solver_box) return; if (bugged) return; if (!calcDone) return; if (solution == null) return; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/icefill/RoomProcessorIcePath2.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/icefill/RoomProcessorIcePath2.java index c0cf99a5..6ec948a9 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/icefill/RoomProcessorIcePath2.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/icefill/RoomProcessorIcePath2.java @@ -1,5 +1,6 @@ package kr.syeyoung.dungeonsguide.roomprocessor.icefill; +import kr.syeyoung.dungeonsguide.Config; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; @@ -87,6 +88,7 @@ public class RoomProcessorIcePath2 extends GeneralRoomProcessor { @Override public void drawWorld(float partialTicks) { + if (!Config.solver_icepath) return; for (List<BlockPos> solution:this.solution) RenderUtils.drawLines(solution, new Color(0,255,0, 255), partialTicks, true); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/RoomProcessorWaterPuzzle.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/RoomProcessorWaterPuzzle.java index b2059884..c4787d48 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/RoomProcessorWaterPuzzle.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/RoomProcessorWaterPuzzle.java @@ -1,5 +1,6 @@ package kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle; +import kr.syeyoung.dungeonsguide.Config; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; @@ -49,6 +50,7 @@ public class RoomProcessorWaterPuzzle extends GeneralRoomProcessor { @Override public void tick() { super.tick(); + if (!Config.solver_waterpuzzle) return; if (!argumentsFulfilled) return; try { waterBoard.tick(); @@ -65,6 +67,7 @@ public class RoomProcessorWaterPuzzle extends GeneralRoomProcessor { @Override public void drawWorld(float partialTicks) { super.drawWorld(partialTicks); + if (!Config.solver_waterpuzzle) return; if (!argumentsFulfilled) return; if (waterBoard == null) return; |