diff options
author | hannibal00212 <hannibal00212@users.noreply.github.com> | 2022-07-08 10:07:34 +0000 |
---|---|---|
committer | GitHub Action <actions@github.com> | 2022-07-08 10:07:34 +0000 |
commit | 324f31cd1402ad8f7877bb9bba99036e4140bbdb (patch) | |
tree | 94beace22acbaaca08360122d79500dd3abed945 /src/main/java/com/thatgravyboat | |
parent | c167f4e84e22da7b7c4405b5d59c817734654fc0 (diff) | |
download | skyhanni-324f31cd1402ad8f7877bb9bba99036e4140bbdb.tar.gz skyhanni-324f31cd1402ad8f7877bb9bba99036e4140bbdb.tar.bz2 skyhanni-324f31cd1402ad8f7877bb9bba99036e4140bbdb.zip |
Prettified Code!
Diffstat (limited to 'src/main/java/com/thatgravyboat')
4 files changed, 155 insertions, 162 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java b/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java index 15fff4928..17b489fee 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java @@ -13,6 +13,8 @@ import com.google.gson.GsonBuilder; import com.thatgravyboat.skyblockhud.commands.Commands; import com.thatgravyboat.skyblockhud.config.SBHConfig; import com.thatgravyboat.skyblockhud.textures.Textures; +import java.io.*; +import java.nio.charset.StandardCharsets; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.IReloadableResourceManager; @@ -23,9 +25,6 @@ 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 { @@ -87,16 +86,14 @@ public class SkyblockHud { try { //noinspection ResultOfMethodCallIgnored configDirectory.mkdir(); - } catch (Exception ignored) { - } + } 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) { - } + } catch (Exception ignored) {} } if (config == null) { @@ -110,7 +107,7 @@ 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)); } @@ -122,8 +119,7 @@ public class SkyblockHud { try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8))) { writer.write(gson.toJson(config)); } - } catch (IOException ignored) { - } + } catch (IOException ignored) {} } // @EventHandler diff --git a/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java b/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java index 517390a5d..5c4d9908a 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java @@ -22,68 +22,67 @@ 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!"); -// } -// } -// -// @Override -// void processNoSubCommand(ICommandSender sender) { -// devMode = !devMode; -// sender.addChatMessage(new ChatComponentText("Dev Mode " + (devMode ? "Enabled!" : "Disabled!"))); -// } -// }; + // 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!"))); + // } + // }; private static final SimpleCommand settingsCommand = new SimpleCommand("lm", settingsRunnable); private static final SimpleCommand settingsCommand2 = new SimpleCommand("lorenzmod", 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(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 08e72d40d..32ae1cf0d 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java @@ -20,52 +20,52 @@ 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 @@ -100,9 +100,9 @@ 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 { @@ -442,17 +442,16 @@ public class SBHConfig extends Config { @ConfigAccordionId(id = 6) 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/tracker/TrackerHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java index da625a0a5..dc7ec1f63 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java @@ -4,6 +4,7 @@ import com.thatgravyboat.skyblockhud.SkyblockHud; import com.thatgravyboat.skyblockhud.api.events.SkyBlockEntityKilled; import com.thatgravyboat.skyblockhud.location.LocationHandler; import com.thatgravyboat.skyblockhud.location.Locations; +import java.util.*; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.RenderHelper; @@ -12,8 +13,6 @@ 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<>(); @@ -71,39 +70,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; + // } + // } + // } + // } } } |