aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/me/Danker/DankersSkyblockMod.java29
-rw-r--r--src/main/java/me/Danker/utils/Utils.java23
2 files changed, 28 insertions, 24 deletions
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() {