aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat/skyblockhud/handlers
diff options
context:
space:
mode:
authorTymanWasTaken <tyman@tyman.tech>2021-07-06 17:13:01 -0400
committerTymanWasTaken <tyman@tyman.tech>2021-07-06 17:13:01 -0400
commitbb75fd7b83b238f1f922ffc64b2a0a535c5524b7 (patch)
tree617c91cced71f672662bddea6c540939cb9a3953 /src/main/java/com/thatgravyboat/skyblockhud/handlers
parent91464c8f433e8bf323932ac956678971207b607e (diff)
downloadSkyblockHud-Death-Defied-bb75fd7b83b238f1f922ffc64b2a0a535c5524b7.tar.gz
SkyblockHud-Death-Defied-bb75fd7b83b238f1f922ffc64b2a0a535c5524b7.tar.bz2
SkyblockHud-Death-Defied-bb75fd7b83b238f1f922ffc64b2a0a535c5524b7.zip
Format
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/handlers')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java45
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/CurrencyHandler.java159
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java64
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java582
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java251
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/TimeHandler.java46
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/DwarvenIcons.java162
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/HubIcons.java602
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeHelper.java32
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeRegistry.java29
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/SkyBlockEntity.java31
11 files changed, 1197 insertions, 806 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java
index 38fa874..16ff63f 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java
@@ -12,26 +12,33 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class BossbarHandler {
- public static boolean bossBarRendered = true;
+ public static boolean bossBarRendered = true;
- @SubscribeEvent(priority = EventPriority.LOWEST)
- public void onBossbarRender(RenderGameOverlayEvent.Pre event) {
- if (event.type == RenderGameOverlayEvent.ElementType.BOSSHEALTH && BossStatus.bossName != null) {
- bossBarRendered = !event.isCanceled();
- if (!SkyblockHud.config.main.bossShiftHud){
- bossBarRendered = false;
- }
- String bossName = Utils.removeColor(BossStatus.bossName);
- if (SkyblockHud.config.renderer.hideBossBar && DwarvenMineHandler.currentEvent == DwarvenMineHandler.Event.NONE && !LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)){
- if (bossName.equalsIgnoreCase("wither")){
- event.setCanceled(true);
- bossBarRendered = false;
- }
- if (bossName.toLowerCase().startsWith("objective:")){
- event.setCanceled(true);
- bossBarRendered = false;
- }
- }
+ @SubscribeEvent(priority = EventPriority.LOWEST)
+ public void onBossbarRender(RenderGameOverlayEvent.Pre event) {
+ if (
+ event.type == RenderGameOverlayEvent.ElementType.BOSSHEALTH &&
+ BossStatus.bossName != null
+ ) {
+ bossBarRendered = !event.isCanceled();
+ if (!SkyblockHud.config.main.bossShiftHud) {
+ bossBarRendered = false;
+ }
+ String bossName = Utils.removeColor(BossStatus.bossName);
+ if (
+ SkyblockHud.config.renderer.hideBossBar &&
+ DwarvenMineHandler.currentEvent == DwarvenMineHandler.Event.NONE &&
+ !LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)
+ ) {
+ if (bossName.equalsIgnoreCase("wither")) {
+ event.setCanceled(true);
+ bossBarRendered = false;
}
+ if (bossName.toLowerCase().startsWith("objective:")) {
+ event.setCanceled(true);
+ bossBarRendered = false;
+ }
+ }
}
+ }
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CurrencyHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CurrencyHandler.java
index 12b04d8..f8c6b86 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CurrencyHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CurrencyHandler.java
@@ -3,79 +3,130 @@ package com.thatgravyboat.skyblockhud.handlers;
import com.thatgravyboat.skyblockhud.Utils;
import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent;
import com.thatgravyboat.skyblockhud.api.events.SidebarPostEvent;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Arrays;
import java.util.Locale;
import java.util.regex.Pattern;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class CurrencyHandler {
- private static int bits = 0;
- private static double coins = 0;
+ private static int bits = 0;
+ private static double coins = 0;
- public static void setBits(int amount){ bits = amount; }
- public static void setCoins(double amount){ coins = amount; }
- public static int getBits(){ return bits; }
- public static double getCoins(){ return coins; }
+ public static void setBits(int amount) {
+ bits = amount;
+ }
- @SubscribeEvent
- public void onSidebarLineUpdate(SidebarLineUpdateEvent event){
- if (Utils.removeColor(event.formattedLine.toLowerCase().trim()).contains("purse:") || Utils.removeColor(event.formattedLine.toLowerCase().trim()).contains("piggy:")) {
- CurrencyHandler.checkCoins(event.formattedLine);
- }
- if (Utils.removeColor(event.formattedLine.toLowerCase().trim()).contains("bits:") && !event.formattedLine.toLowerCase().contains("(")) {
- CurrencyHandler.checkBits(event.formattedLine);
- }
- }
+ public static void setCoins(double amount) {
+ coins = amount;
+ }
- @SubscribeEvent
- public void onSidebarPost(SidebarPostEvent event){
- if (!Arrays.toString(event.arrayScores).toLowerCase().contains("bits:")){
- CurrencyHandler.setBits(0);
- }
- }
+ public static int getBits() {
+ return bits;
+ }
- public static String getCoinsFormatted(){
+ public static double getCoins() {
+ return coins;
+ }
- DecimalFormat formatter = new DecimalFormat("#,###.0", DecimalFormatSymbols.getInstance(Locale.CANADA));
- String output = formatter.format(coins);
- if (output.equals(".0")) output = "0.0";
- else if (output.equals(",0")) output = "0,0";
- return output;
+ @SubscribeEvent
+ public void onSidebarLineUpdate(SidebarLineUpdateEvent event) {
+ if (
+ Utils
+ .removeColor(event.formattedLine.toLowerCase().trim())
+ .contains("purse:") ||
+ Utils
+ .removeColor(event.formattedLine.toLowerCase().trim())
+ .contains("piggy:")
+ ) {
+ CurrencyHandler.checkCoins(event.formattedLine);
+ }
+ if (
+ Utils
+ .removeColor(event.formattedLine.toLowerCase().trim())
+ .contains("bits:") &&
+ !event.formattedLine.toLowerCase().contains("(")
+ ) {
+ CurrencyHandler.checkBits(event.formattedLine);
}
+ }
- public static String getBitsFormatted(){
- DecimalFormat formatter = new DecimalFormat("#.#", DecimalFormatSymbols.getInstance(Locale.CANADA));
- formatter.setRoundingMode(RoundingMode.FLOOR);
- return bits > 999 ? formatter.format((double)bits / 1000)+ "k" : String.valueOf(bits);
+ @SubscribeEvent
+ public void onSidebarPost(SidebarPostEvent event) {
+ if (!Arrays.toString(event.arrayScores).toLowerCase().contains("bits:")) {
+ CurrencyHandler.setBits(0);
}
+ }
+
+ public static String getCoinsFormatted() {
+ DecimalFormat formatter = new DecimalFormat(
+ "#,###.0",
+ DecimalFormatSymbols.getInstance(Locale.CANADA)
+ );
+ String output = formatter.format(coins);
+ if (output.equals(".0")) output = "0.0"; else if (
+ output.equals(",0")
+ ) output = "0,0";
+ return output;
+ }
+
+ public static String getBitsFormatted() {
+ DecimalFormat formatter = new DecimalFormat(
+ "#.#",
+ DecimalFormatSymbols.getInstance(Locale.CANADA)
+ );
+ formatter.setRoundingMode(RoundingMode.FLOOR);
+ return bits > 999
+ ? formatter.format((double) bits / 1000) + "k"
+ : String.valueOf(bits);
+ }
- public static void checkCoins(String formatedScoreboardLine){
- String purse = Utils.removeWhiteSpaceAndRemoveWord(
- Utils.removeColor(formatedScoreboardLine.toLowerCase().trim()),
- Utils.removeColor(formatedScoreboardLine.toLowerCase().trim()).contains("purse:") ? "purse:" : "piggy:"
- ).replace(",", "");
- if (!purse.contains("(") && !purse.contains("+")) {
- try {
- double coins = Double.parseDouble(Pattern.compile("[^0-9.]").matcher(purse).replaceAll(""));
- CurrencyHandler.setCoins(coins);
- } catch (IllegalArgumentException ex) {
- System.out.println("Failed to parse purse, please report to ThatGravyBoat. Purse Text: " + purse);
- }
- }
+ public static void checkCoins(String formatedScoreboardLine) {
+ String purse = Utils
+ .removeWhiteSpaceAndRemoveWord(
+ Utils.removeColor(formatedScoreboardLine.toLowerCase().trim()),
+ Utils
+ .removeColor(formatedScoreboardLine.toLowerCase().trim())
+ .contains("purse:")
+ ? "purse:"
+ : "piggy:"
+ )
+ .replace(",", "");
+ if (!purse.contains("(") && !purse.contains("+")) {
+ try {
+ double coins = Double.parseDouble(
+ Pattern.compile("[^0-9.]").matcher(purse).replaceAll("")
+ );
+ CurrencyHandler.setCoins(coins);
+ } catch (IllegalArgumentException ex) {
+ System.out.println(
+ "Failed to parse purse, please report to ThatGravyBoat. Purse Text: " +
+ purse
+ );
+ }
}
+ }
- public static void checkBits(String formatedScoreboardLine){
- String bits = Utils.removeWhiteSpaceAndRemoveWord(Utils.removeColor(formatedScoreboardLine.toLowerCase().trim()), "bits:").replace(",", "");
- try {
- int bit = Integer.parseInt(Pattern.compile("[^0-9]").matcher(bits).replaceAll(""));
- CurrencyHandler.setBits(bit);
- } catch (IllegalArgumentException ex) {
- System.out.println("Failed to parse bits, please report to ThatGravyBoat. Bits Text: " + bits);
- }
+ public static void checkBits(String formatedScoreboardLine) {
+ String bits = Utils
+ .removeWhiteSpaceAndRemoveWord(
+ Utils.removeColor(formatedScoreboardLine.toLowerCase().trim()),
+ "bits:"
+ )
+ .replace(",", "");
+ try {
+ int bit = Integer.parseInt(
+ Pattern.compile("[^0-9]").matcher(bits).replaceAll("")
+ );
+ CurrencyHandler.setBits(bit);
+ } catch (IllegalArgumentException ex) {
+ System.out.println(
+ "Failed to parse bits, please report to ThatGravyBoat. Bits Text: " +
+ bits
+ );
}
+ }
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java
index 1a401f2..8211f0f 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java
@@ -12,32 +12,50 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class HeldItemHandler extends Gui {
- public void drawFuelBar(Minecraft mc, int current, int max){
- GenericOverlays.drawSmallBar(mc, 100,100,(double)current/(double)max,1.0d,0xff00ff,0xffff00, 0);
- drawString(mc.fontRendererObj, "Fuel - " + Math.round(((double)current/(double)max)*100) + "%", 100, 100, 0xffffff);
- }
+ public void drawFuelBar(Minecraft mc, int current, int max) {
+ GenericOverlays.drawSmallBar(
+ mc,
+ 100,
+ 100,
+ (double) current / (double) max,
+ 1.0d,
+ 0xff00ff,
+ 0xffff00,
+ 0
+ );
+ drawString(
+ mc.fontRendererObj,
+ "Fuel - " + Math.round(((double) current / (double) max) * 100) + "%",
+ 100,
+ 100,
+ 0xffffff
+ );
+ }
- public boolean isDrill(ItemStack stack){
- if (stack == null) return false;
- if (!stack.getTagCompound().hasKey("ExtraAttributes")) return false;
- return stack.getTagCompound().getCompoundTag("ExtraAttributes").hasKey("drill_fuel");
- }
+ public boolean isDrill(ItemStack stack) {
+ if (stack == null) return false;
+ if (!stack.getTagCompound().hasKey("ExtraAttributes")) return false;
+ return stack
+ .getTagCompound()
+ .getCompoundTag("ExtraAttributes")
+ .hasKey("drill_fuel");
+ }
- public String getDrillFuel(ItemStack stack){
- NBTTagCompound display = stack.getTagCompound().getCompoundTag("display");
- NBTTagList lore = display.getTagList("Lore", 8);
- for (int i = lore.tagCount() - 1; i >= 0; i--) {
- String line = Utils.removeColor(lore.getStringTagAt(i));
- if (line.trim().startsWith("Fuel:")){
- return line;
- }
- }
- return "";
+ public String getDrillFuel(ItemStack stack) {
+ NBTTagCompound display = stack.getTagCompound().getCompoundTag("display");
+ NBTTagList lore = display.getTagList("Lore", 8);
+ for (int i = lore.tagCount() - 1; i >= 0; i--) {
+ String line = Utils.removeColor(lore.getStringTagAt(i));
+ if (line.trim().startsWith("Fuel:")) {
+ return line;
+ }
}
+ return "";
+ }
- @SubscribeEvent
- public void drawOverlay(RenderGameOverlayEvent.Post event){
- /*
+ @SubscribeEvent
+ public void drawOverlay(RenderGameOverlayEvent.Post event) {
+ /*
if (Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard())){
Minecraft mc = Minecraft.getMinecraft();
ItemStack stack = mc.thePlayer.getHeldItem();
@@ -54,5 +72,5 @@ public class HeldItemHandler extends Gui {
}
}
*/
- }
+ }
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java
index eaed920..bb2b492 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;
@@ -8,6 +10,10 @@ import com.thatgravyboat.skyblockhud.core.config.Position;
import com.thatgravyboat.skyblockhud.handlers.mapicons.DwarvenIcons;
import com.thatgravyboat.skyblockhud.handlers.mapicons.HubIcons;
import com.thatgravyboat.skyblockhud.location.LocationHandler;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import javax.vecmath.Vector2f;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
@@ -20,200 +26,428 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import org.lwjgl.opengl.GL11;
-import javax.vecmath.Vector2f;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
+public class MapHandler {
-import static com.thatgravyboat.skyblockhud.GuiTextures.mapOverlay;
+ public enum MapIconTypes {
+ SHOPS,
+ MISC,
+ NPC,
+ INFO,
+ QUEST
+ }
-public class MapHandler {
+ public static class MapIcon {
- public enum MapIconTypes {
- SHOPS,
- MISC,
- NPC,
- INFO,
- QUEST
+ public Vector2f position;
+ public ResourceLocation icon;
+ public String tooltip;
+ public String command;
+ public MapIconTypes type;
+
+ public MapIcon(
+ Vector2f pos,
+ ResourceLocation icon,
+ String tooltip,
+ MapIconTypes type
+ ) {
+ this(pos, icon, tooltip, type, "");
}
- public static class MapIcon {
- public Vector2f position;
- public ResourceLocation icon;
- public String tooltip;
- public String command;
- public MapIconTypes type;
+ public MapIcon(
+ Vector2f pos,
+ ResourceLocation icon,
+ String tooltip,
+ MapIconTypes type,
+ String command
+ ) {
+ this.position = pos;
+ this.icon = icon;
+ this.tooltip = tooltip;
+ this.type = type;
+ this.command = command;
+ }
- public MapIcon(Vector2f pos, ResourceLocation icon, String tooltip, MapIconTypes type){
- this(pos,icon,tooltip,type,"");
- }
+ public boolean canRender() {
+ SBHConfig.Map mapConfig = SkyblockHud.config.map;
+ if (
+ mapConfig.showInfoIcons && type.equals(MapIconTypes.INFO)
+ ) return true; else if (
+ mapConfig.showMiscIcons && type.equals(MapIconTypes.MISC)
+ ) return true; else if (
+ mapConfig.showNpcIcons && type.equals(MapIconTypes.NPC)
+ ) return true; else if (
+ mapConfig.showQuestIcons && type.equals(MapIconTypes.QUEST)
+ ) return true; else return (
+ mapConfig.showShopIcons && type.equals(MapIconTypes.SHOPS)
+ );
+ }
+ }
- public MapIcon(Vector2f pos, ResourceLocation icon, String tooltip, MapIconTypes type, String command){
- this.position = pos;
- this.icon = icon;
- this.tooltip = tooltip;
- this.type = type;
- this.command = command;
- }
+ public enum Maps {
+ HUB(
+ 0.5f,
+ 494,
+ 444,
+ 294,
+ 218,
+ 294,
+ 224,
+ new ResourceLocation("skyblockhud", "maps/hub.png"),
+ HubIcons.hubIcons
+ ),
+ MUSHROOM(
+ 1.0f,
+ 318,
+ 316,
+ -84,
+ 605,
+ -84,
+ 612,
+ new ResourceLocation("skyblockhud", "maps/mushroom.png"),
+ Collections.emptyList()
+ ),
+ SPIDERS(
+ 1.0f,
+ 270,
+ 238,
+ 400,
+ 362,
+ 400,
+ 364,
+ new ResourceLocation("skyblockhud", "maps/spidersden.png"),
+ Collections.emptyList()
+ ),
+ NETHER(
+ 0.5f,
+ 257,
+ 371,
+ 436,
+ 732,
+ 433,
+ 736,
+ new ResourceLocation("skyblockhud", "maps/fort.png"),
+ Collections.emptyList()
+ ),
+ BARN(
+ 1.5f,
+ 135,
+ 130,
+ -82,
+ 320,
+ -81,
+ 318,
+ new ResourceLocation("skyblockhud", "maps/barn.png"),
+ Collections.emptyList()
+ ),
+ DWARVEN(
+ 0.5f,
+ 409,
+ 461,
+ 206,
+ 160,
+ 202,
+ 166,
+ new ResourceLocation("skyblockhud", "maps/dwarven.png"),
+ DwarvenIcons.dwarvenIcons
+ ),
+ PARK(
+ 1.0f,
+ 211,
+ 230,
+ 480,
+ 133,
+ 478,
+ 134,
+ new ResourceLocation("skyblockhud", "maps/park.png"),
+ Collections.emptyList()
+ );
- public boolean canRender(){
- SBHConfig.Map mapConfig = SkyblockHud.config.map;
- if (mapConfig.showInfoIcons && type.equals(MapIconTypes.INFO)) return true;
- else if (mapConfig.showMiscIcons && type.equals(MapIconTypes.MISC)) return true;
- else if (mapConfig.showNpcIcons && type.equals(MapIconTypes.NPC)) return true;
- else if (mapConfig.showQuestIcons && type.equals(MapIconTypes.QUEST)) return true;
- else return mapConfig.showShopIcons && type.equals(MapIconTypes.SHOPS);
- }
- }
+ public float scaleFactor;
+ public int width;
+ public int height;
+ public int xMiniOffset;
+ public int yMiniOffset;
+ public int xOffset;
+ public int yOffset;
+ public ResourceLocation mapTexture;
+ public List<MapIcon> icons;
- public enum Maps {
- HUB(0.5f,494,444,294,218, 294,224, new ResourceLocation("skyblockhud", "maps/hub.png"), HubIcons.hubIcons),
- MUSHROOM(1.0f,318,316,-84,605, -84,612, new ResourceLocation("skyblockhud", "maps/mushroom.png"), Collections.emptyList()),
- SPIDERS(1.0f,270,238,400,362, 400,364, new ResourceLocation("skyblockhud", "maps/spidersden.png"), Collections.emptyList()),
- NETHER(0.5f,257,371,436,732, 433,736, new ResourceLocation("skyblockhud", "maps/fort.png"), Collections.emptyList()),
- BARN(1.5f,135,130,-82,320, -81,318, new ResourceLocation("skyblockhud", "maps/barn.png"), Collections.emptyList()),
- DWARVEN(0.5f, 409, 461, 206, 160, 202, 166, new ResourceLocation("skyblockhud", "maps/dwarven.png"), DwarvenIcons.dwarvenIcons),
- PARK(1.0f,211, 230, 480, 133, 478,134, new ResourceLocation("skyblockhud", "maps/park.png"), Collections.emptyList());
-
- public float scaleFactor;
- public int width;
- public int height;
- public int xMiniOffset;
- public int yMiniOffset;
- public int xOffset;
- public int yOffset;
- public ResourceLocation mapTexture;
- public List<MapIcon> icons;
-
-
- Maps(float scaleFactor, int width, int height, int xMiniOffset, int yMiniOffset, int xOffset, int yOffset, ResourceLocation mapTexture, List<MapIcon> icons){
- this.scaleFactor = scaleFactor;
- this.width = width;
- this.height = height;
- this.xMiniOffset = xMiniOffset;
- this.yMiniOffset = yMiniOffset;
- this.xOffset = xOffset;
- this.yOffset = yOffset;
- this.mapTexture = mapTexture;
- this.icons = icons;
- }
+ Maps(
+ float scaleFactor,
+ int width,
+ int height,
+ int xMiniOffset,
+ int yMiniOffset,
+ int xOffset,
+ int yOffset,
+ ResourceLocation mapTexture,
+ List<MapIcon> icons
+ ) {
+ this.scaleFactor = scaleFactor;
+ this.width = width;
+ this.height = height;
+ this.xMiniOffset = xMiniOffset;
+ this.yMiniOffset = yMiniOffset;
+ this.xOffset = xOffset;
+ this.yOffset = yOffset;
+ this.mapTexture = mapTexture;
+ this.icons = icons;
}
+ }
+
+ @SubscribeEvent
+ public void renderOverlay(RenderGameOverlayEvent.Post event) {
+ if (
+ Utils.overlayShouldRender(
+ event.type,
+ SkyblockHud.hasSkyblockScoreboard(),
+ SkyblockHud.config.map.showMiniMap
+ )
+ ) {
+ Minecraft mc = Minecraft.getMinecraft();
+ if (mc.currentScreen instanceof MapScreen) return;
+ if (
+ LocationHandler.getCurrentLocation().getCategory().getMap() == null
+ ) return;
+ if (mc.thePlayer != null) {
+ MapHandler.Maps map = LocationHandler
+ .getCurrentLocation()
+ .getCategory()
+ .getMap();
+ mc.renderEngine.bindTexture(mapOverlay);
+ GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
+ Position pos = SkyblockHud.config.map.miniMapPosition;
+ Gui.drawModalRectWithCustomSizedTexture(
+ pos.getAbsX(event.resolution, 72),
+ pos.getAbsY(event.resolution, 72),
+ 72,
+ 0,
+ 72,
+ 72,
+ 256,
+ 256
+ );
+ mc.renderEngine.bindTexture(map.mapTexture);
+
+ int x = mc.thePlayer.getPosition().getX() + map.xMiniOffset;
+ int z = mc.thePlayer.getPosition().getZ() + map.yMiniOffset;
+ float u = (x / (map.width / 256f)) - 33f;
+ float v = (z / (map.height / 256f)) - 28f;
+
+ GL11.glTexParameteri(
+ GL11.GL_TEXTURE_2D,
+ GL11.GL_TEXTURE_WRAP_S,
+ GL11.GL_CLAMP
+ );
+ GL11.glTexParameteri(
+ GL11.GL_TEXTURE_2D,
+ GL11.GL_TEXTURE_WRAP_T,
+ GL11.GL_CLAMP
+ );
+
+ Gui.drawModalRectWithCustomSizedTexture(
+ pos.getAbsX(event.resolution, 72) + 4,
+ pos.getAbsY(event.resolution, 72) + 2,
+ u,
+ v,
+ 64,
+ 64,
+ 256,
+ 256
+ );
- @SubscribeEvent
- public void renderOverlay(RenderGameOverlayEvent.Post event) {
- if (Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard(), SkyblockHud.config.map.showMiniMap)) {
- Minecraft mc = Minecraft.getMinecraft();
- if (mc.currentScreen instanceof MapScreen) return;
- if (LocationHandler.getCurrentLocation().getCategory().getMap() == null) return;
- if (mc.thePlayer != null){
- MapHandler.Maps map = LocationHandler.getCurrentLocation().getCategory().getMap();
- mc.renderEngine.bindTexture(mapOverlay);
- GlStateManager.color(1.0f,1.0f, 1.0f,1.0f);
- Position pos = SkyblockHud.config.map.miniMapPosition;
- Gui.drawModalRectWithCustomSizedTexture(pos.getAbsX(event.resolution, 72),pos.getAbsY(event.resolution, 72),72,0,72,72,256,256);
- mc.renderEngine.bindTexture(map.mapTexture);
-
- int x = mc.thePlayer.getPosition().getX() + map.xMiniOffset;
- int z = mc.thePlayer.getPosition().getZ() + map.yMiniOffset;
- float u = (x / (map.width / 256f)) - 33f;
- float v = (z / (map.height / 256f)) - 28f;
-
- GL11.glTexParameteri(GL11.GL_TEXTURE_2D,GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
- GL11.glTexParameteri(GL11.GL_TEXTURE_2D,GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
-
- Gui.drawModalRectWithCustomSizedTexture(pos.getAbsX(event.resolution, 72) + 4,
- pos.getAbsY(event.resolution, 72) + 2,
- u,
- v,
- 64,64,
- 256,256);
-
- if (SkyblockHud.config.map.showPlayerLocation) {
- mc.fontRendererObj.drawString("\u2022", pos.getAbsX(event.resolution, 72) + 36,pos.getAbsY(event.resolution, 72) + 34, 0xff0000, false);
- }
-
- GlStateManager.color(1.0f,1.0f, 1.0f,1.0f);
- mc.renderEngine.bindTexture(mapOverlay);
- Gui.drawModalRectWithCustomSizedTexture(pos.getAbsX(event.resolution, 72),pos.getAbsY(event.resolution, 72),0,0,72,72,256,256);
- String keyCode = GameSettings.getKeyDisplayString(KeyBindings.map.getKeyCode());
- Utils.drawStringCenteredScaled(keyCode, mc.fontRendererObj, pos.getAbsX(event.resolution, 64) + 58,pos.getAbsY(event.resolution, 72) + 66, false, 6,0xFFFFFF);
- BlockPos playerPos = mc.thePlayer.getPosition();
- String position = String.format("%d/%d/%d", playerPos.getX(), playerPos.getY(), playerPos.getZ());
- Utils.drawStringCenteredScaled(position, mc.fontRendererObj, pos.getAbsX(event.resolution, 64) + 29,pos.getAbsY(event.resolution, 72) + 66, false, 36,0xFFFFFF);
- GlStateManager.color(1.0f,1.0f, 1.0f,1.0f);
- }
+ if (SkyblockHud.config.map.showPlayerLocation) {
+ mc.fontRendererObj.drawString(
+ "\u2022",
+ pos.getAbsX(event.resolution, 72) + 36,
+ pos.getAbsY(event.resolution, 72) + 34,
+ 0xff0000,
+ false
+ );
}
- }
- @SubscribeEvent
- public void clientTick(TickEvent.ClientTickEvent event){
- if (KeyBindings.map.isPressed() && LocationHandler.getCurrentLocation().getCategory().getMap() != null && SkyblockHud.hasSkyblockScoreboard())
- SkyblockHud.screenToOpen = new MapScreen();
+ GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
+ mc.renderEngine.bindTexture(mapOverlay);
+ Gui.drawModalRectWithCustomSizedTexture(
+ pos.getAbsX(event.resolution, 72),
+ pos.getAbsY(event.resolution, 72),
+ 0,
+ 0,
+ 72,
+ 72,
+ 256,
+ 256
+ );
+ String keyCode = GameSettings.getKeyDisplayString(
+ KeyBindings.map.getKeyCode()
+ );
+ Utils.drawStringCenteredScaled(
+ keyCode,
+ mc.fontRendererObj,
+ pos.getAbsX(event.resolution, 64) + 58,
+ pos.getAbsY(event.resolution, 72) + 66,
+ false,
+ 6,
+ 0xFFFFFF
+ );
+ BlockPos playerPos = mc.thePlayer.getPosition();
+ String position = String.format(
+ "%d/%d/%d",
+ playerPos.getX(),
+ playerPos.getY(),
+ playerPos.getZ()
+ );
+ Utils.drawStringCenteredScaled(
+ position,
+ mc.fontRendererObj,
+ pos.getAbsX(event.resolution, 64) + 29,
+ pos.getAbsY(event.resolution, 72) + 66,
+ false,
+ 36,
+ 0xFFFFFF
+ );
+ GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
+ }
}
+ }
+ @SubscribeEvent
+ public void clientTick(TickEvent.ClientTickEvent event) {
+ if (
+ KeyBindings.map.isPressed() &&
+ LocationHandler.getCurrentLocation().getCategory().getMap() != null &&
+ SkyblockHud.hasSkyblockScoreboard()
+ ) SkyblockHud.screenToOpen = new MapScreen();
+ }
- public static class MapScreen extends GuiScreen {
-
- public MapHandler.Maps map = LocationHandler.getCurrentLocation().getCategory().getMap();
-
- @Override
- public void drawScreen(int mouseX, int mouseY, float partialTicks) {
- GlStateManager.color(1.0f, 1.0f, 1.0f,1.0f);
- this.drawWorldBackground(0);
- this.mc.renderEngine.bindTexture(map.mapTexture);
- float mapX = (width / 2f)-((map.width / 2f) * map.scaleFactor);
- float mapY = (height / 2f)-((map.height / 2f) * map.scaleFactor);
- Gui.drawModalRectWithCustomSizedTexture((int)mapX, (int)mapY, 0,0,(int)(map.width * map.scaleFactor),(int)(map.height * map.scaleFactor), (int)(map.width * map.scaleFactor), (int)(map.height * map.scaleFactor));
- drawIcons((int)mapX, (int)mapY);
- if (this.mc.thePlayer != null && SkyblockHud.config.map.showPlayerLocation){
- int x = this.mc.thePlayer.getPosition().getX() + map.xOffset;
- int z = this.mc.thePlayer.getPosition().getZ() + map.yOffset;
- fontRendererObj.drawString("\u2022", (int)(x * map.scaleFactor + mapX), (int)(z * map.scaleFactor + mapY), 0xff0000);
- }
- GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
- onTooltip(mouseX, mouseY, (int)mapX, (int)mapY);
- }
+ public static class MapScreen extends GuiScreen {
- public void drawIcons(int startX, int startY){
- if (map.icons == null) return;
- for (MapIcon icon : map.icons) {
- if (!icon.canRender()) continue;
- GlStateManager.enableBlend();
- GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
- this.mc.renderEngine.bindTexture(icon.icon);
- float x = ((icon.position.x + map.xOffset) * map.scaleFactor) + startX - 4;
- float y = ((icon.position.y + map.yOffset) * map.scaleFactor) + startY - 4;
- Gui.drawModalRectWithCustomSizedTexture((int)x, (int)y, 0,0,8,8, 8, 8);
- GlStateManager.color(1.0f,1.0f,1.0f,1.0f);
- }
- }
+ public MapHandler.Maps map = LocationHandler
+ .getCurrentLocation()
+ .getCategory()
+ .getMap();
+
+ @Override
+ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
+ GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
+ this.drawWorldBackground(0);
+ this.mc.renderEngine.bindTexture(map.mapTexture);
+ float mapX = (width / 2f) - ((map.width / 2f) * map.scaleFactor);
+ float mapY = (height / 2f) - ((map.height / 2f) * map.scaleFactor);
+ Gui.drawModalRectWithCustomSizedTexture(
+ (int) mapX,
+ (int) mapY,
+ 0,
+ 0,
+ (int) (map.width * map.scaleFactor),
+ (int) (map.height * map.scaleFactor),
+ (int) (map.width * map.scaleFactor),
+ (int) (map.height * map.scaleFactor)
+ );
+ drawIcons((int) mapX, (int) mapY);
+ if (
+ this.mc.thePlayer != null && SkyblockHud.config.map.showPlayerLocation
+ ) {
+ int x = this.mc.thePlayer.getPosition().getX() + map.xOffset;
+ int z = this.mc.thePlayer.getPosition().getZ() + map.yOffset;
+ fontRendererObj.drawString(
+ "\u2022",
+ (int) (x * map.scaleFactor + mapX),
+ (int) (z * map.scaleFactor + mapY),
+ 0xff0000
+ );
+ }
+ GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
+ onTooltip(mouseX, mouseY, (int) mapX, (int) mapY);
+ }
+
+ public void drawIcons(int startX, int startY) {
+ if (map.icons == null) return;
+ for (MapIcon icon : map.icons) {
+ if (!icon.canRender()) continue;
+ GlStateManager.enableBlend();
+ GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
+ this.mc.renderEngine.bindTexture(icon.icon);
+ float x =
+ ((icon.position.x + map.xOffset) * map.scaleFactor) + startX - 4;
+ float y =
+ ((icon.position.y + map.yOffset) * map.scaleFactor) + startY - 4;
+ Gui.drawModalRectWithCustomSizedTexture(
+ (int) x,
+ (int) y,
+ 0,
+ 0,
+ 8,
+ 8,
+ 8,
+ 8
+ );
+ GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
+ }
+ }
- public void onTooltip(int mouseX, int mouseY, int startX, int startY){
- if (map.icons == null) return;
- for (MapIcon icon : map.icons) {
- if (!icon.canRender()) continue;
- if (Utils.inRangeInclusive(mouseX, (int)((icon.position.x + map.xOffset) * map.scaleFactor) + startX - 4, (int)((icon.position.x + map.xOffset) * map.scaleFactor) + startX + 4) &&
- Utils.inRangeInclusive(mouseY, (int)((icon.position.y + map.yOffset) * map.scaleFactor) + startY - 4, (int)((icon.position.y + map.yOffset) * map.scaleFactor) + startY + 4)){
- drawHoveringText(Arrays.asList(icon.tooltip.split("\n")), mouseX, mouseY);
- break;
- }
- }
+ public void onTooltip(int mouseX, int mouseY, int startX, int startY) {
+ if (map.icons == null) return;
+ for (MapIcon icon : map.icons) {
+ if (!icon.canRender()) continue;
+ if (
+ Utils.inRangeInclusive(
+ mouseX,
+ (int) ((icon.position.x + map.xOffset) * map.scaleFactor) +
+ startX -
+ 4,
+ (int) ((icon.position.x + map.xOffset) * map.scaleFactor) +
+ startX +
+ 4
+ ) &&
+ Utils.inRangeInclusive(
+ mouseY,
+ (int) ((icon.position.y + map.yOffset) * map.scaleFactor) +
+ startY -
+ 4,
+ (int) ((icon.position.y + map.yOffset) * map.scaleFactor) +
+ startY +
+ 4
+ )
+ ) {
+ drawHoveringText(
+ Arrays.asList(icon.tooltip.split("\n")),
+ mouseX,
+ mouseY
+ );
+ break;
}
+ }
+ }
- @Override
- protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
- int mapX = (int)((width / 2f)-((map.width / 2f) * map.scaleFactor));
- int mapY = (int)((height / 2f)-((map.height / 2f) * map.scaleFactor));
- for (MapIcon icon : map.icons) {
- if (!icon.canRender()) continue;
- if (Utils.inRangeInclusive(mouseX, (int)((icon.position.x + map.xOffset) * map.scaleFactor) + mapX - 4, (int)((icon.position.x + map.xOffset) * map.scaleFactor) + mapX + 4) &&
- Utils.inRangeInclusive(mouseY, (int)((icon.position.y + map.yOffset) * map.scaleFactor) + mapY - 4, (int)((icon.position.y + map.yOffset) * map.scaleFactor) + mapY + 4)){
- if (!icon.command.isEmpty()){
- this.mc.thePlayer.sendChatMessage("/"+icon.command);
- }
- break;
- }
- }
+ @Override
+ protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
+ int mapX = (int) ((width / 2f) - ((map.width / 2f) * map.scaleFactor));
+ int mapY = (int) ((height / 2f) - ((map.height / 2f) * map.scaleFactor));
+ for (MapIcon icon : map.icons) {
+ if (!icon.canRender()) continue;
+ if (
+ Utils.inRangeInclusive(
+ mouseX,
+ (int) ((icon.position.x + map.xOffset) * map.scaleFactor) +
+ mapX -
+ 4,
+ (int) ((icon.position.x + map.xOffset) * map.scaleFactor) + mapX + 4
+ ) &&
+ Utils.inRangeInclusive(
+ mouseY,
+ (int) ((icon.position.y + map.yOffset) * map.scaleFactor) +
+ mapY -
+ 4,
+ (int) ((icon.position.y + map.yOffset) * map.scaleFactor) + mapY + 4
+ )
+ ) {
+ if (!icon.command.isEmpty()) {
+ this.mc.thePlayer.sendChatMessage("/" + icon.command);
+ }
+ break;
}
+ }
}
+ }
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java
index b34a156..b0ff88e 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java
@@ -3,131 +3,160 @@ package com.thatgravyboat.skyblockhud.handlers;
import com.thatgravyboat.skyblockhud.Utils;
import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent;
import com.thatgravyboat.skyblockhud.api.events.SidebarPostEvent;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-
import java.util.Arrays;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class SlayerHandler {
- //Optional Characters are required because Hypixel dumb and cuts off text
- private static final Pattern COMBAT_XP_REGEX = Pattern.compile("\\(([\\d,]+)/([\\dkm]+)\\) comb?a?t? x?p?");
- private static final Pattern KILLS_REGEX = Pattern.compile("(\\d+)/(\\d+) kills?");
-
- public enum slayerTypes {
-
- ZOMBIE(34, "Revenant Horror"),
- WOLF(42, "Sven Packmaster"),
- SPIDER(50, "Tarantula Broodfather"),
- VOIDGLOOMSERAPH(50, "Voidgloom Seraph"),
- NONE(0,"");
-
- private final String displayName;
- private final int x;
- slayerTypes(int x, String displayName){
- this.displayName = displayName;
- this.x = x;
- }
-
- public String getDisplayName() { return displayName; }
-
- public int getX() { return x; }
+ //Optional Characters are required because Hypixel dumb and cuts off text
+ private static final Pattern COMBAT_XP_REGEX = Pattern.compile(
+ "\\(([\\d,]+)/([\\dkm]+)\\) comb?a?t? x?p?"
+ );
+ private static final Pattern KILLS_REGEX = Pattern.compile(
+ "(\\d+)/(\\d+) kills?"
+ );
+
+ public enum slayerTypes {
+ ZOMBIE(34, "Revenant Horror"),
+ WOLF(42, "Sven Packmaster"),
+ SPIDER(50, "Tarantula Broodfather"),
+ VOIDGLOOMSERAPH(50, "Voidgloom Seraph"),
+ NONE(0, "");
+
+ private final String displayName;
+ private final int x;
+
+ slayerTypes(int x, String displayName) {
+ this.displayName = displayName;
+ this.x = x;
}
- public static slayerTypes currentSlayer = slayerTypes.NONE;
- public static int slayerTier = 0;
- public static boolean isDoingSlayer = false;
- public static int progress = 0;
- public static int maxKills = 0;
- public static boolean bossSlain = false;
- public static boolean isKillingBoss = false;
- public static void clearSlayer(){
- currentSlayer = slayerTypes.NONE;
- isDoingSlayer = false;
- progress = 0;
- maxKills = 0;
- bossSlain = false;
- isKillingBoss = false;
+ public String getDisplayName() {
+ return displayName;
}
- @SubscribeEvent
- public void onSidebarPost(SidebarPostEvent event){
- String arrayString = Arrays.toString(event.arrayScores);
- isDoingSlayer = Arrays.toString(event.arrayScores).contains("Slayer Quest");
- if (isDoingSlayer && (currentSlayer.equals(slayerTypes.NONE) || !arrayString.replace(" ", "").contains(currentSlayer.getDisplayName().replace(" ", "")+Utils.intToRomanNumeral(slayerTier)))) {
- for (int i = 0; i < event.scores.size(); i++) {
- String line = event.scores.get(i);
- if (line.contains("Slayer Quest") && event.scores.size() > 3){
- String slayer = event.scores.get(i - 1).toLowerCase();
- SlayerHandler.slayerTypes selectedSlayer = SlayerHandler.slayerTypes.NONE;
- for (slayerTypes types : slayerTypes.values()){
- if (slayer.contains(types.displayName.toLowerCase(Locale.ENGLISH))) {
- selectedSlayer = types;
- break;
- }
- }
- SlayerHandler.currentSlayer = selectedSlayer;
- SlayerHandler.slayerTier = Utils.whatRomanNumeral(slayer.replace(selectedSlayer.getDisplayName().toLowerCase(), "").replace(" ", ""));
- break;
- }
- }
- }
-
- if (!isDoingSlayer) {
- clearSlayer();
- }
+ public int getX() {
+ return x;
}
-
- @SubscribeEvent
- public void onSidebarLineUpdate(SidebarLineUpdateEvent event){
- if (!isDoingSlayer && event.formattedLine.equals("Slayer Quest")) isDoingSlayer = true;
-
- if (isDoingSlayer){
- String line = event.formattedLine.toLowerCase();
- Matcher killMatcher = KILLS_REGEX.matcher(line);
- Matcher xpMatcher = COMBAT_XP_REGEX.matcher(line);
-
- if (killMatcher.find()){
- SlayerHandler.bossSlain = false;
- SlayerHandler.isKillingBoss = false;
- try {
- progress = Integer.parseInt(killMatcher.group(1));
- } catch (Exception ignored){}
- try {
- maxKills = Integer.parseInt(killMatcher.group(2));
- } catch (Exception ignored){}
- }else if (xpMatcher.find()){
- SlayerHandler.bossSlain = false;
- SlayerHandler.isKillingBoss = false;
- try {
- progress = Integer.parseInt(xpMatcher.group(1));
- } catch (Exception ignored){}
- try {
- maxKills = Integer.parseInt(xpMatcher.group(2).replace("k", "")) * (xpMatcher.group(2).contains("k") ? 1000 : xpMatcher.group(2).contains("m") ? 1000000 : 1);
- } catch (Exception ignored){}
- } else if(line.contains("slay the boss")) {
- SlayerHandler.bossSlain = false;
- SlayerHandler.isKillingBoss = true;
- SlayerHandler.maxKills = 0;
- SlayerHandler.progress = 0;
- }else if (line.contains("boss slain")){
- SlayerHandler.isKillingBoss = false;
- SlayerHandler.maxKills = 0;
- SlayerHandler.progress = 0;
- SlayerHandler.bossSlain = true;
- }
- if (maxKills == 0 && progress == 0){
- SlayerHandler.maxKills = 0;
- SlayerHandler.progress = 0;
+ }
+
+ public static slayerTypes currentSlayer = slayerTypes.NONE;
+ public static int slayerTier = 0;
+ public static boolean isDoingSlayer = false;
+ public static int progress = 0;
+ public static int maxKills = 0;
+ public static boolean bossSlain = false;
+ public static boolean isKillingBoss = false;
+
+ public static void clearSlayer() {
+ currentSlayer = slayerTypes.NONE;
+ isDoingSlayer = false;
+ progress = 0;
+ maxKills = 0;
+ bossSlain = false;
+ isKillingBoss = false;
+ }
+
+ @SubscribeEvent
+ public void onSidebarPost(SidebarPostEvent event) {
+ String arrayString = Arrays.toString(event.arrayScores);
+ isDoingSlayer = Arrays.toString(event.arrayScores).contains("Slayer Quest");
+ if (
+ isDoingSlayer &&
+ (
+ currentSlayer.equals(slayerTypes.NONE) ||
+ !arrayString
+ .replace(" ", "")
+ .contains(
+ currentSlayer.getDisplayName().replace(" ", "") +
+ Utils.intToRomanNumeral(slayerTier)
+ )
+ )
+ ) {
+ for (int i = 0; i < event.scores.size(); i++) {
+ String line = event.scores.get(i);
+ if (line.contains("Slayer Quest") && event.scores.size() > 3) {
+ String slayer = event.scores.get(i - 1).toLowerCase();
+ SlayerHandler.slayerTypes selectedSlayer =
+ SlayerHandler.slayerTypes.NONE;
+ for (slayerTypes types : slayerTypes.values()) {
+ if (
+ slayer.contains(types.displayName.toLowerCase(Locale.ENGLISH))
+ ) {
+ selectedSlayer = types;
+ break;
}
+ }
+ SlayerHandler.currentSlayer = selectedSlayer;
+ SlayerHandler.slayerTier =
+ Utils.whatRomanNumeral(
+ slayer
+ .replace(selectedSlayer.getDisplayName().toLowerCase(), "")
+ .replace(" ", "")
+ );
+ break;
}
+ }
}
-
-
-
-
-
+ if (!isDoingSlayer) {
+ clearSlayer();
+ }
+ }
+
+ @SubscribeEvent
+ public void onSidebarLineUpdate(SidebarLineUpdateEvent event) {
+ if (
+ !isDoingSlayer && event.formattedLine.equals("Slayer Quest")
+ ) isDoingSlayer = true;
+
+ if (isDoingSlayer) {
+ String line = event.formattedLine.toLowerCase();
+ Matcher killMatcher = KILLS_REGEX.matcher(line);
+ Matcher xpMatcher = COMBAT_XP_REGEX.matcher(line);
+
+ if (killMatcher.find()) {
+ SlayerHandler.bossSlain = false;
+ SlayerHandler.isKillingBoss = false;
+ try {
+ progress = Integer.parseInt(killMatcher.group(1));
+ } catch (Exception ignored) {}
+ try {
+ maxKills = Integer.parseInt(killMatcher.group(2));
+ } catch (Exception ignored) {}
+ } else if (xpMatcher.find()) {
+ SlayerHandler.bossSlain = false;
+ SlayerHandler.isKillingBoss = false;
+ try {
+ progress = Integer.parseInt(xpMatcher.group(1));
+ } catch (Exception ignored) {}
+ try {
+ maxKills =
+ Integer.parseInt(xpMatcher.group(2).replace("k", "")) *
+ (
+ xpMatcher.group(2).contains("k")
+ ? 1000
+ : xpMatcher.group(2).contains("m") ? 1000000 : 1
+ );
+ } catch (Exception ignored) {}
+ } else if (line.contains("slay the boss")) {
+ SlayerHandler.bossSlain = false;
+ SlayerHandler.isKillingBoss = true;
+ SlayerHandler.maxKills = 0;
+ SlayerHandler.progress = 0;
+ } else if (line.contains("boss slain")) {
+ SlayerHandler.isKillingBoss = false;
+ SlayerHandler.maxKills = 0;
+ SlayerHandler.progress = 0;
+ SlayerHandler.bossSlain = true;
+ }
+ if (maxKills == 0 && progress == 0) {
+ SlayerHandler.maxKills = 0;
+ SlayerHandler.progress = 0;
+ }
+ }
+ }
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/TimeHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/TimeHandler.java
index 06edf6b..7a66df2 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/TimeHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/TimeHandler.java
@@ -1,29 +1,43 @@
package com.thatgravyboat.skyblockhud.handlers;
import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import org.apache.logging.log4j.LogManager;
-
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Locale;
import java.util.regex.Pattern;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import org.apache.logging.log4j.LogManager;
public class TimeHandler {
- public static long time;
+ public static long time;
- @SubscribeEvent
- public void onSidebarLineUpdate(SidebarLineUpdateEvent event){
- if (Pattern.matches("([0-9]*):([0-9]*)(pm|am)", event.formattedLine.toLowerCase().trim())) {
- boolean isPm = event.formattedLine.toLowerCase().trim().endsWith("pm");
- SimpleDateFormat parseFormat = new SimpleDateFormat("hh:mm a", Locale.CANADA);
- String currentTimeString = event.formattedLine.replace(" ", "").replace(isPm ? "pm" : "am", isPm ? " pm" : " am");
- try {
- time = (parseFormat.parse(currentTimeString).getTime() - parseFormat.parse("00:00 am").getTime()) / 1000L;
- } catch (ParseException ignored) {
- LogManager.getLogger().warn("timeformat error: " + currentTimeString);
- }
- }
+ @SubscribeEvent
+ public void onSidebarLineUpdate(SidebarLineUpdateEvent event) {
+ if (
+ Pattern.matches(
+ "([0-9]*):([0-9]*)(pm|am)",
+ event.formattedLine.toLowerCase().trim()
+ )
+ ) {
+ boolean isPm = event.formattedLine.toLowerCase().trim().endsWith("pm");
+ SimpleDateFormat parseFormat = new SimpleDateFormat(
+ "hh:mm a",
+ Locale.CANADA
+ );
+ String currentTimeString = event.formattedLine
+ .replace(" ", "")
+ .replace(isPm ? "pm" : "am", isPm ? " pm" : " am");
+ try {
+ time =
+ (
+ parseFormat.parse(currentTimeString).getTime() -
+ parseFormat.parse("00:00 am").getTime()
+ ) /
+ 1000L;
+ } catch (ParseException ignored) {
+ LogManager.getLogger().warn("timeformat error: " + currentTimeString);
+ }
}
+ }
}
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 5cd58bc..542846a 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/DwarvenIcons.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/DwarvenIcons.java
@@ -2,95 +2,97 @@ 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 {
- public static List<MapHandler.MapIcon> dwarvenIcons = new ArrayList<>();
-
- static {
- setupNpcIcons();
- setupMiscIcons();
- setupInfoIcons();
- setupShopIcons();
- setupQuestIcons();
- }
+ public static List<MapHandler.MapIcon> dwarvenIcons = new ArrayList<>();
- private static void setupNpcIcons(){
- dwarvenIcons.add(new MapHandler.MapIcon(
- new Vector2f(129, 187),
- new ResourceLocation("skyblockhud", "maps/icons/puzzle.png"),
- new ComponentBuilder()
- .nl("Puzzler", new char[]{'a','l'})
- .nl("Description", 'l')
- .nl("The Puzzler gives you a small puzzle each day to solve and")
- .nl("gives you 1000 mithril powder.")
- .build(),
- MapHandler.MapIconTypes.NPC
- )
- );
- }
+ static {
+ setupNpcIcons();
+ setupMiscIcons();
+ setupInfoIcons();
+ setupShopIcons();
+ setupQuestIcons();
+ }
- private static void setupMiscIcons(){}
+ private static void setupNpcIcons() {
+ dwarvenIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(129, 187),
+ new ResourceLocation("skyblockhud", "maps/icons/puzzle.png"),
+ new ComponentBuilder()
+ .nl("Puzzler", new char[] { 'a', 'l' })
+ .nl("Description", 'l')
+ .nl("The Puzzler gives you a small puzzle each day to solve and")
+ .nl("gives you 1000 mithril powder.")
+ .build(),
+ MapHandler.MapIconTypes.NPC
+ )
+ );
+ }
- private static void setupInfoIcons(){
- dwarvenIcons.add(new MapHandler.MapIcon(
- new Vector2f(129, 187),
- new ResourceLocation("skyblockhud", "maps/icons/crown.png"),
- new ComponentBuilder()
- .nl("King", new char[]{'a','l'})
- .nl("Description", 'l')
- .nl("The King allows you to first start commissions and if you click")
- .nl("each king which change every skyblock day you will get")
- .nl("the King Talisman.")
- .nl()
- .apd("Click to open HOTM", new char[]{'6', 'l'})
- .build(),
- MapHandler.MapIconTypes.INFO,
- "hotm"
- )
- );
- }
+ private static void setupMiscIcons() {}
- private static void setupShopIcons(){
- dwarvenIcons.add(new MapHandler.MapIcon(
- new Vector2f(4, 8),
- new ResourceLocation("skyblockhud", "maps/icons/blacksmith.png"),
- new ComponentBuilder()
- .nl("Forge", new char[]{'a','l'})
- .nl("Description", 'l')
- .nl("The Forge is where you can go craft special items")
- .nl("and fuel your drill.")
- .nl("NPCS", new char[]{'c','l'})
- .nl(" Forger - Allows you to forge special items")
- .nl(" Jotraeline Greatforge - Allows you to refuel your drill.")
- .nl()
- .apd("Click to warp", new char[]{'6', 'l'})
- .build(),
- MapHandler.MapIconTypes.SHOPS,
- "warpforge"
- )
- );
- }
+ private static void setupInfoIcons() {
+ dwarvenIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(129, 187),
+ new ResourceLocation("skyblockhud", "maps/icons/crown.png"),
+ new ComponentBuilder()
+ .nl("King", new char[] { 'a', 'l' })
+ .nl("Description", 'l')
+ .nl("The King allows you to first start commissions and if you click")
+ .nl("each king which change every skyblock day you will get")
+ .nl("the King Talisman.")
+ .nl()
+ .apd("Click to open HOTM", new char[] { '6', 'l' })
+ .build(),
+ MapHandler.MapIconTypes.INFO,
+ "hotm"
+ )
+ );
+ }
- private static void setupQuestIcons(){
- dwarvenIcons.add(new MapHandler.MapIcon(
- new Vector2f(67, 204),
- new ResourceLocation("skyblockhud", "maps/icons/special.png"),
- new ComponentBuilder()
- .nl("Royal Resident", new char[]{'a','l'})
- .nl("The Royal Resident is a quest where you right")
- .nl("click them for a bit to obtain and if you continue")
- .nl("to right click them for about 7 hours it will give")
- .apd("the achievement Royal Conversation.")
- .build(),
- MapHandler.MapIconTypes.QUEST
- )
- );
- }
+ private static void setupShopIcons() {
+ dwarvenIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(4, 8),
+ new ResourceLocation("skyblockhud", "maps/icons/blacksmith.png"),
+ new ComponentBuilder()
+ .nl("Forge", new char[] { 'a', 'l' })
+ .nl("Description", 'l')
+ .nl("The Forge is where you can go craft special items")
+ .nl("and fuel your drill.")
+ .nl("NPCS", new char[] { 'c', 'l' })
+ .nl(" Forger - Allows you to forge special items")
+ .nl(" Jotraeline Greatforge - Allows you to refuel your drill.")
+ .nl()
+ .apd("Click to warp", new char[] { '6', 'l' })
+ .build(),
+ MapHandler.MapIconTypes.SHOPS,
+ "warpforge"
+ )
+ );
+ }
+ private static void setupQuestIcons() {
+ dwarvenIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(67, 204),
+ new ResourceLocation("skyblockhud", "maps/icons/special.png"),
+ new ComponentBuilder()
+ .nl("Royal Resident", new char[] { 'a', 'l' })
+ .nl("The Royal Resident is a quest where you right")
+ .nl("click them for a bit to obtain and if you continue")
+ .nl("to right click them for about 7 hours it will give")
+ .apd("the achievement Royal Conversation.")
+ .build(),
+ MapHandler.MapIconTypes.QUEST
+ )
+ );
+ }
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/HubIcons.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/HubIcons.java
index ad1dbc3..7e510b9 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/HubIcons.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/HubIcons.java
@@ -2,307 +2,325 @@ 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 HubIcons {
- public static List<MapHandler.MapIcon> hubIcons = new ArrayList<>();
+ public static List<MapHandler.MapIcon> hubIcons = new ArrayList<>();
- static {
- setupNpcIcons();
- setupMiscIcons();
- setupInfoIcons();
- setupShopIcons();
- setupQuestIcons();
- }
+ static {
+ setupNpcIcons();
+ setupMiscIcons();
+ setupInfoIcons();
+ setupShopIcons();
+ setupQuestIcons();
+ }
- private static void setupNpcIcons() {
- hubIcons.add(new MapHandler.MapIcon(
- new Vector2f(-2, -34),
- new ResourceLocation("skyblockhud", "maps/icons/special.png"),
- new ComponentBuilder()
- .nl("Event Hut", new char[]{'a','l'})
- .nl("Description", 'l')
- .nl("The Event Hut is where special event npcs")
- .nl("are during some events.")
- .nl("NPCS", new char[]{'c','l'})
- .nl(" Baker - During New Years")
- .nl(" Jerry - While Winter Island is opened")
- .nl(" Fear Mongerer - During Spooky Festival")
- .apd(" Oringo - During Traveling Zoo")
- .build(),
- MapHandler.MapIconTypes.NPC
- )
- );
- hubIcons.add(new MapHandler.MapIcon(
- new Vector2f(135, 142),
- new ResourceLocation("skyblockhud", "maps/icons/fairy.png"),
- new ComponentBuilder()
- .nl("Fairy", new char[]{'a','l'})
- .nl("Description", 'l')
- .nl("The Fairy is where you go when you find fairy souls")
- .apd("to trade them in to get permanent stat upgrades.")
- .build(),
- MapHandler.MapIconTypes.NPC
- )
- );
- }
+ private static void setupNpcIcons() {
+ hubIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(-2, -34),
+ new ResourceLocation("skyblockhud", "maps/icons/special.png"),
+ new ComponentBuilder()
+ .nl("Event Hut", new char[] { 'a', 'l' })
+ .nl("Description", 'l')
+ .nl("The Event Hut is where special event npcs")
+ .nl("are during some events.")
+ .nl("NPCS", new char[] { 'c', 'l' })
+ .nl(" Baker - During New Years")
+ .nl(" Jerry - While Winter Island is opened")
+ .nl(" Fear Mongerer - During Spooky Festival")
+ .apd(" Oringo - During Traveling Zoo")
+ .build(),
+ MapHandler.MapIconTypes.NPC
+ )
+ );
+ hubIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(135, 142),
+ new ResourceLocation("skyblockhud", "maps/icons/fairy.png"),
+ new ComponentBuilder()
+ .nl("Fairy", new char[] { 'a', 'l' })
+ .nl("Description", 'l')
+ .nl("The Fairy is where you go when you find fairy souls")
+ .apd("to trade them in to get permanent stat upgrades.")
+ .build(),
+ MapHandler.MapIconTypes.NPC
+ )
+ );
+ }
- private static void setupShopIcons() {
- hubIcons.add(new MapHandler.MapIcon(
- new Vector2f(-50, -22),
- new ResourceLocation("skyblockhud", "maps/icons/building.png"),
- new ComponentBuilder()
- .nl("Builder's House", new char[]{'a','l'})
- .nl("NPCS", new char[]{'c','l'})
- .nl(" Wool Weaver")
- .nl(" Builder")
- .apd(" Mad Redstone Engineer")
- .build(),
- MapHandler.MapIconTypes.SHOPS
- )
- );
- hubIcons.add(new MapHandler.MapIcon(
- new Vector2f(-78, -46),
- new ResourceLocation("skyblockhud", "maps/icons/bar.png"),
- new ComponentBuilder()
- .nl("Tavern", new char[]{'a','l'})
- .nl("NPCS", new char[]{'c','l'})
- .nl(" Bartender")
- .nl(" Maddox the slayer")
- .nl("Description", 'l')
- .nl("The Tavern is where maddox the slayer is located you can")
- .nl("start slayer quests with them to unlock")
- .apd("new items the more slayer bosses you kill.")
- .build(),
- MapHandler.MapIconTypes.SHOPS
- )
- );
- hubIcons.add(new MapHandler.MapIcon(
- new Vector2f(36, -82),
- new ResourceLocation("skyblockhud", "maps/icons/vet.png"),
- new ComponentBuilder()
- .nl("Vet", new char[]{'a','l'})
- .nl("NPCS", new char[]{'c','l'})
- .nl(" Bea")
- .nl(" Zog")
- .nl(" Kat")
- .nl(" George")
- .nl("Description", 'l')
- .nl("The Vet is where you go to upgrade your pet")
- .nl("at Kat or to buy pet upgrade items from Zog")
- .nl("or trade in your pet at George and if you're")
- .apd("a new player you can buy a bee pet from Bea.")
- .build(),
- MapHandler.MapIconTypes.SHOPS
- )
- );
- hubIcons.add(new MapHandler.MapIcon(
- new Vector2f(58, -73),
- new ResourceLocation("skyblockhud", "maps/icons/fishing_merchant.png"),
- new ComponentBuilder()
- .nl("Fishing Merchant", new char[]{'a','l'})
- .nl("Description", 'l')
- .nl("The Fishing Merchant allows you to buy")
- .nl("fishing related items and he has his friend")
- .nl("joe whose in the house hes setup")
- .apd("in front of who sells sponges.")
- .build(),
- MapHandler.MapIconTypes.SHOPS
- )
- );
- hubIcons.add(new MapHandler.MapIcon(
- new Vector2f(46, -53),
- new ResourceLocation("skyblockhud", "maps/icons/witch.png"),
- new ComponentBuilder()
- .nl("Alchemist", new char[]{'a','l'})
- .nl("Description", 'l')
- .nl("The Alchemist allows you to buy")
- .apd("potion making related items")
- .build(),
- MapHandler.MapIconTypes.SHOPS
- )
- );
- hubIcons.add(new MapHandler.MapIcon(
- new Vector2f(-4, -128),
- new ResourceLocation("skyblockhud", "maps/icons/metal_merchants.png"),
- new ComponentBuilder()
- .nl("Blacksmith Merchants", new char[]{'a','l'})
- .nl("Merchants", new char[]{'c','l'})
- .nl(" Weaponsmith - Weapon Related Items")
- .nl(" Armorsmith - Armor Related Items")
- .apd(" Mine Merchant - Mining Related Items")
- .build(),
- MapHandler.MapIconTypes.SHOPS
- )
- );
- hubIcons.add(new MapHandler.MapIcon(
- new Vector2f(-30, -120),
- new ResourceLocation("skyblockhud", "maps/icons/blacksmith.png"),
- new ComponentBuilder()
- .nl("Blacksmith", new char[]{'a','l'})
- .nl("NPCS", new char[]{'c','l'})
- .nl(" Blacksmith")
- .nl(" Dusk")
- .nl(" Smithmonger")
- .nl("Description", 'l')
- .nl("The Blacksmith lets you reforge your items")
- .nl("while the Smithmonger allows you to buy reforge stones")
- .apd("and Dusk allows you to combine and apply runes.")
- .build(),
- MapHandler.MapIconTypes.SHOPS
- )
- );
- hubIcons.add(new MapHandler.MapIcon(
- new Vector2f(124, 180),
- new ResourceLocation("skyblockhud", "maps/icons/dark_bar.png"),
- new ComponentBuilder()
- .nl("Dark Bar", new char[]{'a','l'})
- .nl("NPCS", new char[]{'c','l'})
- .nl(" Shifty")
- .nl(" Lucius")
- .nl("Description", 'l')
- .nl("The Dark Bar is where you can buy special")
- .nl("brews from Shifty and you can buy special")
- .nl("items from Lucius after buying a certain")
- .apd("amount of items from the Dark Auction.")
- .build(),
- MapHandler.MapIconTypes.SHOPS
- )
- );
- hubIcons.add(new MapHandler.MapIcon(
- new Vector2f(92, 185),
- new ResourceLocation("skyblockhud", "maps/icons/dark_ah.png"),
- new ComponentBuilder()
- .nl("Dark Auction", new char[]{'a','l'})
- .nl("Description", 'l')
- .nl("The Dark Auction allows you to buy")
- .nl("super special items from Sirius the")
- .apd("auctioneer in a special auction.")
- .build(),
- MapHandler.MapIconTypes.SHOPS
- )
- );
- hubIcons.add(new MapHandler.MapIcon(
- new Vector2f(-245, 52),
- new ResourceLocation("skyblockhud", "maps/icons/scroll.png"),
- new ComponentBuilder()
- .nl("Lonely Philosopher", new char[]{'a','l'})
- .nl("Shop", new char[]{'6','l'})
- .nl(" Travel Scroll to Hub Castle")
- .nl()
- .nl(" Cost")
- .nl(" 150,000 Coins", '6')
- .nl()
- .apd(" Requires ")
- .apd("MVP", 'b')
- .apd("+", 'c')
- .build(),
- MapHandler.MapIconTypes.SHOPS
- )
- );
- hubIcons.add(new MapHandler.MapIcon(
- new Vector2f(24, -38),
- new ResourceLocation("skyblockhud", "maps/icons/tux.png"),
- new ComponentBuilder()
- .nl("Fashion Shop", new char[]{'a','l'})
- .nl("NPCS", new char[]{'c','l'})
- .nl(" Wool Weaver")
- .nl(" Builder")
- .apd(" Mad Redstone Engineer")
- .build(),
- MapHandler.MapIconTypes.SHOPS
- )
- );
- }
+ private static void setupShopIcons() {
+ hubIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(-50, -22),
+ new ResourceLocation("skyblockhud", "maps/icons/building.png"),
+ new ComponentBuilder()
+ .nl("Builder's House", new char[] { 'a', 'l' })
+ .nl("NPCS", new char[] { 'c', 'l' })
+ .nl(" Wool Weaver")
+ .nl(" Builder")
+ .apd(" Mad Redstone Engineer")
+ .build(),
+ MapHandler.MapIconTypes.SHOPS
+ )
+ );
+ hubIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(-78, -46),
+ new ResourceLocation("skyblockhud", "maps/icons/bar.png"),
+ new ComponentBuilder()
+ .nl("Tavern", new char[] { 'a', 'l' })
+ .nl("NPCS", new char[] { 'c', 'l' })
+ .nl(" Bartender")
+ .nl(" Maddox the slayer")
+ .nl("Description", 'l')
+ .nl("The Tavern is where maddox the slayer is located you can")
+ .nl("start slayer quests with them to unlock")
+ .apd("new items the more slayer bosses you kill.")
+ .build(),
+ MapHandler.MapIconTypes.SHOPS
+ )
+ );
+ hubIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(36, -82),
+ new ResourceLocation("skyblockhud", "maps/icons/vet.png"),
+ new ComponentBuilder()
+ .nl("Vet", new char[] { 'a', 'l' })
+ .nl("NPCS", new char[] { 'c', 'l' })
+ .nl(" Bea")
+ .nl(" Zog")
+ .nl(" Kat")
+ .nl(" George")
+ .nl("Description", 'l')
+ .nl("The Vet is where you go to upgrade your pet")
+ .nl("at Kat or to buy pet upgrade items from Zog")
+ .nl("or trade in your pet at George and if you're")
+ .apd("a new player you can buy a bee pet from Bea.")
+ .build(),
+ MapHandler.MapIconTypes.SHOPS
+ )
+ );
+ hubIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(58, -73),
+ new ResourceLocation("skyblockhud", "maps/icons/fishing_merchant.png"),
+ new ComponentBuilder()
+ .nl("Fishing Merchant", new char[] { 'a', 'l' })
+ .nl("Description", 'l')
+ .nl("The Fishing Merchant allows you to buy")
+ .nl("fishing related items and he has his friend")
+ .nl("joe whose in the house hes setup")
+ .apd("in front of who sells sponges.")
+ .build(),
+ MapHandler.MapIconTypes.SHOPS
+ )
+ );
+ hubIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(46, -53),
+ new ResourceLocation("skyblockhud", "maps/icons/witch.png"),
+ new ComponentBuilder()
+ .nl("Alchemist", new char[] { 'a', 'l' })
+ .nl("Description", 'l')
+ .nl("The Alchemist allows you to buy")
+ .apd("potion making related items")
+ .build(),
+ MapHandler.MapIconTypes.SHOPS
+ )
+ );
+ hubIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(-4, -128),
+ new ResourceLocation("skyblockhud", "maps/icons/metal_merchants.png"),
+ new ComponentBuilder()
+ .nl("Blacksmith Merchants", new char[] { 'a', 'l' })
+ .nl("Merchants", new char[] { 'c', 'l' })
+ .nl(" Weaponsmith - Weapon Related Items")
+ .nl(" Armorsmith - Armor Related Items")
+ .apd(" Mine Merchant - Mining Related Items")
+ .build(),
+ MapHandler.MapIconTypes.SHOPS
+ )
+ );
+ hubIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(-30, -120),
+ new ResourceLocation("skyblockhud", "maps/icons/blacksmith.png"),
+ new ComponentBuilder()
+ .nl("Blacksmith", new char[] { 'a', 'l' })
+ .nl("NPCS", new char[] { 'c', 'l' })
+ .nl(" Blacksmith")
+ .nl(" Dusk")
+ .nl(" Smithmonger")
+ .nl("Description", 'l')
+ .nl("The Blacksmith lets you reforge your items")
+ .nl("while the Smithmonger allows you to buy reforge stones")
+ .apd("and Dusk allows you to combine and apply runes.")
+ .build(),
+ MapHandler.MapIconTypes.SHOPS
+ )
+ );
+ hubIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(124, 180),
+ new ResourceLocation("skyblockhud", "maps/icons/dark_bar.png"),
+ new ComponentBuilder()
+ .nl("Dark Bar", new char[] { 'a', 'l' })
+ .nl("NPCS", new char[] { 'c', 'l' })
+ .nl(" Shifty")
+ .nl(" Lucius")
+ .nl("Description", 'l')
+ .nl("The Dark Bar is where you can buy special")
+ .nl("brews from Shifty and you can buy special")
+ .nl("items from Lucius after buying a certain")
+ .apd("amount of items from the Dark Auction.")
+ .build(),
+ MapHandler.MapIconTypes.SHOPS
+ )
+ );
+ hubIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(92, 185),
+ new ResourceLocation("skyblockhud", "maps/icons/dark_ah.png"),
+ new ComponentBuilder()
+ .nl("Dark Auction", new char[] { 'a', 'l' })
+ .nl("Description", 'l')
+ .nl("The Dark Auction allows you to buy")
+ .nl("super special items from Sirius the")
+ .apd("auctioneer in a special auction.")
+ .build(),
+ MapHandler.MapIconTypes.SHOPS
+ )
+ );
+ hubIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(-245, 52),
+ new ResourceLocation("skyblockhud", "maps/icons/scroll.png"),
+ new ComponentBuilder()
+ .nl("Lonely Philosopher", new char[] { 'a', 'l' })
+ .nl("Shop", new char[] { '6', 'l' })
+ .nl(" Travel Scroll to Hub Castle")
+ .nl()
+ .nl(" Cost")
+ .nl(" 150,000 Coins", '6')
+ .nl()
+ .apd(" Requires ")
+ .apd("MVP", 'b')
+ .apd("+", 'c')
+ .build(),
+ MapHandler.MapIconTypes.SHOPS
+ )
+ );
+ hubIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(24, -38),
+ new ResourceLocation("skyblockhud", "maps/icons/tux.png"),
+ new ComponentBuilder()
+ .nl("Fashion Shop", new char[] { 'a', 'l' })
+ .nl("NPCS", new char[] { 'c', 'l' })
+ .nl(" Wool Weaver")
+ .nl(" Builder")
+ .apd(" Mad Redstone Engineer")
+ .build(),
+ MapHandler.MapIconTypes.SHOPS
+ )
+ );
+ }
- private static void setupMiscIcons() {
- hubIcons.add(new MapHandler.MapIcon(
- new Vector2f(-24, -53),
- new ResourceLocation("skyblockhud", "maps/icons/bank.png"),
- new ComponentBuilder()
- .nl("Bank", new char[]{'a','l'})
- .nl("Description", 'l')
- .nl("The Bank is where you can store your money on skyblock")
- .apd("you can also store some items in the vault.")
- .build(),
- MapHandler.MapIconTypes.MISC
- )
- );
- hubIcons.add(new MapHandler.MapIcon(
- new Vector2f(-26, -80),
- new ResourceLocation("skyblockhud", "maps/icons/ah.png"),
- new ComponentBuilder()
- .nl("Auction House", new char[]{'a','l'})
- .nl("Description", 'l')
- .nl("The Auction House is where you can auction off your")
- .apd("precious items in skyblock to make a profit.")
- .build(),
- MapHandler.MapIconTypes.MISC
- )
- );
- hubIcons.add(new MapHandler.MapIcon(
- new Vector2f(-38, -66),
- new ResourceLocation("skyblockhud", "maps/icons/bazaar.png"),
- new ComponentBuilder()
- .nl("Bazaar", new char[]{'a','l'})
- .nl("Description", 'l')
- .nl("The Bazaar is where you can sell specific items")
- .nl("on a sort of stock market and request and")
- .apd("sell items at a specific price.")
- .build(),
- MapHandler.MapIconTypes.MISC
- )
- );
- }
+ private static void setupMiscIcons() {
+ hubIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(-24, -53),
+ new ResourceLocation("skyblockhud", "maps/icons/bank.png"),
+ new ComponentBuilder()
+ .nl("Bank", new char[] { 'a', 'l' })
+ .nl("Description", 'l')
+ .nl("The Bank is where you can store your money on skyblock")
+ .apd("you can also store some items in the vault.")
+ .build(),
+ MapHandler.MapIconTypes.MISC
+ )
+ );
+ hubIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(-26, -80),
+ new ResourceLocation("skyblockhud", "maps/icons/ah.png"),
+ new ComponentBuilder()
+ .nl("Auction House", new char[] { 'a', 'l' })
+ .nl("Description", 'l')
+ .nl("The Auction House is where you can auction off your")
+ .apd("precious items in skyblock to make a profit.")
+ .build(),
+ MapHandler.MapIconTypes.MISC
+ )
+ );
+ hubIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(-38, -66),
+ new ResourceLocation("skyblockhud", "maps/icons/bazaar.png"),
+ new ComponentBuilder()
+ .nl("Bazaar", new char[] { 'a', 'l' })
+ .nl("Description", 'l')
+ .nl("The Bazaar is where you can sell specific items")
+ .nl("on a sort of stock market and request and")
+ .apd("sell items at a specific price.")
+ .build(),
+ MapHandler.MapIconTypes.MISC
+ )
+ );
+ }
- private static void setupInfoIcons() {
- hubIcons.add(new MapHandler.MapIcon(
- new Vector2f(8, -95),
- new ResourceLocation("skyblockhud", "maps/icons/community.png"),
- new ComponentBuilder()
- .nl("Community Center", new char[]{'a','l'})
- .nl("Description", 'l')
- .nl("The Community Center is where you can vote")
- .nl("for your favorite election candidate,")
- .nl("access the community shop, upgrade your")
- .apd("account, and help with city projects.")
- .build(),
- MapHandler.MapIconTypes.INFO
- )
- );
- hubIcons.add(new MapHandler.MapIcon(
- new Vector2f(150, 45),
- new ResourceLocation("skyblockhud", "maps/icons/fishing.png"),
- new ComponentBuilder()
- .nl("Fisherman's Hut", new char[]{'a','l'})
- .nl("Description", 'l')
- .nl("This is a spot where people regularly")
- .nl("do their fishing, this is one")
- .apd("of many spots.")
- .build(),
- MapHandler.MapIconTypes.INFO
- )
- );
- }
+ private static void setupInfoIcons() {
+ hubIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(8, -95),
+ new ResourceLocation("skyblockhud", "maps/icons/community.png"),
+ new ComponentBuilder()
+ .nl("Community Center", new char[] { 'a', 'l' })
+ .nl("Description", 'l')
+ .nl("The Community Center is where you can vote")
+ .nl("for your favorite election candidate,")
+ .nl("access the community shop, upgrade your")
+ .apd("account, and help with city projects.")
+ .build(),
+ MapHandler.MapIconTypes.INFO
+ )
+ );
+ hubIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(150, 45),
+ new ResourceLocation("skyblockhud", "maps/icons/fishing.png"),
+ new ComponentBuilder()
+ .nl("Fisherman's Hut", new char[] { 'a', 'l' })
+ .nl("Description", 'l')
+ .nl("This is a spot where people regularly")
+ .nl("do their fishing, this is one")
+ .apd("of many spots.")
+ .build(),
+ MapHandler.MapIconTypes.INFO
+ )
+ );
+ }
- private static void setupQuestIcons() {
- hubIcons.add(new MapHandler.MapIcon(
- new Vector2f(-8, -10),
- new ResourceLocation("skyblockhud", "maps/icons/painter.png"),
- new ComponentBuilder()
- .nl("Marco", new char[]{'a','l'})
- .nl("Description", 'l')
- .nl("Marco is an NPC that has no other uses")
- .nl("besides giving you a spray can for")
- .apd("completing a quest.")
- .build(),
- MapHandler.MapIconTypes.QUEST
- )
- );
- }
+ private static void setupQuestIcons() {
+ hubIcons.add(
+ new MapHandler.MapIcon(
+ new Vector2f(-8, -10),
+ new ResourceLocation("skyblockhud", "maps/icons/painter.png"),
+ new ComponentBuilder()
+ .nl("Marco", new char[] { 'a', 'l' })
+ .nl("Description", 'l')
+ .nl("Marco is an NPC that has no other uses")
+ .nl("besides giving you a spray can for")
+ .apd("completing a quest.")
+ .build(),
+ MapHandler.MapIconTypes.QUEST
+ )
+ );
+ }
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeHelper.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeHelper.java
index afff109..158222c 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeHelper.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeHelper.java
@@ -8,14 +8,28 @@ import net.minecraft.init.Blocks;
public class EntityTypeHelper {
- public static boolean isZealot(Entity entity) {
- if (entity instanceof EntityEnderman) {
- EntityEnderman enderman = ((EntityEnderman) entity);
- double maxHealthBase = enderman.getAttributeMap().getAttributeInstanceByName("generic.maxHealth").getBaseValue();
- if (maxHealthBase == 13000d || (maxHealthBase == 2000d && enderman.getHeldBlockState().getBlock().equals(Blocks.end_portal_frame))) {
- return LocationHandler.getCurrentLocation().equals(Locations.DRAGONSNEST);
- }
- }
- return false;
+ public static boolean isZealot(Entity entity) {
+ if (entity instanceof EntityEnderman) {
+ EntityEnderman enderman = ((EntityEnderman) entity);
+ double maxHealthBase = enderman
+ .getAttributeMap()
+ .getAttributeInstanceByName("generic.maxHealth")
+ .getBaseValue();
+ if (
+ maxHealthBase == 13000d ||
+ (
+ maxHealthBase == 2000d &&
+ enderman
+ .getHeldBlockState()
+ .getBlock()
+ .equals(Blocks.end_portal_frame)
+ )
+ ) {
+ return LocationHandler
+ .getCurrentLocation()
+ .equals(Locations.DRAGONSNEST);
+ }
}
+ return false;
+ }
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeRegistry.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeRegistry.java
index d45fa1f..254f61e 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeRegistry.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeRegistry.java
@@ -2,24 +2,27 @@ package com.thatgravyboat.skyblockhud.handlers.sbentities;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Maps;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.monster.EntityEnderman;
-
import java.util.List;
import java.util.Map;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.monster.EntityEnderman;
public class EntityTypeRegistry {
- private static final Map<Class<? extends Entity>, List<SkyBlockEntity>> entities = Maps.newHashMap();
-
- static {
- entities.put(EntityEnderman.class, ImmutableList.of(SkyBlockEntity.of("zealot", EntityTypeHelper::isZealot)));
- }
+ private static final Map<Class<? extends Entity>, List<SkyBlockEntity>> entities = Maps.newHashMap();
- public static String getEntityId(Entity entity){
- if (!entities.containsKey(entity.getClass())) return null;
- for (SkyBlockEntity skyBlockEntity : entities.get(entity.getClass())) if (skyBlockEntity.isEntity(entity)) return skyBlockEntity.getName();
- return null;
- }
+ static {
+ entities.put(
+ EntityEnderman.class,
+ ImmutableList.of(SkyBlockEntity.of("zealot", EntityTypeHelper::isZealot))
+ );
+ }
+ public static String getEntityId(Entity entity) {
+ if (!entities.containsKey(entity.getClass())) return null;
+ for (SkyBlockEntity skyBlockEntity : entities.get(entity.getClass())) if (
+ skyBlockEntity.isEntity(entity)
+ ) return skyBlockEntity.getName();
+ return null;
+ }
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/SkyBlockEntity.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/SkyBlockEntity.java
index ca10b53..23a56e5 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/SkyBlockEntity.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/SkyBlockEntity.java
@@ -1,26 +1,27 @@
package com.thatgravyboat.skyblockhud.handlers.sbentities;
-import net.minecraft.entity.Entity;
-
import java.util.function.Predicate;
+import net.minecraft.entity.Entity;
public class SkyBlockEntity {
- private final String name;
- private final Predicate<Entity> predicate;
+ private final String name;
+ private final Predicate<Entity> predicate;
- public static SkyBlockEntity of(String name, Predicate<Entity> predicate){
- return new SkyBlockEntity(name, predicate);
- }
+ public static SkyBlockEntity of(String name, Predicate<Entity> predicate) {
+ return new SkyBlockEntity(name, predicate);
+ }
- private SkyBlockEntity(String name, Predicate<Entity> predicate){
- this.name = name;
- this.predicate = predicate;
- }
+ private SkyBlockEntity(String name, Predicate<Entity> predicate) {
+ this.name = name;
+ this.predicate = predicate;
+ }
- public String getName(){ return name; }
+ public String getName() {
+ return name;
+ }
- public boolean isEntity(Entity entity) {
- return predicate.test(entity);
- }
+ public boolean isEntity(Entity entity) {
+ return predicate.test(entity);
+ }
}