diff options
author | ThatGravyBoat <ThatGravyBoat@users.noreply.github.com> | 2021-07-12 01:29:58 +0000 |
---|---|---|
committer | GitHub Action <actions@github.com> | 2021-07-12 01:29:58 +0000 |
commit | 087d97fb0663edc5e343187c0fa4ec1bc6b081bc (patch) | |
tree | b3f74dfcead856a61e0f93b92405bd76786cba2a /src/main | |
parent | 06587d2dc10241ec6a8f5e21c8f55ae710c5cc8d (diff) | |
download | SkyblockHud-Death-Defied-087d97fb0663edc5e343187c0fa4ec1bc6b081bc.tar.gz SkyblockHud-Death-Defied-087d97fb0663edc5e343187c0fa4ec1bc6b081bc.tar.bz2 SkyblockHud-Death-Defied-087d97fb0663edc5e343187c0fa4ec1bc6b081bc.zip |
Prettified Code!
Diffstat (limited to 'src/main')
7 files changed, 72 insertions, 74 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java b/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java index 0633916..92564b8 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 e988677..b80d5ae 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; @@ -21,11 +25,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<Integer> guiScales = new LinkedList<>(); @@ -292,12 +291,12 @@ public class Utils { double y = loc.getY() - viewerY - viewer.getEyeHeight(); double z = loc.getZ() - viewerZ; - double distSq = x*x + y*y + z*z; + double distSq = x * x + y * y + z * z; double dist = Math.sqrt(distSq); - if(distSq > 144) { - x *= 12/dist; - y *= 12/dist; - z *= 12/dist; + if (distSq > 144) { + x *= 12 / dist; + y *= 12 / dist; + z *= 12 / dist; } GlStateManager.translate(x, y, z); GlStateManager.translate(0, viewer.getEyeHeight(), 0); @@ -310,7 +309,7 @@ public class Utils { GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); - drawNametag(EnumChatFormatting.YELLOW.toString()+Math.round(dist)+"m"); + drawNametag(EnumChatFormatting.YELLOW.toString() + Math.round(dist) + "m"); GlStateManager.popMatrix(); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/events/LocationChangeEvent.java b/src/main/java/com/thatgravyboat/skyblockhud/api/events/LocationChangeEvent.java index cb11337..384e76d 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/api/events/LocationChangeEvent.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/api/events/LocationChangeEvent.java @@ -8,9 +8,8 @@ public class LocationChangeEvent extends Event { public Locations oldLocation; public Locations newLocation; - public LocationChangeEvent(Locations oldLocation, Locations newLocation){ + public LocationChangeEvent(Locations oldLocation, Locations newLocation) { this.oldLocation = oldLocation; this.newLocation = newLocation; } } - diff --git a/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java b/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java index 8c4ec60..b3f73cb 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java @@ -10,6 +10,8 @@ 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.command.ICommandSender; import net.minecraft.entity.boss.BossStatus; import net.minecraft.util.ChatComponentText; @@ -17,9 +19,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; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java index cd016e6..079e108 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java @@ -6,6 +6,9 @@ import com.thatgravyboat.skyblockhud.api.events.LocationChangeEvent; import com.thatgravyboat.skyblockhud.commands.SimpleCommand; import com.thatgravyboat.skyblockhud.location.LocationCategory; import com.thatgravyboat.skyblockhud.location.LocationHandler; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.command.ICommandSender; import net.minecraft.util.BlockPos; @@ -14,28 +17,26 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; - public class CrystalWaypoints { public static final HashMap<String, BlockPos> waypoints = new HashMap<>(); @SubscribeEvent public void onRenderLast(RenderWorldLastEvent event) { - waypoints.forEach((text, pos) -> { - GlStateManager.disableCull(); - GlStateManager.disableDepth(); - Utils.renderWaypointText(text, pos,event.partialTicks); - }); + waypoints.forEach( + (text, pos) -> { + GlStateManager.disableCull(); + GlStateManager.disableDepth(); + Utils.renderWaypointText(text, pos, event.partialTicks); + } + ); GlStateManager.enableCull(); GlStateManager.enableDepth(); } @SubscribeEvent public void onLocationChange(LocationChangeEvent event) { - if (!event.newLocation.getCategory().equals(LocationCategory.CRYSTALHOLLOWS)){ + if (!event.newLocation.getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) { waypoints.clear(); } } @@ -43,48 +44,51 @@ public class CrystalWaypoints { public static class WaypointCommand extends SimpleCommand { public WaypointCommand() { - super("sbhpoints", new ProcessCommandRunnable() { - @Override - public void processCommand(ICommandSender sender, String[] args) { - String subCommand = args[0].toLowerCase(); - String name = String.join(" ", Arrays.copyOfRange(args, 1, args.length)); - switch (subCommand) { - case "add": - if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)){ - if (!CrystalWaypoints.waypoints.containsKey(name)){ - CrystalWaypoints.waypoints.put(name, sender.getPosition().add(0.5,0.5,0.5)); - }else { - sender.addChatMessage(new ChatComponentText("[" + EnumChatFormatting.RED + EnumChatFormatting.BOLD + "SkyBlockHud" + EnumChatFormatting.RESET + "] : " + EnumChatFormatting.GRAY + "Waypoint already exists!")); + super( + "sbhpoints", + new ProcessCommandRunnable() { + @Override + public void processCommand(ICommandSender sender, String[] args) { + String subCommand = args[0].toLowerCase(); + String name = String.join(" ", Arrays.copyOfRange(args, 1, args.length)); + switch (subCommand) { + case "add": + if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) { + if (!CrystalWaypoints.waypoints.containsKey(name)) { + CrystalWaypoints.waypoints.put(name, sender.getPosition().add(0.5, 0.5, 0.5)); + } else { + sender.addChatMessage(new ChatComponentText("[" + EnumChatFormatting.RED + EnumChatFormatting.BOLD + "SkyBlockHud" + EnumChatFormatting.RESET + "] : " + EnumChatFormatting.GRAY + "Waypoint already exists!")); + } } - } - break; - case "remove": - if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)){ - if (CrystalWaypoints.waypoints.containsKey(name)){ - CrystalWaypoints.waypoints.remove(name); - }else { - sender.addChatMessage(new ChatComponentText("[" + EnumChatFormatting.RED + EnumChatFormatting.BOLD + "SkyBlockHud" + EnumChatFormatting.RESET + "] : " + EnumChatFormatting.GRAY + "Waypoint doesnt exist!")); + break; + case "remove": + if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) { + if (CrystalWaypoints.waypoints.containsKey(name)) { + CrystalWaypoints.waypoints.remove(name); + } else { + sender.addChatMessage(new ChatComponentText("[" + EnumChatFormatting.RED + EnumChatFormatting.BOLD + "SkyBlockHud" + EnumChatFormatting.RESET + "] : " + EnumChatFormatting.GRAY + "Waypoint doesnt exist!")); + } } - } - break; - case "clear": - CrystalWaypoints.waypoints.clear(); - break; + break; + case "clear": + CrystalWaypoints.waypoints.clear(); + break; + } } - } - }, new TabCompleteRunnable() { - @Override - public List<String> tabComplete(ICommandSender sender, String[] args, BlockPos pos) { - if (args.length == 2 && args[0].equalsIgnoreCase("remove")) { - return getListOfStringsMatchingLastWord(args, waypoints.keySet()); + }, + new TabCompleteRunnable() { + @Override + public List<String> tabComplete(ICommandSender sender, String[] args, BlockPos pos) { + if (args.length == 2 && args[0].equalsIgnoreCase("remove")) { + return getListOfStringsMatchingLastWord(args, waypoints.keySet()); + } + if (args.length == 1) { + return getListOfStringsMatchingLastWord(args, Lists.newArrayList("add", "clear", "remove")); + } + return null; } - if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, Lists.newArrayList("add", "clear", "remove")); - } - return null; } - }); + ); } - } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/DwarvenIcons.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/DwarvenIcons.java index d64a217..f3e4955 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/DwarvenIcons.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/DwarvenIcons.java @@ -2,11 +2,10 @@ package com.thatgravyboat.skyblockhud.handlers.mapicons; import com.thatgravyboat.skyblockhud.ComponentBuilder; import com.thatgravyboat.skyblockhud.handlers.MapHandler; -import net.minecraft.util.ResourceLocation; - -import javax.vecmath.Vector2f; import java.util.ArrayList; import java.util.List; +import javax.vecmath.Vector2f; +import net.minecraft.util.ResourceLocation; public class DwarvenIcons { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java index 7796799..cfbfdc3 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java @@ -2,11 +2,10 @@ package com.thatgravyboat.skyblockhud.location; import com.thatgravyboat.skyblockhud.api.events.LocationChangeEvent; import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent; +import java.util.Locale; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import java.util.Locale; - public class LocationHandler { private static Locations currentLocation = Locations.NONE; |