From b3b16e4c82ad1e66f5564c806563dfc23658fdef Mon Sep 17 00:00:00 2001 From: ThatGravyBoat Date: Tue, 13 Jul 2021 04:22:16 +0000 Subject: Prettified Code! --- .../skyblockhud/handlers/CrystalWaypoints.java | 17 ++++++++--------- .../thatgravyboat/skyblockhud/handlers/MapHandler.java | 4 ++-- .../skyblockhud/location/FarmHouseHandler.java | 11 +++++------ .../skyblockhud/mixins/MixinGuiIngameForge.java | 8 ++++---- .../thatgravyboat/skyblockhud/overlay/OverlayHud.java | 2 -- 5 files changed, 19 insertions(+), 23 deletions(-) (limited to 'src/main/java/com') diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java index 0932ab1..d6e4fd6 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java @@ -43,12 +43,11 @@ public class CrystalWaypoints { public void onLocationChange(LocationChangeEvent event) { if (!event.newLocation.getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) { waypoints.clear(); + } else if (!waypoints.containsKey("Crystal Nucleus") && SkyblockHud.config.mining.autoWaypoint) { + waypoints.put("Crystal Nucleus", new BlockPos(512.5, 106.5, 512.5)); } - else if (!waypoints.containsKey("Crystal Nucleus") && SkyblockHud.config.mining.autoWaypoint){ - waypoints.put("Crystal Nucleus", new BlockPos(512.5,106.5,512.5)); - } - if (IMPORTANT_WAYPOINTS.contains(event.newLocation) && SkyblockHud.config.mining.autoWaypoint){ - if (!waypoints.containsKey(event.newLocation.getDisplayName())){ + if (IMPORTANT_WAYPOINTS.contains(event.newLocation) && SkyblockHud.config.mining.autoWaypoint) { + if (!waypoints.containsKey(event.newLocation.getDisplayName())) { waypoints.put(event.newLocation.getDisplayName(), Minecraft.getMinecraft().thePlayer.getPosition()); } } @@ -100,7 +99,7 @@ public class CrystalWaypoints { } else { sbhMessage(sender, "Waypoint already exists!"); } - }catch (Exception e){ + } catch (Exception e) { sbhMessage(sender, "Error!"); } } @@ -111,7 +110,7 @@ public class CrystalWaypoints { sbhMessage(sender, "No waypoint with that name!"); break; } - StringSelection clipboard = new StringSelection(name + " : ("+pos.getX()+"/"+pos.getY()+"/"+pos.getZ()+")"); + StringSelection clipboard = new StringSelection(name + " : (" + pos.getX() + "/" + pos.getY() + "/" + pos.getZ() + ")"); Toolkit.getDefaultToolkit().getSystemClipboard().setContents(clipboard, clipboard); break; } @@ -126,7 +125,7 @@ public class CrystalWaypoints { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, Lists.newArrayList("add", "clear", "remove", "copy", "addat")); } - if (args.length > 1 && args[0].equalsIgnoreCase("addat")){ + if (args.length > 1 && args[0].equalsIgnoreCase("addat")) { return func_175771_a(args, 1, pos); } return null; @@ -135,7 +134,7 @@ public class CrystalWaypoints { ); } - private static void sbhMessage(ICommandSender sender, String message){ + private static void sbhMessage(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/handlers/MapHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java index e7143a9..bf38d49 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; @@ -24,8 +26,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.opengl.GL11; -import static com.thatgravyboat.skyblockhud.GuiTextures.mapOverlay; - public class MapHandler { public enum MapIconTypes { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/FarmHouseHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/FarmHouseHandler.java index 432bfbb..005d9ff 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/location/FarmHouseHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/location/FarmHouseHandler.java @@ -17,12 +17,12 @@ public class FarmHouseHandler { @SubscribeEvent public void onSidebarLineUpdate(SidebarLineUpdateEvent event) { - if (event.formattedLine.contains("medals:")){ + if (event.formattedLine.contains("medals:")) { for (Medal value : Medal.values()) { - if (event.formattedLine.contains(value.name())){ + if (event.formattedLine.contains(value.name())) { try { medals[value.ordinal()] = Integer.parseInt(event.formattedLine.replace("medals:", "").replace(value.name(), "").trim()); - }catch (Exception ignored){} + } catch (Exception ignored) {} break; } } @@ -30,13 +30,12 @@ public class FarmHouseHandler { } @SubscribeEvent - public void onProfileSwitch(ProfileSwitchedEvent event){ + public void onProfileSwitch(ProfileSwitchedEvent event) { Arrays.fill(medals, 0); } - public static String getFormattedMedals(Medal medal){ + public static String getFormattedMedals(Medal medal) { if (medal == null) return "0"; return String.valueOf(medals[medal.ordinal()]); } - } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java index 873b7bf..5d64950 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java @@ -1,5 +1,7 @@ package com.thatgravyboat.skyblockhud.mixins; +import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.*; + import com.thatgravyboat.skyblockhud.SkyblockHud; import com.thatgravyboat.skyblockhud.Utils; import com.thatgravyboat.skyblockhud.overlay.MiningHud; @@ -13,8 +15,6 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.*; - @Mixin(GuiIngameForge.class) public class MixinGuiIngameForge { @@ -63,8 +63,8 @@ public class MixinGuiIngameForge { ci.cancel(); if (pre(EXPERIENCE)) return; post(EXPERIENCE); - } else if (!SkyblockHud.config.renderer.hideXpBar && (SkyblockHud.config.mining.showDrillBar || SkyblockHud.config.mining.showHeatBar) && SkyblockHud.hasSkyblockScoreboard()){ - if (MiningHud.getHeat() > 0 || Utils.isDrill(Minecraft.getMinecraft().thePlayer.getHeldItem())){ + } else if (!SkyblockHud.config.renderer.hideXpBar && (SkyblockHud.config.mining.showDrillBar || SkyblockHud.config.mining.showHeatBar) && SkyblockHud.hasSkyblockScoreboard()) { + if (MiningHud.getHeat() > 0 || Utils.isDrill(Minecraft.getMinecraft().thePlayer.getHeldItem())) { ci.cancel(); if (pre(EXPERIENCE)) return; post(EXPERIENCE); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java index 8c64ddd..58c02fd 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java @@ -290,7 +290,6 @@ public class OverlayHud extends Gui { drawString(font, FarmHouseHandler.getFormattedMedals(FarmHouseHandler.Medal.GOLD), end + 12, offset + (bossBarVisible ? 38 : 21), 0xffffff); drawString(font, FarmHouseHandler.getFormattedMedals(FarmHouseHandler.Medal.SILVER), end + gold + 24, offset + (bossBarVisible ? 38 : 21), 0xffffff); drawString(font, FarmHouseHandler.getFormattedMedals(FarmHouseHandler.Medal.BRONZE), end + gold + silver + 36, offset + (bossBarVisible ? 38 : 21), 0xffffff); - } } @@ -313,7 +312,6 @@ public class OverlayHud extends Gui { GlStateManager.scale(1 / factor, 1 / factor, 1); } - public int drawLeftBottomBar(int width, int offset, int barWidth, Minecraft mc) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(GuiTextures.overlay); -- cgit