diff options
author | bowser0000 <bowser0000@gmail.com> | 2021-04-29 01:06:57 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2021-04-29 01:06:57 -0400 |
commit | 01822bff56d23b98885227943bd1e042e4f9e946 (patch) | |
tree | 5931c2b8a3df8ca25a5747fdc273a06c6102fa48 /src/main/java/me/Danker | |
parent | b48dabaf8ab58773eb51a1c2077b880ee1f28675 (diff) | |
download | SkyblockMod-01822bff56d23b98885227943bd1e042e4f9e946.tar.gz SkyblockMod-01822bff56d23b98885227943bd1e042e4f9e946.tar.bz2 SkyblockMod-01822bff56d23b98885227943bd1e042e4f9e946.zip |
Add giant hp display
Also make LocationButton easy to add
Diffstat (limited to 'src/main/java/me/Danker')
-rw-r--r-- | src/main/java/me/Danker/DankersSkyblockMod.java | 1 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/DankerGuiCommand.java | 1 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/MoveCommand.java | 13 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/ScaleCommand.java | 11 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/ToggleCommand.java | 11 | ||||
-rw-r--r-- | src/main/java/me/Danker/features/GiantHPDisplay.java | 71 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/DankerGui.java | 7 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/EditLocationsGui.java | 43 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/buttons/LocationButton.java | 27 | ||||
-rw-r--r-- | src/main/java/me/Danker/handlers/ConfigHandler.java | 10 | ||||
-rw-r--r-- | src/main/java/me/Danker/utils/Utils.java | 6 |
11 files changed, 167 insertions, 34 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 2e49f55..bf71dda 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -101,6 +101,7 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new DungeonTimer()); MinecraftForge.EVENT_BUS.register(new ExpertiseLore()); MinecraftForge.EVENT_BUS.register(new FasterMaddoxCalling()); + MinecraftForge.EVENT_BUS.register(new GiantHPDisplay()); MinecraftForge.EVENT_BUS.register(new GoldenEnchants()); MinecraftForge.EVENT_BUS.register(new GolemSpawningAlert()); MinecraftForge.EVENT_BUS.register(new GpartyNotifications()); diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index 6fede04..2cc706e 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -93,6 +93,7 @@ public class DankerGuiCommand extends CommandBase { debug.append("[highlightarachne][").append(ToggleCommand.highlightArachne).append("]\n"); debug.append("[highlightskeletonmasters][").append(ToggleCommand.highlightSkeletonMasters).append("]\n"); debug.append("[teammatesinradius][").append(ToggleCommand.teammatesInRadius).append("]\n"); + debug.append("[gianthp][").append(ToggleCommand.giantHP).append("]\n"); debug.append("[dungeonbossmusic][").append(ToggleCommand.dungeonBossMusic).append("]\n"); debug.append("[bloodroommusic][").append(ToggleCommand.bloodRoomMusic).append("]\n"); debug.append("[dungeonmusic][").append(ToggleCommand.dungeonMusic).append("]\n"); diff --git a/src/main/java/me/Danker/commands/MoveCommand.java b/src/main/java/me/Danker/commands/MoveCommand.java index 33d1f78..b17794c 100644 --- a/src/main/java/me/Danker/commands/MoveCommand.java +++ b/src/main/java/me/Danker/commands/MoveCommand.java @@ -24,6 +24,7 @@ public class MoveCommand extends CommandBase { public static int[] bonzoTimerXY = {0, 0}; public static int[] golemTimerXY = {0 ,0}; public static int[] teammatesInRadiusXY = {0, 0}; + public static int[] giantHPXY = {0, 0}; @Override public String getCommandName() { @@ -32,7 +33,7 @@ public class MoveCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer/bonzotimer/golemtimer/teammatesinradius> <x> <y>"; + return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer/bonzotimer/golemtimer/teammatesinradius/gianthp> <x> <y>"; } public static String usage(ICommandSender arg0) { @@ -48,7 +49,8 @@ public class MoveCommand extends CommandBase { public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", - "skilltracker", "wateranswer", "bonzotimer", "golemtimer", "teammatesinradius"); + "skilltracker", "wateranswer", "bonzotimer", "golemtimer", "teammatesinradius", + "gianthp"); } return null; } @@ -140,6 +142,13 @@ public class MoveCommand extends CommandBase { ConfigHandler.writeIntConfig("locations", "teammatesInRadiusY", teammatesInRadiusXY[1]); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Teammates in radius has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); break; + case "gianthp": + giantHPXY[0] = Integer.parseInt(arg1[1]); + giantHPXY[1] = Integer.parseInt(arg1[2]); + ConfigHandler.writeIntConfig("locations", "giantHPX", giantHPXY[0]); + ConfigHandler.writeIntConfig("locations", "giantHPY", giantHPXY[1]); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Giant HP has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); + break; default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/commands/ScaleCommand.java b/src/main/java/me/Danker/commands/ScaleCommand.java index a95f1b1..def0e57 100644 --- a/src/main/java/me/Danker/commands/ScaleCommand.java +++ b/src/main/java/me/Danker/commands/ScaleCommand.java @@ -24,6 +24,7 @@ public class ScaleCommand extends CommandBase { public static double bonzoTimerScale; public static double golemTimerScale; public static double teammatesInRadiusScale; + public static double giantHPScale; @Override public String getCommandName() { @@ -32,7 +33,7 @@ public class ScaleCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer/bonzotimer/golemtimer/teammatesinradius> <size (0.1 - 10)>"; + return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer/bonzotimer/golemtimer/teammatesinradius/gianthp> <size (0.1 - 10)>"; } public static String usage(ICommandSender arg0) { @@ -48,7 +49,8 @@ public class ScaleCommand extends CommandBase { public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", - "skilltracker", "wateranswer", "bonzotimer", "golemtimer", "teammatesinradius"); + "skilltracker", "wateranswer", "bonzotimer", "golemtimer", "teammatesinradius", + "gianthp"); } return null; } @@ -124,6 +126,11 @@ public class ScaleCommand extends CommandBase { ConfigHandler.writeDoubleConfig("scales", "teammatesInRadiusScale", teammatesInRadiusScale); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Teammates in radius has been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + teammatesInRadiusScale + "x")); break; + case "gianthp": + giantHPScale = scaleAmount; + ConfigHandler.writeDoubleConfig("scales", "giantHPScale", giantHPScale); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Giant hp has been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + giantHPScale + "x")); + break; default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 0eb52fd..a9fe663 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -35,6 +35,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean highlightArachne; public static boolean highlightSkeletonMasters; public static boolean teammatesInRadius; + public static boolean giantHP; // Chat Messages public static boolean sceptreMessages; public static boolean midasStaffMessages; @@ -95,7 +96,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "startswithterminal/selectallterminal/clickinorderterminal/" + "ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/" + "melodytooltips/highlightslayers/highlightarachne/highlightskeletonmasters/teammatesinradius/" + - "dungeonbossmusic/bloodroommusic/dungeonmusic/list>"; + "gianthp/dungeonbossmusic/bloodroommusic/dungeonmusic/list>"; } public static String usage(ICommandSender arg0) { @@ -124,7 +125,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "ultrasequencer", "chronomatron", "superpairs", "hidetooltipsinaddons", "pickblock", "melodytooltips", "highlightslayers", "highlightskeletonmasters", "dungeonbossmusic", "bloodroommusic", "dungeonmusic", - "teammatesinradius", "list"); + "teammatesinradius", "gianthp", "list"); } return null; } @@ -410,6 +411,11 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "TeammatesInRadius", teammatesInRadius); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Teammates in radius has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + teammatesInRadius + DankersSkyblockMod.MAIN_COLOUR + ".")); break; + case "gianthp": + giantHP = !giantHP; + ConfigHandler.writeBooleanConfig("toggles", "GiantHP", giantHP); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Giant HP display has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + giantHP + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "dungeonbossmusic": dungeonBossMusic = !dungeonBossMusic; CustomMusic.dungeonboss.stop(); @@ -475,6 +481,7 @@ public class ToggleCommand extends CommandBase implements ICommand { DankersSkyblockMod.TYPE_COLOUR + " Highlight Arachne Boss: " + DankersSkyblockMod.VALUE_COLOUR + highlightArachne + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Highlight Skeleton Masters: " + DankersSkyblockMod.VALUE_COLOUR + highlightSkeletonMasters + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Teammates in radius: " + DankersSkyblockMod.VALUE_COLOUR + teammatesInRadius + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Giant HP display: " + DankersSkyblockMod.VALUE_COLOUR + giantHP + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Custom dungeon boss music: " + DankersSkyblockMod.VALUE_COLOUR + dungeonBossMusic + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Custom blood room music: " + DankersSkyblockMod.VALUE_COLOUR + bloodRoomMusic + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Custom dungeon music: " + DankersSkyblockMod.VALUE_COLOUR + dungeonMusic diff --git a/src/main/java/me/Danker/features/GiantHPDisplay.java b/src/main/java/me/Danker/features/GiantHPDisplay.java new file mode 100644 index 0000000..07378dd --- /dev/null +++ b/src/main/java/me/Danker/features/GiantHPDisplay.java @@ -0,0 +1,71 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.events.RenderOverlay; +import me.Danker.handlers.ScoreboardHandler; +import me.Danker.handlers.TextRenderer; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.util.StringUtils; +import net.minecraft.world.World; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Pattern; + +public class GiantHPDisplay { + + static Pattern f6GiantPattern = Pattern.compile("(Jolly Pink Giant|L\\.A\\.S\\.R\\.|The Diamond Giant|Bigfoot).*"); + static List<Entity> giants = new ArrayList<>(); + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + World world = Minecraft.getMinecraft().theWorld; + if (DankersSkyblockMod.tickAmount % 20 == 0) { + if (ToggleCommand.giantHP && Utils.inDungeons && world != null) { + giants.clear(); + List<String> scoreboard = ScoreboardHandler.getSidebarLines(); + String firstLine = ScoreboardHandler.cleanSB(scoreboard.get(scoreboard.size() - 1)); + + if (firstLine.contains("sadan")) { + List<Entity> entities = world.getLoadedEntityList(); + + for (Entity entity : entities) { + String name = StringUtils.stripControlCodes(entity.getName()); + if (f6GiantPattern.matcher(name).find()) { + giants.add(entity); + } + } + } else if (firstLine.contains("138,30") || firstLine.contains("354,66") || firstLine.contains("138,66")) { + List<Entity> entities = world.getLoadedEntityList(); + + for (Entity entity : entities) { + if (entity.getName().contains("Giant ")) { + giants.add(entity); + } + } + } + } + } + } + + @SubscribeEvent + public void renderPlayerInfo(RenderOverlay event) { + if (ToggleCommand.giantHP && Utils.inDungeons && giants.size() > 0) { + StringBuilder sb = new StringBuilder(); + + for (Entity giant : giants) { + if (!giant.isDead) sb.append(Utils.removeBold(giant.getDisplayName().getFormattedText())).append("\n"); + } + + new TextRenderer(Minecraft.getMinecraft(), sb.toString(), 100, 100, 1); + } + } + +} diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 4797343..cc33514 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -64,6 +64,7 @@ public class DankerGui extends GuiScreen { private GuiButton highlightSlayer; private GuiButton highlightSkeletonMasters; private GuiButton teammatesInRadius; + private GuiButton giantHP; // Chat Messages private GuiButton sceptreMessages; private GuiButton midasStaffMessages; @@ -149,6 +150,7 @@ public class DankerGui extends GuiScreen { highlightSlayer = new FeatureButton("Highlight Slayer: " + Utils.getColouredBoolean(ToggleCommand.highlightSlayers), "Highlights Slayer bosses."); highlightSkeletonMasters = new FeatureButton("Highlight Skeleton Masters: " + Utils.getColouredBoolean(ToggleCommand.highlightSkeletonMasters), "Highlights Skeleton Masters."); teammatesInRadius = new FeatureButton("Display Players in 30 Block Radius: " + Utils.getColouredBoolean(ToggleCommand.teammatesInRadius), "Displays dungeon teammates in 30 block radius for tether and diversion."); + giantHP = new FeatureButton("Display Giant HP: " + Utils.getColouredBoolean(ToggleCommand.giantHP), "Displays health of Sadan's giants during F6 bossfight and F7 blood room."); allButtons.clear(); allButtons.add(changeDisplay); @@ -192,6 +194,7 @@ public class DankerGui extends GuiScreen { allButtons.add(highlightSlayer); allButtons.add(highlightSkeletonMasters); allButtons.add(teammatesInRadius); + allButtons.add(giantHP); search.setText(initSearchText); search.setVisible(true); @@ -426,6 +429,10 @@ public class DankerGui extends GuiScreen { ToggleCommand.teammatesInRadius = !ToggleCommand.teammatesInRadius; ConfigHandler.writeBooleanConfig("toggles", "TeammatesInRadius", ToggleCommand.teammatesInRadius); teammatesInRadius.displayString = "Display Players in 30 Block Radius: " + Utils.getColouredBoolean(ToggleCommand.teammatesInRadius); + } else if (button == giantHP) { + ToggleCommand.giantHP = !ToggleCommand.giantHP; + ConfigHandler.writeBooleanConfig("toggles", "GiantHP", ToggleCommand.giantHP); + giantHP.displayString = "Display Giant HP: " + Utils.getColouredBoolean(ToggleCommand.giantHP); } } diff --git a/src/main/java/me/Danker/gui/EditLocationsGui.java b/src/main/java/me/Danker/gui/EditLocationsGui.java index c263d5a..2c8b336 100644 --- a/src/main/java/me/Danker/gui/EditLocationsGui.java +++ b/src/main/java/me/Danker/gui/EditLocationsGui.java @@ -1,5 +1,6 @@ package me.Danker.gui; +import javafx.scene.transform.Scale; import me.Danker.DankersSkyblockMod; import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; @@ -32,6 +33,7 @@ public class EditLocationsGui extends GuiScreen { private LocationButton bonzoTimer; private LocationButton golemTimer; private LocationButton teammatesInRadius; + private LocationButton giantHP; @Override public boolean doesGuiPauseGame() { @@ -95,18 +97,24 @@ public class EditLocationsGui extends GuiScreen { EnumChatFormatting.GREEN + "Not_A_Neko\n" + EnumChatFormatting.GREEN + "Minikloon"; - // ive lost my marbles - display = new LocationButton(0, MoveCommand.displayXY[0], MoveCommand.displayXY[1], 145 * ScaleCommand.displayScale, 102 * ScaleCommand.displayScale, ScaleCommand.displayScale, displayText, displayNums, 110); - dungeonTimer = new LocationButton(0, MoveCommand.dungeonTimerXY[0], MoveCommand.dungeonTimerXY[1], 113 * ScaleCommand.dungeonTimerScale, 57 * ScaleCommand.dungeonTimerScale, ScaleCommand.dungeonTimerScale, dungeonTimerText, dungeonTimerNums, 80); - coords = new LocationButton(0, MoveCommand.coordsXY[0], MoveCommand.coordsXY[1], 141 * ScaleCommand.coordsScale, 12 * ScaleCommand.coordsScale, ScaleCommand.coordsScale, NoF3Coords.COORDS_COLOUR + "74 / 14 / -26 (141.1 / 6.7)", null, null); - skill50 = new LocationButton(0, MoveCommand.skill50XY[0], MoveCommand.skill50XY[1], 233 * ScaleCommand.skill50Scale, 12 * ScaleCommand.skill50Scale, ScaleCommand.skill50Scale, Skill50Display.SKILL_50_COLOUR + "+3.5 Farming (28,882,117.7/55,172,425) 52.34%", null, null); - lividHP = new LocationButton(0, MoveCommand.lividHpXY[0], MoveCommand.lividHpXY[1], 85 * ScaleCommand.lividHpScale, 12 * ScaleCommand.lividHpScale, ScaleCommand.lividHpScale, EnumChatFormatting.WHITE + "﴾ Livid " + EnumChatFormatting.YELLOW + "6.9M" + EnumChatFormatting.RED + "❤ " + EnumChatFormatting.WHITE + "﴿", null, null); - cakeTimer = new LocationButton(0, MoveCommand.cakeTimerXY[0], MoveCommand.cakeTimerXY[1] + 5, 85 * ScaleCommand.cakeTimerScale, 18 * ScaleCommand.cakeTimerScale, ScaleCommand.cakeTimerScale, CakeTimer.CAKE_COLOUR + " 11h16m", null, null); - skillTracker = new LocationButton(0, MoveCommand.skillTrackerXY[0], MoveCommand.skillTrackerXY[1], 150 * ScaleCommand.skillTrackerScale, 28 * ScaleCommand.skillTrackerScale, ScaleCommand.skillTrackerScale, skillTrackerText, null, null); - waterAnswer = new LocationButton(0, MoveCommand.waterAnswerXY[0], MoveCommand.waterAnswerXY[1], 190 * ScaleCommand.waterAnswerScale, 54 * ScaleCommand.waterAnswerScale, ScaleCommand.waterAnswerScale, waterAnswerText, null, null); - bonzoTimer = new LocationButton(0, MoveCommand.bonzoTimerXY[0], MoveCommand.bonzoTimerXY[1] + 5, 53 * ScaleCommand.bonzoTimerScale, 18 * ScaleCommand.bonzoTimerScale, ScaleCommand.bonzoTimerScale, BonzoMaskTimer.BONZO_COLOR + " 3m30s", null, null); - golemTimer = new LocationButton(0, MoveCommand.golemTimerXY[0], MoveCommand.golemTimerXY[1] + 5, 42 * ScaleCommand.golemTimerScale, 18 * ScaleCommand.golemTimerScale, ScaleCommand.golemTimerScale, GolemSpawningAlert.GOLEM_COLOUR + " 20s", null, null); - teammatesInRadius = new LocationButton(0, MoveCommand.teammatesInRadiusXY[0], MoveCommand.teammatesInRadiusXY[1], 107 * ScaleCommand.teammatesInRadiusScale, 45 * ScaleCommand.teammatesInRadiusScale, ScaleCommand.teammatesInRadiusScale, teammatesInRadiusText, null, null); + String giantHPText = EnumChatFormatting.DARK_RED + "L.A.S.R. " + EnumChatFormatting.GREEN + "25M" + EnumChatFormatting.RED + "❤\n" + + EnumChatFormatting.RED + "Bigfoot " + EnumChatFormatting.GREEN + "25M" + EnumChatFormatting.RED + "❤\n" + + EnumChatFormatting.LIGHT_PURPLE + "Jolly Pink Giant " + EnumChatFormatting.GREEN + "25M" + EnumChatFormatting.RED + "❤\n" + + EnumChatFormatting.DARK_AQUA + "The Diamond Giant " + EnumChatFormatting.GREEN + "25M" + EnumChatFormatting.RED + "❤"; + + + display = new LocationButton(MoveCommand.displayXY[0], MoveCommand.displayXY[1], ScaleCommand.displayScale, displayText, displayNums, 110); + dungeonTimer = new LocationButton(MoveCommand.dungeonTimerXY[0], MoveCommand.dungeonTimerXY[1], ScaleCommand.dungeonTimerScale, dungeonTimerText, dungeonTimerNums, 80); + coords = new LocationButton(MoveCommand.coordsXY[0], MoveCommand.coordsXY[1], ScaleCommand.coordsScale, NoF3Coords.COORDS_COLOUR + "74 / 14 / -26 (141.1 / 6.7)", null, null); + skill50 = new LocationButton(MoveCommand.skill50XY[0], MoveCommand.skill50XY[1], ScaleCommand.skill50Scale, Skill50Display.SKILL_50_COLOUR + "+3.5 Farming (28,882,117.7/55,172,425) 52.34%", null, null); + lividHP = new LocationButton(MoveCommand.lividHpXY[0], MoveCommand.lividHpXY[1], ScaleCommand.lividHpScale, EnumChatFormatting.WHITE + "﴾ Livid " + EnumChatFormatting.YELLOW + "6.9M" + EnumChatFormatting.RED + "❤ " + EnumChatFormatting.WHITE + "﴿", null, null); + cakeTimer = new LocationButton(MoveCommand.cakeTimerXY[0], MoveCommand.cakeTimerXY[1] + 5, ScaleCommand.cakeTimerScale, CakeTimer.CAKE_COLOUR + " 11h16m", null, null); + skillTracker = new LocationButton(MoveCommand.skillTrackerXY[0], MoveCommand.skillTrackerXY[1], ScaleCommand.skillTrackerScale, skillTrackerText, null, null); + waterAnswer = new LocationButton(MoveCommand.waterAnswerXY[0], MoveCommand.waterAnswerXY[1], ScaleCommand.waterAnswerScale, waterAnswerText, null, null); + bonzoTimer = new LocationButton(MoveCommand.bonzoTimerXY[0], MoveCommand.bonzoTimerXY[1] + 5, ScaleCommand.bonzoTimerScale, BonzoMaskTimer.BONZO_COLOR + " 3m30s", null, null); + golemTimer = new LocationButton(MoveCommand.golemTimerXY[0], MoveCommand.golemTimerXY[1] + 5, ScaleCommand.golemTimerScale, GolemSpawningAlert.GOLEM_COLOUR + " 20s", null, null); + teammatesInRadius = new LocationButton(MoveCommand.teammatesInRadiusXY[0], MoveCommand.teammatesInRadiusXY[1], ScaleCommand.teammatesInRadiusScale, teammatesInRadiusText, null, null); + giantHP = new LocationButton(MoveCommand.giantHPXY[0], MoveCommand.giantHPXY[1], ScaleCommand.giantHPScale, giantHPText, null, null); this.buttonList.add(coords); this.buttonList.add(dungeonTimer); @@ -119,6 +127,7 @@ public class EditLocationsGui extends GuiScreen { this.buttonList.add(skill50); this.buttonList.add(golemTimer); this.buttonList.add(teammatesInRadius); + this.buttonList.add(giantHP); } @Override @@ -222,6 +231,12 @@ public class EditLocationsGui extends GuiScreen { teammatesInRadius.xPosition = MoveCommand.teammatesInRadiusXY[0]; teammatesInRadius.yPosition = MoveCommand.teammatesInRadiusXY[1]; break; + case "giantHP": + MoveCommand.giantHPXY[0] += xMoved; + MoveCommand.giantHPXY[1] += yMoved; + giantHP.xPosition = MoveCommand.giantHPXY[0]; + giantHP.yPosition = MoveCommand.giantHPXY[1]; + break; } this.buttonList.clear(); initGui(); @@ -256,6 +271,8 @@ public class EditLocationsGui extends GuiScreen { moving = "golemTimer"; } else if (button == teammatesInRadius) { moving = "teammatesInRadius"; + } else if (button == giantHP) { + moving = "giantHP"; } } } @@ -286,6 +303,8 @@ public class EditLocationsGui extends GuiScreen { ConfigHandler.writeIntConfig("locations", "golemTimerY", MoveCommand.golemTimerXY[1]); ConfigHandler.writeIntConfig("locations", "teammatesInRadiusX", MoveCommand.teammatesInRadiusXY[0]); ConfigHandler.writeIntConfig("locations", "teammatesInRadiusY", MoveCommand.teammatesInRadiusXY[1]); + ConfigHandler.writeIntConfig("locations", "giantHPX", MoveCommand.giantHPXY[0]); + ConfigHandler.writeIntConfig("locations", "giantHPY", MoveCommand.giantHPXY[1]); } } diff --git a/src/main/java/me/Danker/gui/buttons/LocationButton.java b/src/main/java/me/Danker/gui/buttons/LocationButton.java index a8937fd..f328c58 100644 --- a/src/main/java/me/Danker/gui/buttons/LocationButton.java +++ b/src/main/java/me/Danker/gui/buttons/LocationButton.java @@ -13,21 +13,17 @@ public class LocationButton extends GuiButton { private String text; private String text2; private Integer text2Offset; + private int longestText; - public LocationButton(int buttonId, int x, int y, double width, double height, double scale, String text, String text2, Integer text2Offset) { - super(buttonId, x, y, text); + public LocationButton(int x, int y, double scale, String text, String text2, Integer text2Offset) { + super(0, x, y, text); this.x = x; this.y = y; - this.width = (int) width; - this.height = (int) height; this.scale = scale; this.text = text; this.text2 = text2; this.text2Offset = text2Offset; - } - - @Override - public void drawButton(Minecraft mc, int mouseX, int mouseY) { + String[] splitText; if (text2 == null) { splitText = text.split("\n"); @@ -37,16 +33,23 @@ public class LocationButton extends GuiButton { int longestText = -1; for (String s : splitText) { - int stringLength = mc.fontRendererObj.getStringWidth(s); + int stringLength = Minecraft.getMinecraft().fontRendererObj.getStringWidth(s); if (stringLength > longestText) { longestText = stringLength; } } - + + this.longestText = longestText; + this.height = (int) ((splitText.length * 9 + 3) * scale); + this.width = (int) ((this.longestText + 3) * scale); + } + + @Override + public void drawButton(Minecraft mc, int mouseX, int mouseY) { if (text2 == null) { - drawRect(x - 2, y - 2, (int) (x + longestText * scale + 3), (int) (y + (splitText.length * 9 + 3) * scale), 0x40D3D3D3); + drawRect(x - 2, y - 2, x + width, y + height, 0x40D3D3D3); } else { - drawRect(x - 2, y - 2, (int) (x + (longestText + text2Offset) * scale + 3), (int) (y + (splitText.length * 9 + 3) * scale), 0x40D3D3D3); + drawRect(x - 2, y - 2, (int) (x + (longestText + text2Offset + 3) * scale), y + height, 0x40D3D3D3); new TextRenderer(mc, text2, (int) (x + (text2Offset * scale)), y, scale); } new TextRenderer(mc, text, x, y, scale); diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index dcb2368..a200b01 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -105,9 +105,7 @@ public class ConfigHandler { } public static void writeDoubleConfig(String category, String key, double value) { - config = new Configuration(new File(file)); try { - config.load(); double set = config.get(category, key, value).getDouble(); config.getCategory(category).get(key).set(value); } catch (Exception ex) { @@ -131,9 +129,7 @@ public class ConfigHandler { } public static void writeBooleanConfig(String category, String key, boolean value) { - config = new Configuration(new File(file)); try { - config.load(); boolean set = config.get(category, key, value).getBoolean(); config.getCategory(category).get(key).set(value); } catch (Exception ex) { @@ -208,6 +204,8 @@ public class ConfigHandler { } public static void reloadConfig() { + init(); + // Toggles ToggleCommand.gpartyToggled = initBoolean("toggles", "GParty", false); ToggleCommand.coordsToggled = initBoolean("toggles", "Coords", false); @@ -230,6 +228,7 @@ public class ConfigHandler { ToggleCommand.highlightArachne = initBoolean("toggles", "HighlightArachne", false); ToggleCommand.highlightSkeletonMasters = initBoolean("toggles", "HighlightSkeletonMasters", false); ToggleCommand.teammatesInRadius = initBoolean("toggles", "TeammatesInRadius", false); + ToggleCommand.giantHP = initBoolean("toggles", "GiantHP", false); // Chat Messages ToggleCommand.sceptreMessages = initBoolean("toggles", "SceptreMessages", true); ToggleCommand.midasStaffMessages = initBoolean("toggles", "MidasStaffMessages", true); @@ -481,6 +480,8 @@ public class ConfigHandler { MoveCommand.golemTimerXY[1] = initInt("locations", "golemTimerY", 30); MoveCommand.teammatesInRadiusXY[0] = initInt("locations", "teammatesInRadiusX", 80); MoveCommand.teammatesInRadiusXY[1] = initInt("locations", "teammatesInRadiusY", 100); + MoveCommand.giantHPXY[0] = initInt("locations", "giantHPX", 80); + MoveCommand.giantHPXY[1] = initInt("locations", "giantHPY", 150); // Scales ScaleCommand.coordsScale = initDouble("scales", "coordsScale", 1); @@ -494,6 +495,7 @@ public class ConfigHandler { ScaleCommand.bonzoTimerScale = initDouble("scales", "bonzoTimerScale", 1); ScaleCommand.golemTimerScale = initDouble("scales", "golemTimerScale", 1); ScaleCommand.teammatesInRadiusScale = initDouble("scales", "teammatesInRadiusScale", 1); + ScaleCommand.giantHPScale = initDouble("scales", "giantHPScale", 1); // Colours DankersSkyblockMod.MAIN_COLOUR = initString("colors", "main", EnumChatFormatting.GREEN.toString()); diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index b7927c3..d3d6325 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -30,6 +30,7 @@ import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.regex.Matcher; +import java.util.regex.Pattern; public class Utils { @@ -45,6 +46,7 @@ public class Utils { 1065000, 1410000, 1900000, 2500000, 3300000, 4300000, 5600000, 7200000, 9200000, 12000000, 15000000, 19000000, 24000000, 30000000, 38000000, 48000000, 60000000, 75000000, 93000000, 116250000}; static int[] expertiseKills = {50, 100, 250, 500, 1000, 2500, 5500, 10000, 15000}; + static Pattern boldPattern = Pattern.compile("(?i)\\u00A7L"); public static int getItems(String item) { Minecraft mc = Minecraft.getMinecraft(); @@ -542,5 +544,9 @@ public class Utils { public static boolean isRealPlayer(EntityPlayer player) { return player.getUniqueID().version() == 4 && !player.isPlayerSleeping(); } + + public static String removeBold(String text) { + return boldPattern.matcher(text).replaceAll(""); + } } |