From abeb54dbea7e4219f4a277211cd33df3aff39dd9 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sat, 27 Feb 2021 19:06:17 -0500 Subject: Make config handling easier And move display variables to LootDisplay.java --- src/main/java/me/Danker/features/AutoDisplay.java | 29 +++++++++++----------- .../java/me/Danker/features/loot/LootDisplay.java | 9 ++++--- 2 files changed, 21 insertions(+), 17 deletions(-) (limited to 'src/main/java/me/Danker/features') diff --git a/src/main/java/me/Danker/features/AutoDisplay.java b/src/main/java/me/Danker/features/AutoDisplay.java index aaed4ca..5411034 100644 --- a/src/main/java/me/Danker/features/AutoDisplay.java +++ b/src/main/java/me/Danker/features/AutoDisplay.java @@ -2,6 +2,7 @@ package me.Danker.features; import me.Danker.DankersSkyblockMod; import me.Danker.commands.DisplayCommand; +import me.Danker.features.loot.LootDisplay; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.ScoreboardHandler; import net.minecraft.client.Minecraft; @@ -23,35 +24,35 @@ public class AutoDisplay { World world = mc.theWorld; EntityPlayerSP player = mc.thePlayer; if (DankersSkyblockMod.tickAmount % 20 == 0) { - if (DisplayCommand.auto && world != null && player != null) { + if (LootDisplay.auto && world != null && player != null) { List scoreboard = ScoreboardHandler.getSidebarLines(); boolean found = false; for (String s : scoreboard) { String sCleaned = ScoreboardHandler.cleanSB(s); if (sCleaned.contains("Sven Packmaster")) { - DisplayCommand.display = "wolf"; + LootDisplay.display = "wolf"; found = true; } else if (sCleaned.contains("Tarantula Broodfather")) { - DisplayCommand.display = "spider"; + LootDisplay.display = "spider"; found = true; } else if (sCleaned.contains("Revenant Horror")) { - DisplayCommand.display = "zombie"; + LootDisplay.display = "zombie"; found = true; } else if (sCleaned.contains("The Catacombs (")) { if (sCleaned.contains("F1")) { - DisplayCommand.display = "catacombs_floor_one"; + LootDisplay.display = "catacombs_floor_one"; } else if (sCleaned.contains("F2")) { - DisplayCommand.display = "catacombs_floor_two"; + LootDisplay.display = "catacombs_floor_two"; } else if (sCleaned.contains("F3")) { - DisplayCommand.display = "catacombs_floor_three"; + LootDisplay.display = "catacombs_floor_three"; } else if (sCleaned.contains("F4")) { - DisplayCommand.display = "catacombs_floor_four"; + LootDisplay.display = "catacombs_floor_four"; } else if (sCleaned.contains("F5")) { - DisplayCommand.display = "catacombs_floor_five"; + LootDisplay.display = "catacombs_floor_five"; } else if (sCleaned.contains("F6")) { - DisplayCommand.display = "catacombs_floor_six"; + LootDisplay.display = "catacombs_floor_six"; } else if (sCleaned.contains("F7")) { - DisplayCommand.display = "catacombs_floor_seven"; + LootDisplay.display = "catacombs_floor_seven"; } found = true; } @@ -60,12 +61,12 @@ public class AutoDisplay { ItemStack hotbarItem = player.inventory.getStackInSlot(i); if (hotbarItem == null) continue; if (hotbarItem.getDisplayName().contains("Ancestral Spade")) { - DisplayCommand.display = "mythological"; + LootDisplay.display = "mythological"; found = true; } } - if (!found) DisplayCommand.display = "off"; - ConfigHandler.writeStringConfig("misc", "display", DisplayCommand.display); + if (!found) LootDisplay.display = "off"; + ConfigHandler.writeStringConfig("misc", "display", LootDisplay.display); } } } diff --git a/src/main/java/me/Danker/features/loot/LootDisplay.java b/src/main/java/me/Danker/features/loot/LootDisplay.java index d4868e3..4013c0a 100644 --- a/src/main/java/me/Danker/features/loot/LootDisplay.java +++ b/src/main/java/me/Danker/features/loot/LootDisplay.java @@ -17,9 +17,12 @@ import java.util.Locale; public class LootDisplay { + public static String display; + public static boolean auto; + @SubscribeEvent public void renderPlayerInfo(RenderOverlay event) { - if (!DisplayCommand.display.equals("off")) { + if (!display.equals("off")) { Minecraft mc = Minecraft.getMinecraft(); String dropsText = ""; String countText = ""; @@ -31,7 +34,7 @@ public class LootDisplay { double timeNow = System.currentTimeMillis() / 1000; NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US); - switch (DisplayCommand.display) { + switch (display) { case "wolf": if (LootTracker.wolfTime == -1) { timeBetween = "Never"; @@ -892,7 +895,7 @@ public class LootDisplay { break; default: System.out.println("Display was an unknown value, turning off."); - DisplayCommand.display = "off"; + display = "off"; ConfigHandler.writeStringConfig("misc", "display", "off"); } new TextRenderer(mc, dropsText, MoveCommand.displayXY[0], MoveCommand.displayXY[1], ScaleCommand.displayScale); -- cgit