diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-12-07 14:01:52 -0500 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2020-12-07 14:01:52 -0500 |
commit | 15255eb3e2379e950b39011bacecbdf6eb4441a7 (patch) | |
tree | 20aa030f964df84895861f004625e2d028ee97eb | |
parent | 28f2c167e53e52f7c111e08652d1f4a906eab0f6 (diff) | |
download | SkyblockMod-15255eb3e2379e950b39011bacecbdf6eb4441a7.tar.gz SkyblockMod-15255eb3e2379e950b39011bacecbdf6eb4441a7.tar.bz2 SkyblockMod-15255eb3e2379e950b39011bacecbdf6eb4441a7.zip |
Add player and health to low health notification
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | src/main/java/me/Danker/DankersSkyblockMod.java | 29 | ||||
-rw-r--r-- | src/main/java/me/Danker/utils/Utils.java | 23 |
3 files changed, 29 insertions, 25 deletions
@@ -29,7 +29,7 @@ Discord Server: https://discord.gg/QsEkNQS - Expertise kills in fishing rod lore - Catacombs trackers - Dungeons puzzle solver (Riddle, trivia, blaze, creeper, water, tic tac toe) -- Experimentation solvers (Ultrasequencer) +- Experimentation solvers (Ultrasequencer, Chronomatron, Superpairs) - Catacombs F7 Stage 3 solvers (Starts with letter, select all colour, ignore arrows on sea lanterns) - Find correct Livid (with graphic display of HP) - Pet background colors based on level diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 7c82986..2157544 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -7,7 +7,6 @@ import me.Danker.handlers.*; import me.Danker.utils.TicTacToeUtils; import me.Danker.utils.Utils; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.Gui; @@ -2648,7 +2647,8 @@ public class DankersSkyblockMod List<String> scoreboard = ScoreboardHandler.getSidebarLines(); for (String score : scoreboard) { if (score.endsWith("❤") && score.matches(".*§c\\d.*")) { - Utils.createTitle(EnumChatFormatting.RED + "LOW HEALTH!", 1); + String name = score.substring(score.indexOf(" ") + 1); + Utils.createTitle(EnumChatFormatting.RED + "LOW HEALTH!\n" + name, 1); break; } } @@ -2783,9 +2783,8 @@ public class DankersSkyblockMod } } - if(event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { - IBlockState blockState = Minecraft.getMinecraft().theWorld.getBlockState(event.pos); - Block block = blockState.getBlock(); + if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { + Block block = Minecraft.getMinecraft().theWorld.getBlockState(event.pos).getBlock(); ArrayList<Block> interactables = new ArrayList<>(Arrays.asList( Blocks.acacia_door, Blocks.anvil, @@ -2821,11 +2820,11 @@ public class DankersSkyblockMod Blocks.oak_door, Blocks.skull )); - if(Utils.inDungeons) { + if (Utils.inDungeons) { interactables.add(Blocks.coal_block); interactables.add(Blocks.stained_hardened_clay); } - if(!interactables.contains(block)) { + if (!interactables.contains(block)) { if (ToggleCommand.aotdToggled && item.getDisplayName().contains("Aspect of the Dragons")) { event.setCanceled(true); } @@ -2891,12 +2890,12 @@ public class DankersSkyblockMod ItemStack item = mouseSlot.getStack(); String inventoryName = inventory.getDisplayName().getUnformattedText(); - if(ToggleCommand.stopSalvageStarredToggled && inventoryName.startsWith("Salvage")) { - if(item == null) return; + if (ToggleCommand.stopSalvageStarredToggled && inventoryName.startsWith("Salvage")) { + if (item == null) return; boolean inSalvageGui = false; - if(item.getDisplayName().contains("Salvage") || item.getDisplayName().contains("Essence")) { + if (item.getDisplayName().contains("Salvage") || item.getDisplayName().contains("Essence")) { ItemStack salvageItem = inventory.getStackInSlot(13); - if(salvageItem == null) return; + if (salvageItem == null) return; item = salvageItem; inSalvageGui = true; } @@ -3037,15 +3036,15 @@ public class DankersSkyblockMod GuiChest chest = (GuiChest) event.gui; IInventory inventory = ((ContainerChest) containerChest).getLowerChestInventory(); String inventoryName = inventory.getDisplayName().getUnformattedText(); - if(ToggleCommand.swapToPickBlockInExperimentsToggled) { - if(inventoryName.startsWith("Chronomatron (") || inventoryName.startsWith("Superpairs (") || inventoryName.startsWith("Ultrasequencer (")) { - if(!pickBlockBindSwapped) { + if (ToggleCommand.swapToPickBlockInExperimentsToggled) { + if (inventoryName.startsWith("Chronomatron (") || inventoryName.startsWith("Superpairs (") || inventoryName.startsWith("Ultrasequencer (")) { + if (!pickBlockBindSwapped) { pickBlockBind = gameSettings.keyBindPickBlock.getKeyCode(); gameSettings.keyBindPickBlock.setKeyCode(-100); pickBlockBindSwapped = true; } } else { - if(pickBlockBindSwapped) { + if (pickBlockBindSwapped) { gameSettings.keyBindPickBlock.setKeyCode(pickBlockBind); pickBlockBindSwapped = false; } diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index e0a7454..fbd8e4c 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -103,16 +103,21 @@ public class Utils { int height = scaledResolution.getScaledHeight(); int width = scaledResolution.getScaledWidth(); - int textLength = mc.fontRendererObj.getStringWidth(text); - - double scale = 4; - if (textLength * scale > (width * 0.9F)) { - scale = (width * 0.9F) / (float) textLength; + int drawHeight = 0; + String[] splitText = text.split("\n"); + for (String title : splitText) { + int textLength = mc.fontRendererObj.getStringWidth(title); + + double scale = 4; + if (textLength * scale > (width * 0.9F)) { + scale = (width * 0.9F) / (float) textLength; + } + + int titleX = (int) ((width / 2) - (textLength * scale / 2)); + int titleY = (int) ((height * 0.45) / scale) + (int) (drawHeight * scale); + new TextRenderer(mc, title, titleX, titleY, scale); + drawHeight += mc.fontRendererObj.FONT_HEIGHT; } - - int titleX = (int) ((width / 2) - (textLength * scale / 2)); - int titleY = (int) ((height * 0.45) / scale); - new TextRenderer(mc, text, titleX, titleY, scale); } public static void checkForSkyblock() { |