diff options
6 files changed, 247 insertions, 221 deletions
diff --git a/src/main/java/at/lorenz/mod/LorenzDebug.kt b/src/main/java/at/lorenz/mod/LorenzDebug.kt index 7687727a9..61eb09065 100644 --- a/src/main/java/at/lorenz/mod/LorenzDebug.kt +++ b/src/main/java/at/lorenz/mod/LorenzDebug.kt @@ -1,6 +1,7 @@ package at.lorenz.mod import at.lorenz.mod.utils.LorenzLogger +import at.lorenz.mod.utils.LorenzUtils object LorenzDebug { @@ -10,4 +11,9 @@ object LorenzDebug { logger.log(text) println("debug logger: $text") } + + fun writeAndLog(text: String) { + LorenzUtils.debug(text) + log(text) + } }
\ No newline at end of file diff --git a/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java b/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java index d33f990e9..15fff4928 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java @@ -8,13 +8,23 @@ import at.lorenz.mod.chat.ChatFilter; import at.lorenz.mod.chat.ChatManager; import at.lorenz.mod.dungeon.DungeonChatFilter; import at.lorenz.mod.dungeon.DungeonHighlightClickedBlocks; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.thatgravyboat.skyblockhud.commands.Commands; import com.thatgravyboat.skyblockhud.config.SBHConfig; -import java.io.File; +import com.thatgravyboat.skyblockhud.textures.Textures; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.IReloadableResourceManager; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.io.*; +import java.nio.charset.StandardCharsets; @Mod(modid = SkyblockHud.MODID, version = SkyblockHud.VERSION) public class SkyblockHud { @@ -23,12 +33,11 @@ public class SkyblockHud { public static final String VERSION = "0.1"; public static SBHConfig config; - - // private File configFile; + private File configFile; // private static final Set<String> SKYBLOCK_IN_ALL_LANGUAGES = Sets.newHashSet("SKYBLOCK", "\u7A7A\u5C9B\u751F\u5B58"); - // private final Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().create(); + private final Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().create(); public static File configDirectory; @@ -36,6 +45,7 @@ public class SkyblockHud { public void preInit(FMLPreInitializationEvent event) { new BazaarApi(); + MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(new BazaarOrderHelper()); MinecraftForge.EVENT_BUS.register(new ChatManager()); MinecraftForge.EVENT_BUS.register(new ChatFilter()); @@ -43,6 +53,7 @@ public class SkyblockHud { MinecraftForge.EVENT_BUS.register(new HideNotClickableItems()); MinecraftForge.EVENT_BUS.register(new DungeonHighlightClickedBlocks()); MinecraftForge.EVENT_BUS.register(new ItemDisplayOverlayFeatures()); + Commands.init(); // MinecraftForge.EVENT_BUS.register(new LeaderboardGetter()); // MinecraftForge.EVENT_BUS.register(new SeasonDateHandler()); // MinecraftForge.EVENT_BUS.register(new LocationHandler()); @@ -67,28 +78,31 @@ public class SkyblockHud { // MinecraftForge.EVENT_BUS.register(new FarmHouseHandler()); // MinecraftForge.EVENT_BUS.register(new WarpHandler()); // MinecraftForge.EVENT_BUS.register(new CooldownHandler()); - // Commands.init(); + // // ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new NpcDialogue()); - // ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new Textures()); + ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new Textures()); // - // configDirectory = new File(event.getModConfigurationDirectory(), "skyblockhud"); - // try { - // configDirectory.mkdir(); - // } catch (Exception ignored) {} - // - // configFile = new File(configDirectory, "sbh-config.json"); - // - // if (configFile.exists()) { - // try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8))) { - // config = gson.fromJson(reader, SBHConfig.class); - // } catch (Exception ignored) {} - // } - // - // if (config == null) { - // config = new SBHConfig(); - // saveConfig(); - // } + configDirectory = new File("mods/LorenzMod/config"); + try { + //noinspection ResultOfMethodCallIgnored + configDirectory.mkdir(); + } catch (Exception ignored) { + } + + configFile = new File(configDirectory, "config.json"); + + if (configFile.exists()) { + try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8))) { + config = gson.fromJson(reader, SBHConfig.class); + } catch (Exception ignored) { + } + } + + if (config == null) { + config = new SBHConfig(); + saveConfig(); + } // // Textures.setTexture(config.misc.style); // @@ -96,19 +110,21 @@ public class SkyblockHud { // WarpHandler.save(); // } // - // Runtime.getRuntime().addShutdownHook(new Thread(this::saveConfig)); + Runtime.getRuntime().addShutdownHook(new Thread(this::saveConfig)); // Runtime.getRuntime().addShutdownHook(new Thread(TrackerFileLoader::saveTrackerStatsFile)); } - // public void saveConfig() { - // try { - // configFile.createNewFile(); - // - // try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8))) { - // writer.write(gson.toJson(config)); - // } - // } catch (IOException ignored) {} - // } + public void saveConfig() { + try { + //noinspection ResultOfMethodCallIgnored + configFile.createNewFile(); + + try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8))) { + writer.write(gson.toJson(config)); + } + } catch (IOException ignored) { + } + } // @EventHandler // public void postInit(FMLPostInitializationEvent event) { @@ -179,17 +195,17 @@ public class SkyblockHud { // } public static GuiScreen screenToOpen = null; - // private static int screenTicks = 0; - - // @SubscribeEvent - // public void onClientTick(TickEvent.ClientTickEvent event) { - // if (screenToOpen != null) { - // screenTicks++; - // if (screenTicks == 5) { - // Minecraft.getMinecraft().displayGuiScreen(screenToOpen); - // screenTicks = 0; - // screenToOpen = null; - // } - // } - // } + private static int screenTicks = 0; + + @SubscribeEvent + public void onClientTick(TickEvent.ClientTickEvent event) { + if (screenToOpen != null) { + screenTicks++; + if (screenTicks == 5) { + Minecraft.getMinecraft().displayGuiScreen(screenToOpen); + screenTicks = 0; + screenToOpen = null; + } + } + } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java b/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java index e8ac1d389..517390a5d 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java @@ -1,30 +1,16 @@ package com.thatgravyboat.skyblockhud.commands; -import com.google.common.collect.ImmutableSet; -import com.thatgravyboat.skyblockhud.DevModeConstants; import com.thatgravyboat.skyblockhud.SkyblockHud; -import com.thatgravyboat.skyblockhud.api.LeaderboardGetter; import com.thatgravyboat.skyblockhud.config.SBHConfigEditor; import com.thatgravyboat.skyblockhud.core.GuiScreenElementWrapper; import com.thatgravyboat.skyblockhud.handlers.CrystalWaypoints; -import com.thatgravyboat.skyblockhud.handlers.MapHandler; -import com.thatgravyboat.skyblockhud.location.LocationHandler; -import com.thatgravyboat.skyblockhud.playerstats.ActionBarParsing; -import java.awt.*; -import java.awt.datatransfer.StringSelection; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.command.ICommandSender; -import net.minecraft.entity.Entity; -import net.minecraft.entity.boss.BossStatus; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.client.ClientCommandHandler; import org.apache.commons.lang3.StringUtils; public class Commands { - private static boolean devMode = false; + private static final boolean devMode = false; private static final SimpleCommand.ProcessCommandRunnable settingsRunnable = new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { @@ -36,70 +22,68 @@ public class Commands { } }; - private static final SimpleSubCommand devCommand = new SimpleSubCommand("sbhdev", ImmutableSet.of("copyNpcSkin", "copyBossBar", "copyScoreboard", "copyActionBar", "mobDeathLogging")) { - @Override - void processSubCommand(ICommandSender sender, String subCommand, String[] args) { - StringSelection clipboard = null; - switch (subCommand) { - case "copyBossBar": - clipboard = new StringSelection(BossStatus.bossName); - break; - case "copyScoreboard": - StringBuilder builder = new StringBuilder(); - LeaderboardGetter.getCachedScores().forEach(s -> builder.append(s).append("\n")); - clipboard = new StringSelection(builder.toString()); - break; - case "copyActionBar": - clipboard = new StringSelection(ActionBarParsing.lastLowActionBar); - break; - case "copySkin": - Entity entity = Minecraft.getMinecraft().objectMouseOver.entityHit; - if (entity instanceof AbstractClientPlayer) { - clipboard = new StringSelection("http://textures.minecraft.net/texture/" + ((AbstractClientPlayer) entity).getLocationSkin().getResourcePath().replace("skins/", "")); - } else { - sendSBHMessage(sender, "Not a player!"); - } - break; - case "mobDeathLogging": - DevModeConstants.mobDeathLogging = !DevModeConstants.mobDeathLogging; - sendSBHMessage(sender, "Mob Death Logging " + (DevModeConstants.mobDeathLogging ? "Enabled!" : "Disabled!")); - } - if (clipboard != null) { - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(clipboard, clipboard); - sendSBHMessage(sender, "Info copied to clipboard!"); - } - } +// private static final SimpleSubCommand devCommand = new SimpleSubCommand("sbhdev", ImmutableSet.of("copyNpcSkin", "copyBossBar", "copyScoreboard", "copyActionBar", "mobDeathLogging")) { +// @Override +// void processSubCommand(ICommandSender sender, String subCommand, String[] args) { +// StringSelection clipboard = null; +// switch (subCommand) { +// case "copyBossBar": +// clipboard = new StringSelection(BossStatus.bossName); +// break; +// case "copyScoreboard": +// StringBuilder builder = new StringBuilder(); +// LeaderboardGetter.getCachedScores().forEach(s -> builder.append(s).append("\n")); +// clipboard = new StringSelection(builder.toString()); +// break; +// case "copyActionBar": +// clipboard = new StringSelection(ActionBarParsing.lastLowActionBar); +// break; +// case "copySkin": +// Entity entity = Minecraft.getMinecraft().objectMouseOver.entityHit; +// if (entity instanceof AbstractClientPlayer) { +// clipboard = new StringSelection("http://textures.minecraft.net/texture/" + ((AbstractClientPlayer) entity).getLocationSkin().getResourcePath().replace("skins/", "")); +// } else { +// sendSBHMessage(sender, "Not a player!"); +// } +// break; +// case "mobDeathLogging": +// DevModeConstants.mobDeathLogging = !DevModeConstants.mobDeathLogging; +// sendSBHMessage(sender, "Mob Death Logging " + (DevModeConstants.mobDeathLogging ? "Enabled!" : "Disabled!")); +// } +// if (clipboard != null) { +// Toolkit.getDefaultToolkit().getSystemClipboard().setContents(clipboard, clipboard); +// sendSBHMessage(sender, "Info copied to clipboard!"); +// } +// } +// +// @Override +// void processNoSubCommand(ICommandSender sender) { +// devMode = !devMode; +// sender.addChatMessage(new ChatComponentText("Dev Mode " + (devMode ? "Enabled!" : "Disabled!"))); +// } +// }; - @Override - void processNoSubCommand(ICommandSender sender) { - devMode = !devMode; - sender.addChatMessage(new ChatComponentText("Dev Mode " + (devMode ? "Enabled!" : "Disabled!"))); - } - }; + private static final SimpleCommand settingsCommand = new SimpleCommand("lm", settingsRunnable); + private static final SimpleCommand settingsCommand2 = new SimpleCommand("lorenzmod", settingsRunnable); - private static final SimpleCommand settingsCommand = new SimpleCommand("sbh", settingsRunnable); - private static final SimpleCommand settingsCommand2 = new SimpleCommand("sbhsettings", settingsRunnable); - private static final SimpleCommand settingsCommand3 = new SimpleCommand("sbhud", settingsRunnable); - - private static final SimpleCommand mapCommand = new SimpleCommand( - "sbhmap", - new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - if (LocationHandler.getCurrentLocation().getCategory().getMap() != null && SkyblockHud.hasSkyblockScoreboard()) SkyblockHud.screenToOpen = new MapHandler.MapScreen(); - } - } - ); +// private static final SimpleCommand mapCommand = new SimpleCommand( +// "sbhmap", +// new SimpleCommand.ProcessCommandRunnable() { +// public void processCommand(ICommandSender sender, String[] args) { +// if (LocationHandler.getCurrentLocation().getCategory().getMap() != null && SkyblockHud.hasSkyblockScoreboard()) SkyblockHud.screenToOpen = new MapHandler.MapScreen(); +// } +// } +// ); public static void init() { ClientCommandHandler.instance.registerCommand(settingsCommand); ClientCommandHandler.instance.registerCommand(settingsCommand2); - ClientCommandHandler.instance.registerCommand(settingsCommand3); - ClientCommandHandler.instance.registerCommand(mapCommand); - ClientCommandHandler.instance.registerCommand(devCommand); +// ClientCommandHandler.instance.registerCommand(mapCommand); +// ClientCommandHandler.instance.registerCommand(devCommand); ClientCommandHandler.instance.registerCommand(new CrystalWaypoints.WaypointCommand()); } - private static void sendSBHMessage(ICommandSender sender, String message) { - sender.addChatMessage(new ChatComponentText("[" + EnumChatFormatting.RED + EnumChatFormatting.BOLD + "SkyBlockHud" + EnumChatFormatting.RESET + "] : " + EnumChatFormatting.GRAY + message)); - } +// private static void sendSBHMessage(ICommandSender sender, String message) { +// sender.addChatMessage(new ChatComponentText("[" + EnumChatFormatting.RED + EnumChatFormatting.BOLD + "SkyBlockHud" + EnumChatFormatting.RESET + "] : " + EnumChatFormatting.GRAY + message)); +// } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java index 8793fb8ec..08e72d40d 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java @@ -20,55 +20,59 @@ public class SBHConfig extends Config { @Override public void executeRunnable(String runnableId) { - String activeConfigCategory = null; - if (Minecraft.getMinecraft().currentScreen instanceof GuiScreenElementWrapper) { - GuiScreenElementWrapper wrapper = (GuiScreenElementWrapper) Minecraft.getMinecraft().currentScreen; - if (wrapper.element instanceof SBHConfigEditor) { - activeConfigCategory = ((SBHConfigEditor) wrapper.element).getSelectedCategoryName(); - } - } - - switch (runnableId) { - case "rpg": - editOverlay(activeConfigCategory, 120, 47, rpg.rpgHudPosition); - return; - case "d1": - editOverlay(activeConfigCategory, 120, 32, dungeon.dungeonPlayer1); - return; - case "d2": - editOverlay(activeConfigCategory, 120, 32, dungeon.dungeonPlayer2); - return; - case "d3": - editOverlay(activeConfigCategory, 120, 32, dungeon.dungeonPlayer3); - return; - case "d4": - editOverlay(activeConfigCategory, 120, 32, dungeon.dungeonPlayer4); - return; - case "main": - editOverlay(activeConfigCategory, 1000, 34, main.mainHudPos); - return; - case "ultimate": - editOverlay(activeConfigCategory, 182, 5, dungeon.barPosition); - return; - case "map": - editOverlay(activeConfigCategory, 72, 72, map.miniMapPosition); - return; - case "tracker": - editOverlay(activeConfigCategory, 130, 70, trackers.trackerPosition); - return; - case "drill": - editOverlay(activeConfigCategory, 136, 7, mining.drillBar); - return; - case "heat": - editOverlay(activeConfigCategory, 45, 7, mining.heatBar); - return; - case "dialogue": - editOverlay(activeConfigCategory, 182, 68, misc.dialoguePos); - return; - } +// String activeConfigCategory = null; +// if (Minecraft.getMinecraft().currentScreen instanceof GuiScreenElementWrapper) { +// GuiScreenElementWrapper wrapper = (GuiScreenElementWrapper) Minecraft.getMinecraft().currentScreen; +// if (wrapper.element instanceof SBHConfigEditor) { +// activeConfigCategory = ((SBHConfigEditor) wrapper.element).getSelectedCategoryName(); +// } +// } +// +// switch (runnableId) { +// case "rpg": +// editOverlay(activeConfigCategory, 120, 47, rpg.rpgHudPosition); +// return; +// case "d1": +// editOverlay(activeConfigCategory, 120, 32, dungeon.dungeonPlayer1); +// return; +// case "d2": +// editOverlay(activeConfigCategory, 120, 32, dungeon.dungeonPlayer2); +// return; +// case "d3": +// editOverlay(activeConfigCategory, 120, 32, dungeon.dungeonPlayer3); +// return; +// case "d4": +// editOverlay(activeConfigCategory, 120, 32, dungeon.dungeonPlayer4); +// return; +// case "main": +// editOverlay(activeConfigCategory, 1000, 34, main.mainHudPos); +// return; +// case "ultimate": +// editOverlay(activeConfigCategory, 182, 5, dungeon.barPosition); +// return; +// case "map": +// editOverlay(activeConfigCategory, 72, 72, map.miniMapPosition); +// return; +// case "tracker": +// editOverlay(activeConfigCategory, 130, 70, trackers.trackerPosition); +// return; +// case "drill": +// editOverlay(activeConfigCategory, 136, 7, mining.drillBar); +// return; +// case "heat": +// editOverlay(activeConfigCategory, 45, 7, mining.heatBar); +// return; +// case "dialogue": +// editOverlay(activeConfigCategory, 182, 68, misc.dialoguePos); +// return; +// } } @Expose + @Category(name = "Lorenz Options", desc = "Just a test by lorenz.") + public Lorenz lorenz = new Lorenz(); + + @Expose @Category(name = "Misc Options", desc = "Just a bunch of random options.") public Misc misc = new Misc(); @@ -96,9 +100,27 @@ public class SBHConfig extends Config { @Category(name = "Mining", desc = "All Options for the Mining Stuff.") public Mining mining = new Mining(); - @Expose - @Category(name = "Tracker", desc = "All Options for the Trackers.") - public Trackers trackers = new Trackers(); +// @Expose +// @Category(name = "Tracker", desc = "All Options for the Trackers.") +// public Trackers trackers = new Trackers(); + + public static class Lorenz { + + @Expose + @ConfigOption(name = "Lorenz Small Test A", desc = "abc") + @ConfigEditorBoolean + public boolean test = false; + + @Expose + @ConfigOption(name = "Lorenz Small Test B", desc = "def") + @ConfigEditorBoolean + public boolean test2 = false; + + @Expose + @ConfigOption(name = "Lorenz Small Test C", desc = "ghi") + @ConfigEditorBoolean + public boolean test3 = false; + } public static class Misc { @@ -421,16 +443,16 @@ public class SBHConfig extends Config { public int chatWaypointMode = 1; } - public static class Trackers { - - @Expose - @ConfigOption(name = "Tracker Position", desc = "Allows you to change the position of the Trackers.") - @ConfigEditorButton(runnableId = "tracker", buttonText = "Edit") - public Position trackerPosition = new Position(-1, 200); - - @Expose - @ConfigOption(name = "Hide Tracker", desc = "It will still track the data just in case.") - @ConfigEditorBoolean - public boolean hideTracker = true; - } +// public static class Trackers { +// +// @Expose +// @ConfigOption(name = "Tracker Position", desc = "Allows you to change the position of the Trackers.") +// @ConfigEditorButton(runnableId = "tracker", buttonText = "Edit") +// public Position trackerPosition = new Position(-1, 200); +// +// @Expose +// @ConfigOption(name = "Hide Tracker", desc = "It will still track the data just in case.") +// @ConfigEditorBoolean +// public boolean hideTracker = true; +// } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java index 113037066..f8f5dc66c 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java @@ -40,9 +40,9 @@ public class SBHConfigEditor extends GuiElement { private final LerpingInteger optionsScroll = new LerpingInteger(0, 150); private final LerpingInteger categoryScroll = new LerpingInteger(0, 150); - private LinkedHashMap<String, ConfigProcessor.ProcessedCategory> processedConfig; - private TreeMap<String, Set<ConfigProcessor.ProcessedOption>> searchOptionMap = new TreeMap<>(); - private HashMap<ConfigProcessor.ProcessedOption, ConfigProcessor.ProcessedCategory> categoryForOption = new HashMap<>(); + private final LinkedHashMap<String, ConfigProcessor.ProcessedCategory> processedConfig; + private final TreeMap<String, Set<ConfigProcessor.ProcessedOption>> searchOptionMap = new TreeMap<>(); + private final HashMap<ConfigProcessor.ProcessedOption, ConfigProcessor.ProcessedCategory> categoryForOption = new HashMap<>(); public SBHConfigEditor(Config config) { this(config, null); @@ -146,7 +146,7 @@ public class SBHConfigEditor extends GuiElement { RenderUtils.drawFloatingRectDark(x + 5, y + 5, xSize - 10, 20, false); FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - TextRenderUtils.drawStringCenteredScaledMaxWidth("SkyBlockHud by " + EnumChatFormatting.RED + "ThatGravyBoat" + EnumChatFormatting.RESET + ", config by " + EnumChatFormatting.DARK_PURPLE + "Moulberry", fr, x + xSize / 2f, y + 15, false, 200, 0xa0a0a0); + TextRenderUtils.drawStringCenteredScaledMaxWidth("LorenzMod by " + EnumChatFormatting.RED + "hannibal2" + EnumChatFormatting.RESET + ", config by " + EnumChatFormatting.DARK_PURPLE + "Moulberry", fr, x + xSize / 2f, y + 15, false, 200, 0xa0a0a0); RenderUtils.drawFloatingRectDark(x + 4, y + 49 - 20, 140, ySize - 54 + 20, false); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java index f8eaba306..da625a0a5 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java @@ -2,20 +2,18 @@ package com.thatgravyboat.skyblockhud.tracker; import com.thatgravyboat.skyblockhud.SkyblockHud; import com.thatgravyboat.skyblockhud.api.events.SkyBlockEntityKilled; -import com.thatgravyboat.skyblockhud.core.config.Position; import com.thatgravyboat.skyblockhud.location.LocationHandler; import com.thatgravyboat.skyblockhud.location.Locations; -import com.thatgravyboat.skyblockhud.utils.Utils; -import java.util.*; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.ItemStack; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import java.util.*; + public class TrackerHandler extends Gui { public static Set<TrackerObject> trackerObjects = new HashSet<>(); @@ -73,39 +71,39 @@ public class TrackerHandler extends Gui { @SubscribeEvent public void renderOverlay(RenderGameOverlayEvent.Post event) { - if (Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard(), trackers.containsKey(LocationHandler.getCurrentLocation()), !SkyblockHud.config.trackers.hideTracker)) { - Map<String, TrackerObject> tracker = trackers.get(LocationHandler.getCurrentLocation()); - Minecraft mc = Minecraft.getMinecraft(); - - if (tracker != null) { - Position pos = SkyblockHud.config.trackers.trackerPosition; - int startPos = pos.getAbsX(event.resolution, (tracker.size() >= 6 ? 130 : tracker.size() * 20)); - int y = pos.getAbsY(event.resolution, (int) (10 + Math.ceil(tracker.size() / 5d) * 20)); - - Gui.drawRect(startPos, y, startPos + 130, y + 10, -1072689136); - mc.fontRendererObj.drawString("Tracker", startPos + 4, y + 1, 0xffffff, false); - y += 10; - Gui.drawRect(startPos, y, startPos + (tracker.size() >= 6 ? 130 : (tracker.size() * 20) + 10), (int) (y + (Math.ceil(tracker.size() / 5d) * 20)), 1610612736); - int x = startPos + 5; - for (TrackerObject object : tracker.values()) { - String s = Utils.formattedNumber(object.getCount(), 1000); - GlStateManager.disableLighting(); - GlStateManager.enableDepth(); - drawItemStack(object.getDisplayStack(), x, y); - GlStateManager.disableDepth(); - GlStateManager.disableBlend(); - mc.fontRendererObj.drawStringWithShadow(s, (float) (x + 19 - 2 - mc.fontRendererObj.getStringWidth(s)), (float) (y + 9), object.getCount() < 1 ? 16733525 : 16777215); - GlStateManager.enableBlend(); - GlStateManager.enableDepth(); - - if ((x - startPos + 5) / 20 == 5) { - x = startPos + 5; - y += 20; - } else { - x += 20; - } - } - } - } +// if (Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard(), trackers.containsKey(LocationHandler.getCurrentLocation()), !SkyblockHud.config.trackers.hideTracker)) { +// Map<String, TrackerObject> tracker = trackers.get(LocationHandler.getCurrentLocation()); +// Minecraft mc = Minecraft.getMinecraft(); +// +// if (tracker != null) { +// Position pos = SkyblockHud.config.trackers.trackerPosition; +// int startPos = pos.getAbsX(event.resolution, (tracker.size() >= 6 ? 130 : tracker.size() * 20)); +// int y = pos.getAbsY(event.resolution, (int) (10 + Math.ceil(tracker.size() / 5d) * 20)); +// +// Gui.drawRect(startPos, y, startPos + 130, y + 10, -1072689136); +// mc.fontRendererObj.drawString("Tracker", startPos + 4, y + 1, 0xffffff, false); +// y += 10; +// Gui.drawRect(startPos, y, startPos + (tracker.size() >= 6 ? 130 : (tracker.size() * 20) + 10), (int) (y + (Math.ceil(tracker.size() / 5d) * 20)), 1610612736); +// int x = startPos + 5; +// for (TrackerObject object : tracker.values()) { +// String s = Utils.formattedNumber(object.getCount(), 1000); +// GlStateManager.disableLighting(); +// GlStateManager.enableDepth(); +// drawItemStack(object.getDisplayStack(), x, y); +// GlStateManager.disableDepth(); +// GlStateManager.disableBlend(); +// mc.fontRendererObj.drawStringWithShadow(s, (float) (x + 19 - 2 - mc.fontRendererObj.getStringWidth(s)), (float) (y + 9), object.getCount() < 1 ? 16733525 : 16777215); +// GlStateManager.enableBlend(); +// GlStateManager.enableDepth(); +// +// if ((x - startPos + 5) / 20 == 5) { +// x = startPos + 5; +// y += 20; +// } else { +// x += 20; +// } +// } +// } +// } } } |