From e616a0910bdf7f4540f2814a35c1b7eefa9cd59d Mon Sep 17 00:00:00 2001 From: ThatGravyBoat Date: Sun, 11 Jul 2021 21:28:26 +0000 Subject: Prettified Code! --- .../skyblockhud/ComponentHandler.java | 7 +++---- .../com/thatgravyboat/skyblockhud/SkyblockHud.java | 11 +++++------ .../java/com/thatgravyboat/skyblockhud/Utils.java | 13 ++++++------- .../skyblockhud/api/KillTracking.java | 7 +++---- .../api/events/SkyBlockEntityKilled.java | 1 - .../api/sbentities/EntityTypeRegistry.java | 5 ++--- .../skyblockhud/api/sbentities/SkyBlockEntity.java | 3 +-- .../skyblockhud/commands/Commands.java | 12 +++++------- .../skyblockhud/config/SBHConfig.java | 15 +++++++-------- .../skyblockhud/config/SBHConfigEditor.java | 15 +++++++-------- .../skyblockhud/handlers/BossbarHandler.java | 2 +- .../skyblockhud/handlers/HeldItemHandler.java | 17 ++++++++--------- .../skyblockhud/handlers/MapHandler.java | 13 ++++++------- .../skyblockhud/handlers/SlayerHandler.java | 3 +-- .../skyblockhud/location/LocationCategory.java | 5 ++--- .../skyblockhud/location/LocationHandler.java | 3 +-- .../skyblockhud/location/MinesHandler.java | 9 ++++----- .../mixins/MixinNetHandlerPlayClient.java | 3 +-- .../skyblockhud/overlay/MiningHud.java | 22 +++++++++++----------- .../skyblockhud/overlay/OverlayHud.java | 9 ++++----- .../thatgravyboat/skyblockhud/overlay/RPGHud.java | 11 +++++------ .../skyblockhud/playerstats/ActionBarParsing.java | 5 ++--- .../skyblockhud/tracker/TrackerHandler.java | 5 ++--- src/main/resources/mixins.skyblockhud.json | 5 +---- 24 files changed, 88 insertions(+), 113 deletions(-) diff --git a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java index dc997cb..d5ffbf9 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java @@ -5,6 +5,9 @@ import com.google.common.collect.Ordering; import com.thatgravyboat.skyblockhud.dungeons.DungeonHandler; import com.thatgravyboat.skyblockhud.location.*; import com.thatgravyboat.skyblockhud.seasons.SeasonDateHandler; +import java.util.Comparator; +import java.util.List; +import java.util.regex.Pattern; import net.minecraft.client.Minecraft; import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.scoreboard.ScorePlayerTeam; @@ -17,10 +20,6 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.Comparator; -import java.util.List; -import java.util.regex.Pattern; - public class ComponentHandler { public static final Pattern SCOREBOARD_CHARACTERS = Pattern.compile("[^]\\[a-z A-Z:0-9/'.()+\\d-ยง?]"); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java b/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java index 7352f20..85dc914 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java @@ -20,6 +20,11 @@ import com.thatgravyboat.skyblockhud.overlay.OverlayHud; import com.thatgravyboat.skyblockhud.overlay.RPGHud; import com.thatgravyboat.skyblockhud.playerstats.ActionBarParsing; import com.thatgravyboat.skyblockhud.seasons.SeasonDateHandler; +import java.awt.*; +import java.awt.datatransfer.StringSelection; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.util.Set; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.scoreboard.ScoreObjective; @@ -37,12 +42,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.input.Keyboard; -import java.awt.*; -import java.awt.datatransfer.StringSelection; -import java.io.*; -import java.nio.charset.StandardCharsets; -import java.util.Set; - @Mod(modid = SkyblockHud.MODID, version = SkyblockHud.VERSION) public class SkyblockHud { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/Utils.java b/src/main/java/com/thatgravyboat/skyblockhud/Utils.java index 3d176c9..5455c0a 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/Utils.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/Utils.java @@ -1,5 +1,9 @@ package com.thatgravyboat.skyblockhud; +import java.nio.FloatBuffer; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedList; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; @@ -18,11 +22,6 @@ import org.lwjgl.BufferUtils; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; -import java.nio.FloatBuffer; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.LinkedList; - public class Utils { private static LinkedList guiScales = new LinkedList<>(); @@ -62,14 +61,14 @@ public class Utils { return (int) (g + f * (h - g)); } - public static NBTTagCompound getSkyBlockTag(ItemStack stack){ + public static NBTTagCompound getSkyBlockTag(ItemStack stack) { if (stack == null) return null; if (!stack.hasTagCompound()) return null; if (!stack.getTagCompound().hasKey("ExtraAttributes")) return null; return stack.getTagCompound().getCompoundTag("ExtraAttributes"); } - public static boolean isDrill(ItemStack stack){ + public static boolean isDrill(ItemStack stack) { NBTTagCompound tag = getSkyBlockTag(stack); return tag != null && tag.hasKey("drill_fuel"); } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/KillTracking.java b/src/main/java/com/thatgravyboat/skyblockhud/api/KillTracking.java index 9aad4c6..32feb1b 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/api/KillTracking.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/api/KillTracking.java @@ -3,6 +3,9 @@ package com.thatgravyboat.skyblockhud.api; import com.thatgravyboat.skyblockhud.DevModeConstants; import com.thatgravyboat.skyblockhud.api.events.SkyBlockEntityKilled; import com.thatgravyboat.skyblockhud.api.sbentities.EntityTypeRegistry; +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; import net.minecraft.client.Minecraft; import net.minecraft.util.DamageSource; import net.minecraftforge.common.MinecraftForge; @@ -11,10 +14,6 @@ import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.player.AttackEntityEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import java.util.HashSet; -import java.util.Set; -import java.util.UUID; - public class KillTracking { public static final Set attackedEntities = new HashSet<>(); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/events/SkyBlockEntityKilled.java b/src/main/java/com/thatgravyboat/skyblockhud/api/events/SkyBlockEntityKilled.java index 9d02993..325781c 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/api/events/SkyBlockEntityKilled.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/api/events/SkyBlockEntityKilled.java @@ -12,5 +12,4 @@ public class SkyBlockEntityKilled extends Event { this.id = id; this.entity = entity; } - } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeRegistry.java b/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeRegistry.java index 995bc9b..952aaa7 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeRegistry.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeRegistry.java @@ -2,11 +2,10 @@ package com.thatgravyboat.skyblockhud.api.sbentities; import com.google.common.collect.ImmutableList; import com.google.common.collect.Maps; -import net.minecraft.entity.Entity; -import net.minecraft.entity.monster.EntityEnderman; - import java.util.List; import java.util.Map; +import net.minecraft.entity.Entity; +import net.minecraft.entity.monster.EntityEnderman; public class EntityTypeRegistry { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/SkyBlockEntity.java b/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/SkyBlockEntity.java index 78b48df..bcd1196 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/SkyBlockEntity.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/SkyBlockEntity.java @@ -1,8 +1,7 @@ package com.thatgravyboat.skyblockhud.api.sbentities; -import net.minecraft.entity.Entity; - import java.util.function.Predicate; +import net.minecraft.entity.Entity; public class SkyBlockEntity { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java b/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java index ee2eb2b..de5fa7e 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java @@ -9,6 +9,8 @@ import com.thatgravyboat.skyblockhud.core.GuiScreenElementWrapper; 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.command.ICommandSender; import net.minecraft.entity.boss.BossStatus; import net.minecraft.util.ChatComponentText; @@ -16,9 +18,6 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.client.ClientCommandHandler; import org.apache.commons.lang3.StringUtils; -import java.awt.*; -import java.awt.datatransfer.StringSelection; - public class Commands { private static boolean devMode = false; @@ -51,11 +50,11 @@ public class Commands { break; case "mobDeathLogging": DevModeConstants.mobDeathLogging = !DevModeConstants.mobDeathLogging; - sendSBHMessage(sender,"Mob Death Logging " + (DevModeConstants.mobDeathLogging?"Enabled!":"Disabled!")); + sendSBHMessage(sender, "Mob Death Logging " + (DevModeConstants.mobDeathLogging ? "Enabled!" : "Disabled!")); } if (clipboard != null) { Toolkit.getDefaultToolkit().getSystemClipboard().setContents(clipboard, clipboard); - sendSBHMessage(sender,"Info copied to clipboard!"); + sendSBHMessage(sender, "Info copied to clipboard!"); } } @@ -87,8 +86,7 @@ public class Commands { ClientCommandHandler.instance.registerCommand(devCommand); } - - private static void sendSBHMessage(ICommandSender sender, String 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 9c00a92..db3e6df 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java @@ -50,9 +50,9 @@ public class SBHConfig extends Config { case "map": editOverlay(activeConfigCategory, 72, 72, map.miniMapPosition); return; -// case "tracker": -// editOverlay(activeConfigCategory, 120, 70, trackers.trackerPosition); -// return; + // case "tracker": + // editOverlay(activeConfigCategory, 120, 70, trackers.trackerPosition); + // return; } } @@ -84,10 +84,10 @@ public class SBHConfig extends Config { @Category(name = "Mining Hud", desc = "All Options for the Mining Hud.") public MiningHud miningHud = new MiningHud(); -//TODO ENABLED WHEN TRACKER GETS ADDED BACK -// @Expose -// @Category(name = "Tracker", desc = "All Options for the Trackers.") -// public Trackers trackers = new Trackers(); + //TODO ENABLED WHEN TRACKER GETS ADDED BACK + // @Expose + // @Category(name = "Tracker", desc = "All Options for the Trackers.") + // public Trackers trackers = new Trackers(); public static class Misc { @@ -320,7 +320,6 @@ public class SBHConfig extends Config { @ConfigOption(name = "Show Heat Bar", desc = "Allows you to show or hide the Heat Bar.") @ConfigEditorBoolean public boolean showHeatBar = true; - } public static class Trackers { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java index 58a9f24..8bbeaa7 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java @@ -1,5 +1,8 @@ package com.thatgravyboat.skyblockhud.config; +import static com.thatgravyboat.skyblockhud.GuiTextures.DISCORD; +import static com.thatgravyboat.skyblockhud.GuiTextures.TWITTER; + import com.google.common.collect.Lists; import com.thatgravyboat.skyblockhud.core.GlScissorStack; import com.thatgravyboat.skyblockhud.core.GuiElement; @@ -11,6 +14,10 @@ import com.thatgravyboat.skyblockhud.core.util.lerp.LerpUtils; import com.thatgravyboat.skyblockhud.core.util.lerp.LerpingInteger; import com.thatgravyboat.skyblockhud.core.util.render.RenderUtils; import com.thatgravyboat.skyblockhud.core.util.render.TextRenderUtils; +import java.awt.*; +import java.net.URI; +import java.util.*; +import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -21,14 +28,6 @@ import net.minecraft.util.ResourceLocation; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; -import java.awt.*; -import java.net.URI; -import java.util.List; -import java.util.*; - -import static com.thatgravyboat.skyblockhud.GuiTextures.DISCORD; -import static com.thatgravyboat.skyblockhud.GuiTextures.TWITTER; - public class SBHConfigEditor extends GuiElement { private static final ResourceLocation[] socialsIco = new ResourceLocation[] { DISCORD, TWITTER }; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java index 7cc6061..21e98fe 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java @@ -2,9 +2,9 @@ package com.thatgravyboat.skyblockhud.handlers; import com.thatgravyboat.skyblockhud.SkyblockHud; import com.thatgravyboat.skyblockhud.Utils; -import com.thatgravyboat.skyblockhud.location.MinesHandler; import com.thatgravyboat.skyblockhud.location.LocationHandler; import com.thatgravyboat.skyblockhud.location.Locations; +import com.thatgravyboat.skyblockhud.location.MinesHandler; import net.minecraft.entity.boss.BossStatus; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java index c44c8bc..2feef38 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java @@ -1,16 +1,15 @@ package com.thatgravyboat.skyblockhud.handlers; -import net.minecraft.client.gui.Gui; -import net.minecraft.item.ItemStack; - import java.util.regex.Matcher; import java.util.regex.Pattern; +import net.minecraft.client.gui.Gui; +import net.minecraft.item.ItemStack; public class HeldItemHandler extends Gui { private static final Pattern MANA_COST_REGEX = Pattern.compile("Mana Cost: \u00A73([0-9]+)"); - public static boolean hasManaCost(ItemStack stack){ + public static boolean hasManaCost(ItemStack stack) { if (stack == null) return false; if (!stack.hasTagCompound()) return false; if (!stack.getTagCompound().hasKey("display")) return false; @@ -19,13 +18,13 @@ public class HeldItemHandler extends Gui { return MANA_COST_REGEX.matcher(lore).find(); } - public static int getManaCost(ItemStack stack){ + public static int getManaCost(ItemStack stack) { String lore = stack.getTagCompound().getCompoundTag("display").getTagList("Lore", 8).toString(); Matcher matcher = MANA_COST_REGEX.matcher(lore); - if (matcher.find()){ - try { - return Integer.parseInt(matcher.group(1)); - }catch (Exception ignored){} + if (matcher.find()) { + try { + return Integer.parseInt(matcher.group(1)); + } catch (Exception ignored) {} } return 0; } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java index 4491e9d..64cc7dc 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java @@ -1,5 +1,7 @@ package com.thatgravyboat.skyblockhud.handlers; +import static com.thatgravyboat.skyblockhud.GuiTextures.mapOverlay; + import com.thatgravyboat.skyblockhud.SkyblockHud; import com.thatgravyboat.skyblockhud.Utils; import com.thatgravyboat.skyblockhud.config.KeyBindings; @@ -8,6 +10,10 @@ import com.thatgravyboat.skyblockhud.core.config.Position; import com.thatgravyboat.skyblockhud.handlers.mapicons.DwarvenIcons; import com.thatgravyboat.skyblockhud.handlers.mapicons.HubIcons; import com.thatgravyboat.skyblockhud.location.LocationHandler; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import javax.vecmath.Vector2f; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiScreen; @@ -20,13 +26,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.opengl.GL11; -import javax.vecmath.Vector2f; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import static com.thatgravyboat.skyblockhud.GuiTextures.mapOverlay; - public class MapHandler { public enum MapIconTypes { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java index dcdc10e..67bde54 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java @@ -3,12 +3,11 @@ package com.thatgravyboat.skyblockhud.handlers; import com.thatgravyboat.skyblockhud.Utils; import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent; import com.thatgravyboat.skyblockhud.api.events.SidebarPostEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - import java.util.Arrays; import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class SlayerHandler { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/LocationCategory.java b/src/main/java/com/thatgravyboat/skyblockhud/location/LocationCategory.java index f37a22d..cf93295 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/location/LocationCategory.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/location/LocationCategory.java @@ -1,9 +1,9 @@ package com.thatgravyboat.skyblockhud.location; -import com.thatgravyboat.skyblockhud.handlers.MapHandler; - import static com.thatgravyboat.skyblockhud.handlers.MapHandler.Maps; +import com.thatgravyboat.skyblockhud.handlers.MapHandler; + public enum LocationCategory { ERROR("error", 34), ISLAND("island", 43), @@ -50,5 +50,4 @@ public enum LocationCategory { public boolean isMiningCategory() { return this == LocationCategory.DWARVENMINES || this == LocationCategory.CRYSTALHOLLOWS; } - } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java index 6abc7b7..d4a0d0e 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java @@ -1,9 +1,8 @@ package com.thatgravyboat.skyblockhud.location; import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - import java.util.Locale; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class LocationHandler { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java index 1e1a065..d8f9d7b 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java @@ -3,13 +3,12 @@ package com.thatgravyboat.skyblockhud.location; import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent; import com.thatgravyboat.skyblockhud.api.events.SidebarPostEvent; import com.thatgravyboat.skyblockhud.overlay.MiningHud; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - import java.math.RoundingMode; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.util.Arrays; import java.util.Locale; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class MinesHandler { @@ -81,7 +80,7 @@ public class MinesHandler { @SubscribeEvent public void onSidebarLineUpdate(SidebarLineUpdateEvent event) { - if (event.formattedLine.toLowerCase().contains("heat")){ + if (event.formattedLine.toLowerCase().contains("heat")) { try { MiningHud.setHeat(Integer.parseInt(event.formattedLine.toLowerCase().replace("heat:", "").trim())); } catch (Exception ignored) {} @@ -106,7 +105,7 @@ public class MinesHandler { if (event.formattedLine.equalsIgnoreCase("wind compass")) { MinesHandler.currentEvent = Event.WIND; } - if (event.formattedLine.equalsIgnoreCase("nearby players")){ + if (event.formattedLine.equalsIgnoreCase("nearby players")) { MinesHandler.currentEvent = Event.TOGETHER; try { MinesHandler.eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("nearby players", "")); @@ -150,7 +149,7 @@ public class MinesHandler { MinesHandler.eventProgress = 0; MinesHandler.eventMax = 0; } - if (!arrayString.toLowerCase().contains("heat:")){ + if (!arrayString.toLowerCase().contains("heat:")) { MiningHud.setHeat(0); } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinNetHandlerPlayClient.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinNetHandlerPlayClient.java index e5c1aa0..b6cdb32 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinNetHandlerPlayClient.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinNetHandlerPlayClient.java @@ -52,8 +52,7 @@ public class MixinNetHandlerPlayClient { } @Inject(method = "handleTeams", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/network/play/server/S3EPacketTeams;getAction()I", ordinal = 6, shift = At.Shift.BEFORE), cancellable = true) - public void handleTeamRemove(S3EPacketTeams packetIn, CallbackInfo ci, Scoreboard scoreboard, ScorePlayerTeam scoreplayerteam){ + public void handleTeamRemove(S3EPacketTeams packetIn, CallbackInfo ci, Scoreboard scoreboard, ScorePlayerTeam scoreplayerteam) { if (scoreplayerteam == null) ci.cancel(); } - } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/MiningHud.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/MiningHud.java index 57044df..273f98d 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/MiningHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/MiningHud.java @@ -14,12 +14,12 @@ public class MiningHud extends Gui { private static int fuel, maxFuel; private static int heat; - public static void setFuel(int fuel, int maxFuel){ + public static void setFuel(int fuel, int maxFuel) { MiningHud.fuel = fuel; MiningHud.maxFuel = maxFuel; } - public static void setHeat(int heat){ + public static void setHeat(int heat) { MiningHud.heat = heat; } @@ -31,30 +31,30 @@ public class MiningHud extends Gui { if (heat > 0 && Utils.isDrill(mc.thePlayer.getHeldItem()) && SkyblockHud.config.miningHud.showDrillBar && SkyblockHud.config.miningHud.showHeatBar) { renderFuelBar(mc, (event.resolution.getScaledWidth() / 2) - 91, event.resolution.getScaledHeight() - 31); renderHeatBar(mc, (event.resolution.getScaledWidth() / 2) + 46, event.resolution.getScaledHeight() - 31); - }else if(Utils.isDrill(mc.thePlayer.getHeldItem()) && SkyblockHud.config.miningHud.showDrillBar) { + } else if (Utils.isDrill(mc.thePlayer.getHeldItem()) && SkyblockHud.config.miningHud.showDrillBar) { renderFuelBar(mc, (event.resolution.getScaledWidth() / 2) - 68, event.resolution.getScaledHeight() - 31); - }else if (heat > 0 && SkyblockHud.config.miningHud.showHeatBar){ + } else if (heat > 0 && SkyblockHud.config.miningHud.showHeatBar) { renderHeatBar(mc, (event.resolution.getScaledWidth() / 2) - 22, event.resolution.getScaledHeight() - 31); } } } - private void renderFuelBar(Minecraft mc, int x, int y){ - if (maxFuel == 0)return; + private void renderFuelBar(Minecraft mc, int x, int y) { + if (maxFuel == 0) return; GlStateManager.enableBlend(); GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); mc.renderEngine.bindTexture(GuiTextures.mining); drawTexturedModalRect(x, y, 0, 0, 136, 7); - drawTexturedModalRect(x, y, 0, 7, Utils.lerp((float)fuel/(float)maxFuel,0,136), 7); - String percentageText = Math.round(((float)fuel/(float)maxFuel)*100) +"%"; - this.drawCenteredString(mc.fontRendererObj, percentageText, x + 68, y-2, 0xffffff); + drawTexturedModalRect(x, y, 0, 7, Utils.lerp((float) fuel / (float) maxFuel, 0, 136), 7); + String percentageText = Math.round(((float) fuel / (float) maxFuel) * 100) + "%"; + this.drawCenteredString(mc.fontRendererObj, percentageText, x + 68, y - 2, 0xffffff); } - private void renderHeatBar(Minecraft mc, int x, int y){ + private void renderHeatBar(Minecraft mc, int x, int y) { GlStateManager.enableBlend(); GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); mc.renderEngine.bindTexture(GuiTextures.mining); drawTexturedModalRect(x, y, 137, 0, 45, 7); - drawTexturedModalRect(x, y, 137, 7, Utils.lerp(heat/100f,0,45), 7); + drawTexturedModalRect(x, y, 137, 7, Utils.lerp(heat / 100f, 0, 45), 7); } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java index a7a8b4e..a1e1f54 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java @@ -10,6 +10,9 @@ import com.thatgravyboat.skyblockhud.handlers.TimeHandler; import com.thatgravyboat.skyblockhud.location.*; import com.thatgravyboat.skyblockhud.seasons.Season; import com.thatgravyboat.skyblockhud.seasons.SeasonDateHandler; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.Locale; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -20,10 +23,6 @@ import net.minecraftforge.client.GuiIngameForge; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; -import java.util.Locale; - public class OverlayHud extends Gui { private static final FontRenderer font = Minecraft.getMinecraft().fontRendererObj; @@ -216,7 +215,7 @@ public class OverlayHud extends Gui { drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(mithril))) + 2, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(mithril) + 14, 14); drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(mithril))) + 4, offset + (bossBarVisible ? 38 : 21), 91, 0, 8, 8); drawString(font, mithril, (width / 2) - 19 - (font.getStringWidth(mithril)), offset + (bossBarVisible ? 38 : 21), 0x00C896); - }else { + } else { LocationCategory locationCategory = LocationHandler.getCurrentLocation().getCategory(); String mithril = locationCategory == LocationCategory.DWARVENMINES ? MinesHandler.getMithrilFormatted() : MinesHandler.getMithrilShortFormatted(); String gemstone = locationCategory == LocationCategory.CRYSTALHOLLOWS ? MinesHandler.getGemstoneFormatted() : MinesHandler.getGemstoneShortFormatted(); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java index 3914392..9d0f00d 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java @@ -6,6 +6,8 @@ import com.thatgravyboat.skyblockhud.SkyblockHud; import com.thatgravyboat.skyblockhud.Utils; import com.thatgravyboat.skyblockhud.core.config.Position; import com.thatgravyboat.skyblockhud.handlers.HeldItemHandler; +import java.text.DecimalFormat; +import java.text.NumberFormat; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -13,9 +15,6 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import java.text.DecimalFormat; -import java.text.NumberFormat; - public class RPGHud extends Gui { private static int mana, maxMana, overflow = 0; @@ -74,13 +73,13 @@ public class RPGHud extends Gui { float manaWidth = Math.min(57 * ((float) mana / (float) maxMana), 57); int manaX = rightAligned ? x + 16 : 47 + x; - if (HeldItemHandler.hasManaCost(mc.thePlayer.getHeldItem())){ + if (HeldItemHandler.hasManaCost(mc.thePlayer.getHeldItem())) { int manaCost = HeldItemHandler.getManaCost(mc.thePlayer.getHeldItem()); drawTexturedModalRect(manaX, 17 + y, rightAligned ? 199 : 0, manaCost > mana ? 96 : 64, (int) manaWidth, 4); if (manaCost <= mana) { - drawTexturedModalRect(manaX, 17 + y, rightAligned ? 199 : 0, 92, Utils.lerp((float) manaCost / (float) maxMana,0, 57), 4); + drawTexturedModalRect(manaX, 17 + y, rightAligned ? 199 : 0, 92, Utils.lerp((float) manaCost / (float) maxMana, 0, 57), 4); } - }else { + } else { drawTexturedModalRect(manaX, 17 + y, rightAligned ? 199 : 0, 64, (int) manaWidth, 4); } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java b/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java index dc60304..5c5f5d5 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java @@ -4,6 +4,8 @@ import com.thatgravyboat.skyblockhud.SkyblockHud; import com.thatgravyboat.skyblockhud.Utils; import com.thatgravyboat.skyblockhud.overlay.MiningHud; import com.thatgravyboat.skyblockhud.overlay.RPGHud; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import net.minecraft.util.ChatComponentText; import net.minecraft.util.IChatComponent; import net.minecraftforge.client.event.ClientChatReceivedEvent; @@ -11,9 +13,6 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - public class ActionBarParsing { private static String lastActionBar = ""; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java index f1862d6..c40924a 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java @@ -6,6 +6,7 @@ import com.thatgravyboat.skyblockhud.core.config.Position; import com.thatgravyboat.skyblockhud.location.LocationHandler; import com.thatgravyboat.skyblockhud.location.Locations; import com.thatgravyboat.skyblockhud.seasons.SeasonDateHandler; +import java.util.*; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.GlStateManager; @@ -15,8 +16,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 { public static class TrackerData { @@ -90,7 +89,7 @@ public class TrackerHandler { Map tracker = tracked.dropTrackers.get(tracked.getDropId(SeasonDateHandler.getCurrentEvent())); if (tracker != null) { - Position pos = null;// SkyblockHud.config.trackers.trackerPosition; + Position pos = null; // SkyblockHud.config.trackers.trackerPosition; int startPos = pos.getAbsX(event.resolution, (tracker.size() >= 6 ? 120 : tracker.size() * 20)); int y = pos.getAbsY(event.resolution, (int) (10 + Math.ceil(tracker.size() / 5d) * 20)); diff --git a/src/main/resources/mixins.skyblockhud.json b/src/main/resources/mixins.skyblockhud.json index d928e55..b6f4593 100644 --- a/src/main/resources/mixins.skyblockhud.json +++ b/src/main/resources/mixins.skyblockhud.json @@ -2,8 +2,5 @@ "package": "com.thatgravyboat.skyblockhud.mixins", "refmap": "mixins.skyblockhud.refmap.json", "compatibilityLevel": "JAVA_8", - "mixins": [ - "MixinGuiIngameForge", - "MixinNetHandlerPlayClient" - ] + "mixins": ["MixinGuiIngameForge", "MixinNetHandlerPlayClient"] } -- cgit