aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorThatGravyBoat <thatgravyboat@gmail.com>2021-09-27 14:17:41 -0230
committerThatGravyBoat <thatgravyboat@gmail.com>2021-09-27 14:17:41 -0230
commitf1fd06d889162ac72395ef66043970cfe42cde5e (patch)
tree1e306d5817eac77ac44ef59085120882f8824d7a /src/main/java/com
parent7809a1362c9644c9bfb69d8563a13e3f1ed3354a (diff)
downloadSkyblockHud-Death-Defied-f1fd06d889162ac72395ef66043970cfe42cde5e.tar.gz
SkyblockHud-Death-Defied-f1fd06d889162ac72395ef66043970cfe42cde5e.tar.bz2
SkyblockHud-Death-Defied-f1fd06d889162ac72395ef66043970cfe42cde5e.zip
I dont even know when I coded this.
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java5
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java5
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java3
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/CooldownHandler.java38
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/CurrencyHandler.java4
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/NpcDialogue.java42
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java35
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinRenderItem.java21
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/overlay/DungeonOverlay.java5
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java44
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java2
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerObject.java5
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/utils/Utils.java8
13 files changed, 167 insertions, 50 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java b/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java
index 2312910..ca73b66 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java
@@ -2,6 +2,7 @@ package com.thatgravyboat.skyblockhud.api;
import static com.thatgravyboat.skyblockhud.ComponentHandler.SCOREBOARD_CHARACTERS;
+import com.thatgravyboat.skyblockhud.SkyblockHud;
import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent;
import com.thatgravyboat.skyblockhud.api.events.SidebarPostEvent;
import com.thatgravyboat.skyblockhud.api.events.SidebarPreGetEvent;
@@ -35,13 +36,13 @@ public class LeaderboardGetter {
if (ticks % 5 != 0) return;
Minecraft mc = Minecraft.getMinecraft();
- if (mc.theWorld != null) {
+ if (mc.theWorld != null && SkyblockHud.hasSkyblockScoreboard()) {
Scoreboard scoreboard = mc.theWorld.getScoreboard();
ScoreObjective sidebarObjective = scoreboard.getObjectiveInDisplaySlot(1);
if (sidebarObjective != null && !MinecraftForge.EVENT_BUS.post(new SidebarPreGetEvent(scoreboard, sidebarObjective))) {
Collection<Score> scoreList = sidebarObjective.getScoreboard().getSortedScores(sidebarObjective);
- Map<Integer, String> scores = scoreList.stream().collect(Collectors.toMap(Score::getScorePoints, this::getLine));
+ Map<Integer, String> scores = scoreList.stream().collect(Collectors.toMap(Score::getScorePoints, this::getLine, (s1, s2) -> s1));
if (!cachedScores.equals(scores)) {
scores.forEach(
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java
index cd67f78..8793fb8 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java
@@ -131,6 +131,11 @@ public class SBHConfig extends Config {
public static class MainHud {
@Expose
+ @ConfigOption(name = "Disable Main Hud", desc = "IDK Why you would do this as its like half the mod but ok.")
+ @ConfigEditorBoolean
+ public boolean disaleMainHud = false;
+
+ @Expose
@ConfigOption(name = "Main Hud Position", desc = "")
@ConfigEditorButton(runnableId = "main", buttonText = "Edit")
public Position mainHudPos = new Position(0, 1, true, false);
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java
index 1467b48..d605d81 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java
@@ -3,7 +3,6 @@ package com.thatgravyboat.skyblockhud.handlers;
import com.thatgravyboat.skyblockhud.SkyblockHud;
import com.thatgravyboat.skyblockhud.location.LocationHandler;
import com.thatgravyboat.skyblockhud.location.Locations;
-import com.thatgravyboat.skyblockhud.location.MinesHandler;
import com.thatgravyboat.skyblockhud.utils.Utils;
import net.minecraft.entity.boss.BossStatus;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
@@ -22,7 +21,7 @@ public class BossbarHandler {
bossBarRendered = false;
}
String bossName = Utils.removeColor(BossStatus.bossName);
- if (SkyblockHud.config.renderer.hideBossBar && MinesHandler.currentEvent == MinesHandler.Event.NONE && !LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) {
+ if (SkyblockHud.config.renderer.hideBossBar && !LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) {
if (bossName.equalsIgnoreCase("wither")) {
event.setCanceled(true);
bossBarRendered = false;
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CooldownHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CooldownHandler.java
index d7d3a41..8704bdb 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CooldownHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CooldownHandler.java
@@ -1,17 +1,19 @@
package com.thatgravyboat.skyblockhud.handlers;
+import com.google.common.collect.Sets;
import com.thatgravyboat.skyblockhud.SkyblockHud;
import com.thatgravyboat.skyblockhud.api.item.IAbility;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import com.thatgravyboat.skyblockhud.utils.Utils;
+import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
+import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
@@ -21,6 +23,9 @@ public class CooldownHandler {
private static final Map<String, Cooldown> COOLDOWNS = new HashMap<>();
+ private static final Set<String> CUSTOM_HANDLED_COOLDOWNS = Sets.newHashSet("Mining Speed Boost");
+
+
public static Matcher getAbility(NBTTagCompound nbt) {
if (nbt != null && nbt.hasKey("ExtraAttributes") && nbt.getCompoundTag("ExtraAttributes").hasKey("uuid") && nbt.hasKey("display")){
NBTTagCompound display = nbt.getCompoundTag("display");
@@ -40,8 +45,27 @@ public class CooldownHandler {
return null;
}
- private static void addCooldown(IAbility ability) {
- COOLDOWNS.putIfAbsent(ability.getAbility(), new Cooldown(ability.getAbilityTime()*20));
+ private static void addCooldown(String id, int time) {
+ COOLDOWNS.putIfAbsent(id, new Cooldown(time*20));
+ }
+
+ private static void addCooldown(IAbility ability, boolean isForced) {
+ if (isForced || !CUSTOM_HANDLED_COOLDOWNS.contains(ability.getAbility())) {
+ addCooldown(ability.getAbility(), ability.getAbilityTime());
+ }
+ }
+
+ @SubscribeEvent(priority = EventPriority.HIGHEST)
+ public void onChat(ClientChatReceivedEvent event){
+ String message = Utils.removeColor(event.message.getUnformattedText());
+ if (event.type != 2 && message.equals("You used your Mining Speed Boost Pickaxe Ability!")){
+ if (Minecraft.getMinecraft().thePlayer.getHeldItem() != null) {
+ IAbility ability = (IAbility) (Object) Minecraft.getMinecraft().thePlayer.getHeldItem();
+ if (ability.getAbility().equals("Mining Speed Boost")) {
+ addCooldown("Mining Speed Boost", ability.getAbilityTime());
+ }
+ }
+ }
}
@SubscribeEvent
@@ -60,7 +84,7 @@ public class CooldownHandler {
if (event.entityPlayer.getHeldItem() != null) {
IAbility ability = (IAbility)((Object) event.entityPlayer.getHeldItem());
if (ability.getAbility() != null) {
- addCooldown(ability);
+ addCooldown(ability, false);
}
}
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CurrencyHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CurrencyHandler.java
index 482dbe1..7bbfaa0 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CurrencyHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CurrencyHandler.java
@@ -51,7 +51,7 @@ public class CurrencyHandler {
public static String getCoinsFormatted() {
DecimalFormat formatter = new DecimalFormat("#,###.0", DecimalFormatSymbols.getInstance(Locale.CANADA));
- String output = formatter.format(coins);
+ String output = formatter.format(getCoins());
if (output.equals(".0")) output = "0.0"; else if (output.equals(",0")) output = "0,0";
return output;
}
@@ -59,7 +59,7 @@ public class CurrencyHandler {
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);
+ return getBits() > 999 ? formatter.format((double) getBits() / 1000) + "k" : String.valueOf(getBits());
}
public static void checkCoins(String formatedScoreboardLine) {
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/NpcDialogue.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/NpcDialogue.java
index 1e67034..a1764bd 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/NpcDialogue.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/NpcDialogue.java
@@ -23,6 +23,7 @@ import net.minecraft.client.resources.IResourceManagerReloadListener;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
+import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
@@ -36,9 +37,8 @@ public class NpcDialogue implements IResourceManagerReloadListener {
private static boolean showDialogue = false;
private static int ticks = 0;
- private static final Queue<String> DIALOGUE = new ArrayDeque<>();
- private static String currentNpc = "Unknown";
- private static String currentDialogue = null;
+ private static final Queue<Dialogue> DIALOGUE = new ArrayDeque<>();
+ private static Dialogue currentDialogue = null;
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {
@@ -50,12 +50,11 @@ public class NpcDialogue implements IResourceManagerReloadListener {
if (currentDialogue == null) {
showDialogue = false;
- currentNpc = "Unknown";
}
}
}
- @SubscribeEvent
+ @SubscribeEvent(priority = EventPriority.LOWEST)
public void onChat(ClientChatReceivedEvent event) {
if (event.type != 2 && !SkyblockHud.config.misc.hideDialogueBox) {
String message = Utils.removeColor(event.message.getUnformattedText());
@@ -64,12 +63,10 @@ public class NpcDialogue implements IResourceManagerReloadListener {
if (matcher.find()) {
showDialogue = true;
event.setCanceled(true);
- currentNpc = matcher.group(1);
- if (currentDialogue != null) {
- DIALOGUE.add(matcher.group(2));
- } else {
- currentDialogue = matcher.group(2);
- }
+
+ Dialogue dialogue = new Dialogue(matcher.group(1), matcher.group(2));
+ if (currentDialogue == null) currentDialogue = dialogue;
+ else DIALOGUE.add(dialogue);
}
}
}
@@ -87,7 +84,7 @@ public class NpcDialogue implements IResourceManagerReloadListener {
Gui.drawModalRectWithCustomSizedTexture(x, y, 0, 0, 182, 68, 256, 256);
- String npcID = currentNpc.toLowerCase(Locale.ENGLISH).replace(" ", "_");
+ String npcID = currentDialogue.name.toLowerCase(Locale.ENGLISH).replace(" ", "_");
if (NPCS.containsKey(npcID)) {
mc.renderEngine.bindTexture(NPCS.get(npcID));
@@ -96,12 +93,10 @@ public class NpcDialogue implements IResourceManagerReloadListener {
FontRenderer font = mc.fontRendererObj;
- font.drawString(currentNpc, x + 40, y + 10, 0xffffff);
-
- List<String> text = font.listFormattedStringToWidth(currentDialogue, 160);
+ font.drawString(currentDialogue.name, x + 40, y + 10, 0xffffff);
- for (int i = 0; i < text.size(); i++) {
- Utils.drawStringScaled(text.get(i), font, x + 40, y + 10 + font.FONT_HEIGHT + 6 + (i * font.FONT_HEIGHT + 3), false, 0xffffff, 0.75f);
+ for (int i = 0; i < currentDialogue.dialogue.size(); i++) {
+ Utils.drawStringScaled(currentDialogue.dialogue.get(i), font, x + 40, y + 10 + font.FONT_HEIGHT + 6 + (i * font.FONT_HEIGHT + 3), false, 0xffffff, 0.75f);
}
}
}
@@ -123,4 +118,17 @@ public class NpcDialogue implements IResourceManagerReloadListener {
}
} catch (Exception ignored) {}
}
+
+
+ static class Dialogue {
+
+ public List<String> dialogue;
+ public String name;
+
+ public Dialogue(String name, String dialogue) {
+ this.dialogue = Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(dialogue, 160);
+ this.name = name;
+ }
+
+ }
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java
index dd6adb2..e7dacd4 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java
@@ -3,11 +3,15 @@ package com.thatgravyboat.skyblockhud.location;
import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent;
import com.thatgravyboat.skyblockhud.api.events.SidebarPostEvent;
import com.thatgravyboat.skyblockhud.overlay.MiningHud;
+import com.thatgravyboat.skyblockhud.utils.Utils;
+import java.lang.ref.WeakReference;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Arrays;
import java.util.Locale;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class MinesHandler {
@@ -153,4 +157,35 @@ public class MinesHandler {
MiningHud.setHeat(0);
}
}
+
+ public static WeakReference<PrehistoricEggProgress> getEggColorAndProgress(ItemStack stack) {
+ String id = Utils.getItemCustomId(stack);
+ if (id == null || !id.equals("PREHISTORIC_EGG")) return null;
+ NBTTagCompound extraAttributes = stack.getTagCompound().getCompoundTag("ExtraAttributes");
+ if (!extraAttributes.hasKey("blocks_walked")) return null;
+ PrehistoricEggProgress progress = new PrehistoricEggProgress();
+ int walked = extraAttributes.getInteger("blocks_walked");
+ if (walked < 4000) {
+ progress.currentColor = 0xffffff;
+ progress.progress = walked / 4000f;
+ }else if (walked < 10000) {
+ progress.currentColor = 0x55FF55;
+ progress.progress = (walked - 4000f) / 6000f;
+ }else if (walked < 20000) {
+ progress.currentColor = 0x5555FF;
+ progress.progress = (walked - 10000f) / 10000f;
+ }else if (walked < 40000) {
+ progress.currentColor = 0xAA00AA;
+ progress.progress = (walked - 20000f) / 20000f;
+ }else if (walked < 100000) {
+ progress.currentColor = 0xFFAA00;
+ progress.progress = (walked - 40000f) / 60000f;
+ }
+ return new WeakReference<>(progress);
+ }
+
+ public static class PrehistoricEggProgress {
+ public float progress;
+ public int currentColor;
+ }
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinRenderItem.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinRenderItem.java
index 08f9314..951b549 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinRenderItem.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinRenderItem.java
@@ -1,6 +1,8 @@
package com.thatgravyboat.skyblockhud.mixins;
import com.thatgravyboat.skyblockhud.handlers.CooldownHandler;
+import com.thatgravyboat.skyblockhud.location.MinesHandler;
+import java.lang.ref.WeakReference;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
@@ -23,6 +25,25 @@ public abstract class MixinRenderItem {
if(stack == null) return;
float cooldown = CooldownHandler.getAbilityTime(stack);
+ WeakReference<MinesHandler.PrehistoricEggProgress> weakProgress = MinesHandler.getEggColorAndProgress(stack);
+
+ if (weakProgress != null) {
+ MinesHandler.PrehistoricEggProgress progress = weakProgress.get();
+ if (progress == null) return;
+ GlStateManager.disableLighting();
+ GlStateManager.disableDepth();
+ GlStateManager.disableTexture2D();
+ GlStateManager.disableAlpha();
+ GlStateManager.disableBlend();
+ WorldRenderer worldrenderer = Tessellator.getInstance().getWorldRenderer();
+ this.draw(worldrenderer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255);
+ this.draw(worldrenderer, xPosition + 2, yPosition + 13, Math.round(progress.progress * 13f), 1, (progress.currentColor >> 16) & 0xFF, (progress.currentColor >> 8) & 0xFF, progress.currentColor & 0xFF, 255);
+ GlStateManager.enableAlpha();
+ GlStateManager.enableTexture2D();
+ GlStateManager.enableLighting();
+ GlStateManager.enableDepth();
+ }
+
if (cooldown > -1){
GlStateManager.disableLighting();
GlStateManager.disableDepth();
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/DungeonOverlay.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/DungeonOverlay.java
index 9bcf96a..9cfa1e7 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/DungeonOverlay.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/DungeonOverlay.java
@@ -140,7 +140,10 @@ public class DungeonOverlay extends Gui {
drawDungeonPlayer(player.getName(), player.getHealth(), player.isDead(), player.getDungeonClass(), posX, posY);
}
}
- drawDungeonClock(event.resolution.getScaledWidth(), SkyblockHud.config.main.mainHudPos.getAbsY(event.resolution, 34), mc);
+
+ if (!SkyblockHud.config.main.disaleMainHud) {
+ drawDungeonClock(event.resolution.getScaledWidth(), SkyblockHud.config.main.mainHudPos.getAbsY(event.resolution, 34), mc);
+ }
}
}
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java
index eb13a83..015572d 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java
@@ -66,7 +66,7 @@ public class OverlayHud extends Gui {
} else if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.MUSHROOMDESERT)) {
drawTrapperOrPelts(width, offset, mc);
} else if (LocationHandler.getCurrentLocation().getCategory().isMiningCategory()) {
- if (MinesHandler.currentEvent.display && LocationHandler.getCurrentLocation().getCategory() == LocationCategory.DWARVENMINES) {
+ if (MinesHandler.currentEvent.display) {
drawDwarvenEvent(width, offset, mc);
} else {
drawMiningPowders(width, offset, mc);
@@ -256,25 +256,33 @@ public class OverlayHud extends Gui {
}
public void drawDwarvenEvent(int width, int offset, Minecraft mc) {
- if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.DWARVENMINES)) {
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- mc.renderEngine.bindTexture(Textures.texture.stats);
- if (MinesHandler.eventMax > 0 || !MinesHandler.currentEvent.needsMax) {
- String duration = MinesHandler.currentEvent.needsMax ? MinesHandler.eventProgress + "/" + MinesHandler.eventMax : String.valueOf(MinesHandler.eventProgress);
- drawTexturedModalRect((width / 2) - 33 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14);
- drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(duration))) + 2, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(duration) + 14, 14);
- drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(duration))) + 4, offset + (bossBarVisible ? 38 : 21), MinesHandler.currentEvent.x, 0, 8, 8);
- drawString(font, duration, (width / 2) - 19 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF);
- } else {
- String text = MinesHandler.currentEvent.displayName;
- drawTexturedModalRect((width / 2) - 33 - (font.getStringWidth(text)), offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14);
- drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(text))) + 2, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(text) + 14, 14);
- drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(text))) + 4, offset + (bossBarVisible ? 38 : 21), MinesHandler.currentEvent.x, 0, 8, 8);
- drawString(font, text, (width / 2) - 19 - (font.getStringWidth(text)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF);
- }
+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
+ mc.renderEngine.bindTexture(Textures.texture.stats);
+ if (MinesHandler.eventMax > 0) {
+ String duration = MinesHandler.currentEvent.needsMax ? MinesHandler.eventProgress + "/" + MinesHandler.eventMax : String.valueOf(MinesHandler.eventProgress);
+ drawTexturedModalRect((width / 2) - 33 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14);
+ drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(duration))) + 2, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(duration) + 14, 14);
+ drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(duration))) + 4, offset + (bossBarVisible ? 38 : 21), MinesHandler.currentEvent.x, 0, 8, 8);
+ drawString(font, duration, (width / 2) - 19 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF);
+ } else if (!MinesHandler.currentEvent.needsMax) {
+ drawSingleEvent(width, offset, mc);
+ } else {
+ String text = MinesHandler.currentEvent.displayName;
+ drawTexturedModalRect((width / 2) - 33 - (font.getStringWidth(text)), offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14);
+ drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(text))) + 2, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(text) + 14, 14);
+ drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(text))) + 4, offset + (bossBarVisible ? 38 : 21), MinesHandler.currentEvent.x, 0, 8, 8);
+ drawString(font, text, (width / 2) - 19 - (font.getStringWidth(text)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF);
}
}
+ public void drawSingleEvent(int width, int offset, Minecraft mc) {
+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
+ mc.renderEngine.bindTexture(Textures.texture.stats);
+ drawTexturedModalRect((width / 2) - 15, offset + (bossBarVisible ? 51 : 34), 0, 52, 30, 14);
+ drawTexturedModalRect((width / 2) - 10, offset + (bossBarVisible ? 53 : 36), MinesHandler.currentEvent.x, 0, 8, 8);
+ drawString(mc.fontRendererObj, MinesHandler.eventProgress +"", (width / 2), offset + (bossBarVisible ? 53 : 36), 0xffffff);
+ }
+
public void drawFarmHouseMedals(int width, int offset, Minecraft mc) {
if (LocationHandler.getCurrentLocation().equals(Locations.FARMHOUSE)) {
int bronze = font.getStringWidth(FarmHouseHandler.getFormattedMedals(FarmHouseHandler.Medal.BRONZE));
@@ -298,7 +306,7 @@ public class OverlayHud extends Gui {
bossBarVisible = BossStatus.statusBarTime > 0 && GuiIngameForge.renderBossHealth && BossbarHandler.bossBarRendered;
Minecraft mc = Minecraft.getMinecraft();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- if (LocationHandler.getCurrentLocation() != Locations.CATACOMBS) {
+ if (LocationHandler.getCurrentLocation() != Locations.CATACOMBS && !SkyblockHud.config.main.disaleMainHud) {
drawClock(event.resolution.getScaledWidth(), SkyblockHud.config.main.mainHudPos.getAbsY(event.resolution, 34), mc);
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java
index baf9648..f8eaba3 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java
@@ -19,7 +19,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class TrackerHandler extends Gui {
public static Set<TrackerObject> trackerObjects = new HashSet<>();
- public static Map<Locations, Map<String, TrackerObject>> trackers = new HashMap<>();
+ public static LinkedHashMap<Locations, Map<String, TrackerObject>> trackers = new LinkedHashMap<>();
public static <K, V> Map<K, V> sortTrackers(Map<K, V> map, Comparator<? super Map.Entry<K, V>> comparator) {
List<Map.Entry<K, V>> list = new ArrayList<>(map.entrySet());
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerObject.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerObject.java
index 6013b09..1c6e54d 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerObject.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerObject.java
@@ -38,6 +38,11 @@ public class TrackerObject {
if (jsonObject.has("enchanted") && jsonObject.get("enchanted").getAsBoolean()) {
stack.setTagInfo("ench", new NBTTagList());
}
+ if (!jsonObject.get("id").getAsString().contains("entity:")) {
+ NBTTagCompound extraAttributes = new NBTTagCompound();
+ extraAttributes.setString("id", jsonObject.get("id").getAsString());
+ stack.setTagInfo("ExtraAttributes", extraAttributes);
+ }
return stack;
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/utils/Utils.java b/src/main/java/com/thatgravyboat/skyblockhud/utils/Utils.java
index 71c6266..10f4599 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/utils/Utils.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/utils/Utils.java
@@ -369,4 +369,12 @@ public class Utils {
for (String o : strings) if (string.equalsIgnoreCase(o)) return true;
return false;
}
+
+ public static String getItemCustomId(ItemStack stack){
+ if (stack == null) return null;
+ if (!stack.hasTagCompound()) return null;
+ if (!stack.getTagCompound().hasKey("ExtraAttributes")) return null;
+ if (!stack.getTagCompound().getCompoundTag("ExtraAttributes").hasKey("id")) return null;
+ return stack.getTagCompound().getCompoundTag("ExtraAttributes").getString("id");
+ }
}