aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat/skyblockhud/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/handlers')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java4
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java62
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java15
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java5
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeHelper.java21
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeRegistry.java23
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/SkyBlockEntity.java27
7 files changed, 31 insertions, 126 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java
index b2a148d..7cc6061 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java
@@ -2,7 +2,7 @@ package com.thatgravyboat.skyblockhud.handlers;
import com.thatgravyboat.skyblockhud.SkyblockHud;
import com.thatgravyboat.skyblockhud.Utils;
-import com.thatgravyboat.skyblockhud.location.DwarvenMineHandler;
+import com.thatgravyboat.skyblockhud.location.MinesHandler;
import com.thatgravyboat.skyblockhud.location.LocationHandler;
import com.thatgravyboat.skyblockhud.location.Locations;
import net.minecraft.entity.boss.BossStatus;
@@ -22,7 +22,7 @@ public class BossbarHandler {
bossBarRendered = false;
}
String bossName = Utils.removeColor(BossStatus.bossName);
- if (SkyblockHud.config.renderer.hideBossBar && DwarvenMineHandler.currentEvent == DwarvenMineHandler.Event.NONE && !LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) {
+ if (SkyblockHud.config.renderer.hideBossBar && MinesHandler.currentEvent == MinesHandler.Event.NONE && !LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) {
if (bossName.equalsIgnoreCase("wither")) {
event.setCanceled(true);
bossBarRendered = false;
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java
index da27590..c44c8bc 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java
@@ -1,58 +1,32 @@
package com.thatgravyboat.skyblockhud.handlers;
-import com.thatgravyboat.skyblockhud.Utils;
-import com.thatgravyboat.skyblockhud.overlay.GenericOverlays;
-import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.nbt.NBTTagList;
-import net.minecraftforge.client.event.RenderGameOverlayEvent;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
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);
- }
+ private static final Pattern MANA_COST_REGEX = Pattern.compile("Mana Cost: \u00A73([0-9]+)");
- public boolean isDrill(ItemStack stack) {
+ public static boolean hasManaCost(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 "";
+ if (!stack.hasTagCompound()) return false;
+ if (!stack.getTagCompound().hasKey("display")) return false;
+ if (!stack.getTagCompound().getCompoundTag("display").hasKey("Lore")) return false;
+ String lore = stack.getTagCompound().getCompoundTag("display").getTagList("Lore", 8).toString();
+ return MANA_COST_REGEX.matcher(lore).find();
}
- @SubscribeEvent
- public void drawOverlay(RenderGameOverlayEvent.Post event) {
- /*
- if (Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard())){
- Minecraft mc = Minecraft.getMinecraft();
- ItemStack stack = mc.thePlayer.getHeldItem();
- if (isDrill(stack)){
- try {
- String drill = getDrillFuel(stack).replace("Fuel:", "").trim();
- String[] fuel = drill.split("/");
- if (fuel.length == 2) {
- int current = Integer.parseInt(fuel[0].replace(",", ""));
- int max = Integer.parseInt(fuel[1].replace("k", "")) * 1000;
- drawFuelBar(mc, current, max);
- }
- }catch (Exception ignored){}
- }
+ public static int getManaCost(ItemStack stack){
+ String lore = stack.getTagCompound().getCompoundTag("display").getTagList("Lore", 8).toString();
+ Matcher matcher = MANA_COST_REGEX.matcher(lore);
+ if (matcher.find()){
+ try {
+ return Integer.parseInt(matcher.group(1));
+ }catch (Exception ignored){}
}
- */
+ return 0;
}
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java
index b7b232f..4491e9d 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java
@@ -1,7 +1,5 @@
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;
@@ -10,10 +8,6 @@ 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;
@@ -26,6 +20,13 @@ 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;
+
+import static com.thatgravyboat.skyblockhud.GuiTextures.mapOverlay;
+
public class MapHandler {
public enum MapIconTypes {
@@ -69,7 +70,7 @@ public class MapHandler {
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());
+ PARK(1f, 211, 230, 480, 133, 478, 134, new ResourceLocation("skyblockhud", "maps/park.png"), Collections.emptyList());
public float scaleFactor;
public int width;
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java
index fbb95eb..dcdc10e 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java
@@ -3,11 +3,12 @@ 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 {
@@ -19,7 +20,7 @@ public class SlayerHandler {
ZOMBIE(34, "Revenant Horror"),
WOLF(42, "Sven Packmaster"),
SPIDER(50, "Tarantula Broodfather"),
- VOIDGLOOMSERAPH(50, "Voidgloom Seraph"),
+ VOIDGLOOMSERAPH(58, "Voidgloom Seraph"),
NONE(0, "");
private final String displayName;
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeHelper.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeHelper.java
deleted file mode 100644
index afff109..0000000
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeHelper.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.thatgravyboat.skyblockhud.handlers.sbentities;
-
-import com.thatgravyboat.skyblockhud.location.LocationHandler;
-import com.thatgravyboat.skyblockhud.location.Locations;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.monster.EntityEnderman;
-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;
- }
-}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeRegistry.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeRegistry.java
deleted file mode 100644
index 40076d9..0000000
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeRegistry.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.thatgravyboat.skyblockhud.handlers.sbentities;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Maps;
-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)));
- }
-
- 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
deleted file mode 100644
index ee8c3a7..0000000
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/SkyBlockEntity.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.thatgravyboat.skyblockhud.handlers.sbentities;
-
-import java.util.function.Predicate;
-import net.minecraft.entity.Entity;
-
-public class SkyBlockEntity {
-
- private final String name;
- private final Predicate<Entity> 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;
- }
-
- public String getName() {
- return name;
- }
-
- public boolean isEntity(Entity entity) {
- return predicate.test(entity);
- }
-}