diff options
author | Lorenz <ESs95s3P5z8Pheb> | 2022-07-08 16:02:54 +0200 |
---|---|---|
committer | Lorenz <ESs95s3P5z8Pheb> | 2022-07-08 16:02:54 +0200 |
commit | 9e08dbf2baa9819abd281ad285df7462c99491e2 (patch) | |
tree | 6e874e1c5b74a522d6acca08dd6b64c808ddbbbe /src/main/java/com/thatgravyboat | |
parent | 1e268208cd700b379952d1718dca66fa4aad305c (diff) | |
download | skyhanni-9e08dbf2baa9819abd281ad285df7462c99491e2.tar.gz skyhanni-9e08dbf2baa9819abd281ad285df7462c99491e2.tar.bz2 skyhanni-9e08dbf2baa9819abd281ad285df7462c99491e2.zip |
remove old stuff
Diffstat (limited to 'src/main/java/com/thatgravyboat')
44 files changed, 3980 insertions, 3981 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java index eba20ea4d..5677a7382 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java @@ -1,124 +1,124 @@ -package com.thatgravyboat.skyblockhud; - -import at.lorenz.mod.LorenzMod; -import com.google.common.collect.ComparisonChain; -import com.google.common.collect.Ordering; -import com.thatgravyboat.skyblockhud.dungeons.DungeonHandler; -import com.thatgravyboat.skyblockhud.location.*; -import com.thatgravyboat.skyblockhud.seasons.SeasonDateHandler; -import com.thatgravyboat.skyblockhud.utils.Utils; -import java.util.Comparator; -import java.util.List; -import java.util.regex.Pattern; -import net.minecraft.client.Minecraft; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.world.WorldSettings; -import net.minecraftforge.client.GuiIngameForge; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import net.minecraftforge.fml.common.eventhandler.EventPriority; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public class ComponentHandler { - - public static final Pattern SCOREBOARD_CHARACTERS = Pattern.compile("[^]\\[a-z A-Z:0-9/'.()+\\d-§?]"); - private static final Ordering<NetworkPlayerInfo> sortingList = Ordering.from(new PlayerComparator()); - private static int ticksExisted = 0; - - @SubscribeEvent - public void onClientTick(TickEvent.ClientTickEvent event) { - Minecraft mc = Minecraft.getMinecraft(); - ticksExisted++; - boolean eventPass = false; - if (mc.theWorld != null) { - List<NetworkPlayerInfo> players = sortingList.sortedCopy(mc.thePlayer.sendQueue.getPlayerInfoMap()); - GuiIngameForge.renderObjective = !LorenzMod.hasSkyblockScoreboard() || !LorenzMod.config.misc.hideScoreboard; - if (players != null && LorenzMod.hasSkyblockScoreboard()) { - if (ticksExisted % 60 == 0) { - for (NetworkPlayerInfo player : players) { - if (player.getDisplayName() != null) { - String formattedTabListPlayer = SCOREBOARD_CHARACTERS.matcher(Utils.removeColor(player.getDisplayName().getFormattedText())).replaceAll(""); - if (LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) { - if (formattedTabListPlayer.toLowerCase().contains("secrets found:")) DungeonHandler.parseTotalSecrets(formattedTabListPlayer); - if (formattedTabListPlayer.toLowerCase().contains("deaths:")) DungeonHandler.parseDeaths(formattedTabListPlayer); - if (formattedTabListPlayer.toLowerCase().contains("crypts:")) DungeonHandler.parseCrypts(formattedTabListPlayer); - } else if (LocationHandler.getCurrentLocation().getCategory().isMiningCategory()) { - if (formattedTabListPlayer.toLowerCase().contains("mithril powder:")) { - MinesHandler.parseMithril(formattedTabListPlayer); - } - if (formattedTabListPlayer.toLowerCase().contains("gemstone powder:")) { - MinesHandler.parseGemstone(formattedTabListPlayer); - } - } else if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.MUSHROOMDESERT)) { - if (formattedTabListPlayer.toLowerCase().contains("pelts:")) { - try { - FarmingIslandHandler.pelts = Integer.parseInt(formattedTabListPlayer.toLowerCase().replace("pelts:", "").trim()); - } catch (Exception ignored) {} - } - } - } - } - if (players.size() > 80) { - for (int i = 61; i <= 80; i++) { - if (players.get(i).getDisplayName() != null) { - String formattedTabListPlayer = SCOREBOARD_CHARACTERS.matcher(Utils.removeColor(players.get(i).getDisplayName().getFormattedText())).replaceAll(""); - if (formattedTabListPlayer.toLowerCase().contains("event:")) { - if (i < 80) { - if (players.get(i + 1).getDisplayName() != null) { - String secondLine = SCOREBOARD_CHARACTERS.matcher(Utils.removeColor(players.get(i + 1).getDisplayName().getFormattedText())).replaceAll(""); - if (!formattedTabListPlayer.contains("N/A")) { - SeasonDateHandler.setCurrentEvent(formattedTabListPlayer.replace("Event:", ""), secondLine); - eventPass = true; - } - } - } - } - } - if (i == 80 && !eventPass) { - SeasonDateHandler.setCurrentEvent("", ""); - } - } - } - } - if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.PARK)) { - if (players.size() >= 80) { - for (int i = 41; i <= 60; i++) { - if (players.get(i).getDisplayName() != null) { - String formattedTabListPlayer = SCOREBOARD_CHARACTERS.matcher(Utils.removeColor(players.get(i).getDisplayName().getFormattedText())).replaceAll(""); - if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.PARK)) { - if (formattedTabListPlayer.toLowerCase().contains("rain:")) { - ParkIslandHandler.parseRain(formattedTabListPlayer.toLowerCase()); - } - } - } - } - } - } else if (ParkIslandHandler.isRaining()) { - ParkIslandHandler.parseRain(null); - } - } - } - } - - @SubscribeEvent(priority = EventPriority.HIGHEST) - public void onStatusBar(ClientChatReceivedEvent event) { - if (event.type == 2) { - if (LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) DungeonHandler.parseSecrets(event.message.getFormattedText()); - } - } - - @SideOnly(Side.CLIENT) - static class PlayerComparator implements Comparator<NetworkPlayerInfo> { - - private PlayerComparator() {} - - public int compare(NetworkPlayerInfo p_compare_1_, NetworkPlayerInfo p_compare_2_) { - ScorePlayerTeam scoreplayerteam = p_compare_1_.getPlayerTeam(); - ScorePlayerTeam scoreplayerteam1 = p_compare_2_.getPlayerTeam(); - return ComparisonChain.start().compareTrueFirst(p_compare_1_.getGameType() != WorldSettings.GameType.SPECTATOR, p_compare_2_.getGameType() != WorldSettings.GameType.SPECTATOR).compare(scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : "", scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : "").compare(p_compare_1_.getGameProfile().getName(), p_compare_2_.getGameProfile().getName()).result(); - } - } -} +//package com.thatgravyboat.skyblockhud; +// +//import at.lorenz.mod.LorenzMod; +//import com.google.common.collect.ComparisonChain; +//import com.google.common.collect.Ordering; +//import com.thatgravyboat.skyblockhud.dungeons.DungeonHandler; +//import com.thatgravyboat.skyblockhud.location.*; +//import com.thatgravyboat.skyblockhud.seasons.SeasonDateHandler; +//import com.thatgravyboat.skyblockhud.utils.Utils; +//import java.util.Comparator; +//import java.util.List; +//import java.util.regex.Pattern; +//import net.minecraft.client.Minecraft; +//import net.minecraft.client.network.NetworkPlayerInfo; +//import net.minecraft.scoreboard.ScorePlayerTeam; +//import net.minecraft.world.WorldSettings; +//import net.minecraftforge.client.GuiIngameForge; +//import net.minecraftforge.client.event.ClientChatReceivedEvent; +//import net.minecraftforge.fml.common.eventhandler.EventPriority; +//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +//import net.minecraftforge.fml.common.gameevent.TickEvent; +//import net.minecraftforge.fml.relauncher.Side; +//import net.minecraftforge.fml.relauncher.SideOnly; +// +//public class ComponentHandler { +// +// public static final Pattern SCOREBOARD_CHARACTERS = Pattern.compile("[^]\\[a-z A-Z:0-9/'.()+\\d-§?]"); +// private static final Ordering<NetworkPlayerInfo> sortingList = Ordering.from(new PlayerComparator()); +// private static int ticksExisted = 0; +// +// @SubscribeEvent +// public void onClientTick(TickEvent.ClientTickEvent event) { +// Minecraft mc = Minecraft.getMinecraft(); +// ticksExisted++; +// boolean eventPass = false; +// if (mc.theWorld != null) { +// List<NetworkPlayerInfo> players = sortingList.sortedCopy(mc.thePlayer.sendQueue.getPlayerInfoMap()); +// GuiIngameForge.renderObjective = !LorenzMod.hasSkyblockScoreboard() || !LorenzMod.config.misc.hideScoreboard; +// if (players != null && LorenzMod.hasSkyblockScoreboard()) { +// if (ticksExisted % 60 == 0) { +// for (NetworkPlayerInfo player : players) { +// if (player.getDisplayName() != null) { +// String formattedTabListPlayer = SCOREBOARD_CHARACTERS.matcher(Utils.removeColor(player.getDisplayName().getFormattedText())).replaceAll(""); +// if (LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) { +// if (formattedTabListPlayer.toLowerCase().contains("secrets found:")) DungeonHandler.parseTotalSecrets(formattedTabListPlayer); +// if (formattedTabListPlayer.toLowerCase().contains("deaths:")) DungeonHandler.parseDeaths(formattedTabListPlayer); +// if (formattedTabListPlayer.toLowerCase().contains("crypts:")) DungeonHandler.parseCrypts(formattedTabListPlayer); +// } else if (LocationHandler.getCurrentLocation().getCategory().isMiningCategory()) { +// if (formattedTabListPlayer.toLowerCase().contains("mithril powder:")) { +// MinesHandler.parseMithril(formattedTabListPlayer); +// } +// if (formattedTabListPlayer.toLowerCase().contains("gemstone powder:")) { +// MinesHandler.parseGemstone(formattedTabListPlayer); +// } +// } else if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.MUSHROOMDESERT)) { +// if (formattedTabListPlayer.toLowerCase().contains("pelts:")) { +// try { +// FarmingIslandHandler.pelts = Integer.parseInt(formattedTabListPlayer.toLowerCase().replace("pelts:", "").trim()); +// } catch (Exception ignored) {} +// } +// } +// } +// } +// if (players.size() > 80) { +// for (int i = 61; i <= 80; i++) { +// if (players.get(i).getDisplayName() != null) { +// String formattedTabListPlayer = SCOREBOARD_CHARACTERS.matcher(Utils.removeColor(players.get(i).getDisplayName().getFormattedText())).replaceAll(""); +// if (formattedTabListPlayer.toLowerCase().contains("event:")) { +// if (i < 80) { +// if (players.get(i + 1).getDisplayName() != null) { +// String secondLine = SCOREBOARD_CHARACTERS.matcher(Utils.removeColor(players.get(i + 1).getDisplayName().getFormattedText())).replaceAll(""); +// if (!formattedTabListPlayer.contains("N/A")) { +// SeasonDateHandler.setCurrentEvent(formattedTabListPlayer.replace("Event:", ""), secondLine); +// eventPass = true; +// } +// } +// } +// } +// } +// if (i == 80 && !eventPass) { +// SeasonDateHandler.setCurrentEvent("", ""); +// } +// } +// } +// } +// if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.PARK)) { +// if (players.size() >= 80) { +// for (int i = 41; i <= 60; i++) { +// if (players.get(i).getDisplayName() != null) { +// String formattedTabListPlayer = SCOREBOARD_CHARACTERS.matcher(Utils.removeColor(players.get(i).getDisplayName().getFormattedText())).replaceAll(""); +// if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.PARK)) { +// if (formattedTabListPlayer.toLowerCase().contains("rain:")) { +// ParkIslandHandler.parseRain(formattedTabListPlayer.toLowerCase()); +// } +// } +// } +// } +// } +// } else if (ParkIslandHandler.isRaining()) { +// ParkIslandHandler.parseRain(null); +// } +// } +// } +// } +// +// @SubscribeEvent(priority = EventPriority.HIGHEST) +// public void onStatusBar(ClientChatReceivedEvent event) { +// if (event.type == 2) { +// if (LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) DungeonHandler.parseSecrets(event.message.getFormattedText()); +// } +// } +// +// @SideOnly(Side.CLIENT) +// static class PlayerComparator implements Comparator<NetworkPlayerInfo> { +// +// private PlayerComparator() {} +// +// public int compare(NetworkPlayerInfo p_compare_1_, NetworkPlayerInfo p_compare_2_) { +// ScorePlayerTeam scoreplayerteam = p_compare_1_.getPlayerTeam(); +// ScorePlayerTeam scoreplayerteam1 = p_compare_2_.getPlayerTeam(); +// return ComparisonChain.start().compareTrueFirst(p_compare_1_.getGameType() != WorldSettings.GameType.SPECTATOR, p_compare_2_.getGameType() != WorldSettings.GameType.SPECTATOR).compare(scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : "", scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : "").compare(p_compare_1_.getGameProfile().getName(), p_compare_2_.getGameProfile().getName()).result(); +// } +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/KillTracking.java b/src/main/java/com/thatgravyboat/skyblockhud/api/KillTracking.java index bc98672d8..84882e1f4 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/api/KillTracking.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/api/KillTracking.java @@ -1,61 +1,61 @@ -package com.thatgravyboat.skyblockhud.api; - -import com.thatgravyboat.skyblockhud.DevModeConstants; -import com.thatgravyboat.skyblockhud.api.events.SkyBlockEntityKilled; -import com.thatgravyboat.skyblockhud.api.sbentities.EntityTypeRegistry; -import java.util.HashSet; -import java.util.Set; -import java.util.UUID; -import net.minecraft.client.Minecraft; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.DamageSource; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.EntityJoinWorldEvent; -import net.minecraftforge.event.entity.living.LivingDeathEvent; -import net.minecraftforge.event.entity.player.AttackEntityEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class KillTracking { - - public static final Set<UUID> attackedEntities = new HashSet<>(); - - @SubscribeEvent - public void onAttack(AttackEntityEvent event) { - if (event.target != null) { - attackedEntities.add(event.target.getUniqueID()); - } - } - - @SubscribeEvent - public void onDeath(LivingDeathEvent event) { - if (DevModeConstants.mobDeathLogging) { - //Used for testing - System.out.println("----------------------------------------------------------------------------------------------------------------"); - System.out.println("Name : " + event.entity.getName()); - System.out.println("UUID : " + event.entity.getUniqueID()); - NBTTagCompound compound = new NBTTagCompound(); - event.entity.writeToNBT(compound); - System.out.println("Tag : " + compound); - System.out.println("Damage : " + getDamageSourceString(event.source)); - System.out.println("SBH Entity ID: " + EntityTypeRegistry.getEntityId(event.entity)); - System.out.println("----------------------------------------------------------------------------------------------------------------"); - } - if (attackedEntities.contains(event.entity.getUniqueID())) { - if (EntityTypeRegistry.getEntityId(event.entity) != null) { - MinecraftForge.EVENT_BUS.post(new SkyBlockEntityKilled(EntityTypeRegistry.getEntityId(event.entity), event.entity)); - } - attackedEntities.remove(event.entity.getUniqueID()); - } - } - - public static String getDamageSourceString(DamageSource source) { - return ("{ " + source.getDamageType() + ", " + source.isDamageAbsolute() + ", " + source.isDifficultyScaled() + ", " + source.isFireDamage() + ", " + source.isProjectile() + ", " + source.isUnblockable() + ", " + source.isExplosion() + ", " + source.isMagicDamage() + ", " + source.isCreativePlayer() + ", " + source.getSourceOfDamage() + " }"); - } - - @SubscribeEvent - public void onWorldChange(EntityJoinWorldEvent event) { - if (event.entity == Minecraft.getMinecraft().thePlayer) { - attackedEntities.clear(); - } - } -} +//package com.thatgravyboat.skyblockhud.api; +// +//import com.thatgravyboat.skyblockhud.DevModeConstants; +//import com.thatgravyboat.skyblockhud.api.events.SkyBlockEntityKilled; +//import com.thatgravyboat.skyblockhud.api.sbentities.EntityTypeRegistry; +//import java.util.HashSet; +//import java.util.Set; +//import java.util.UUID; +//import net.minecraft.client.Minecraft; +//import net.minecraft.nbt.NBTTagCompound; +//import net.minecraft.util.DamageSource; +//import net.minecraftforge.common.MinecraftForge; +//import net.minecraftforge.event.entity.EntityJoinWorldEvent; +//import net.minecraftforge.event.entity.living.LivingDeathEvent; +//import net.minecraftforge.event.entity.player.AttackEntityEvent; +//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +// +//public class KillTracking { +// +// public static final Set<UUID> attackedEntities = new HashSet<>(); +// +// @SubscribeEvent +// public void onAttack(AttackEntityEvent event) { +// if (event.target != null) { +// attackedEntities.add(event.target.getUniqueID()); +// } +// } +// +// @SubscribeEvent +// public void onDeath(LivingDeathEvent event) { +// if (DevModeConstants.mobDeathLogging) { +// //Used for testing +// System.out.println("----------------------------------------------------------------------------------------------------------------"); +// System.out.println("Name : " + event.entity.getName()); +// System.out.println("UUID : " + event.entity.getUniqueID()); +// NBTTagCompound compound = new NBTTagCompound(); +// event.entity.writeToNBT(compound); +// System.out.println("Tag : " + compound); +// System.out.println("Damage : " + getDamageSourceString(event.source)); +// System.out.println("SBH Entity ID: " + EntityTypeRegistry.getEntityId(event.entity)); +// System.out.println("----------------------------------------------------------------------------------------------------------------"); +// } +// if (attackedEntities.contains(event.entity.getUniqueID())) { +// if (EntityTypeRegistry.getEntityId(event.entity) != null) { +// MinecraftForge.EVENT_BUS.post(new SkyBlockEntityKilled(EntityTypeRegistry.getEntityId(event.entity), event.entity)); +// } +// attackedEntities.remove(event.entity.getUniqueID()); +// } +// } +// +// public static String getDamageSourceString(DamageSource source) { +// return ("{ " + source.getDamageType() + ", " + source.isDamageAbsolute() + ", " + source.isDifficultyScaled() + ", " + source.isFireDamage() + ", " + source.isProjectile() + ", " + source.isUnblockable() + ", " + source.isExplosion() + ", " + source.isMagicDamage() + ", " + source.isCreativePlayer() + ", " + source.getSourceOfDamage() + " }"); +// } +// +// @SubscribeEvent +// public void onWorldChange(EntityJoinWorldEvent event) { +// if (event.entity == Minecraft.getMinecraft().thePlayer) { +// attackedEntities.clear(); +// } +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java b/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java index d0bdf551d..de485ef5e 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java @@ -1,65 +1,65 @@ -package com.thatgravyboat.skyblockhud.api; - -import static com.thatgravyboat.skyblockhud.ComponentHandler.SCOREBOARD_CHARACTERS; - -import at.lorenz.mod.LorenzMod; -import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent; -import com.thatgravyboat.skyblockhud.api.events.SidebarPostEvent; -import com.thatgravyboat.skyblockhud.api.events.SidebarPreGetEvent; -import com.thatgravyboat.skyblockhud.utils.Utils; -import java.util.*; -import java.util.stream.Collectors; -import net.minecraft.client.Minecraft; -import net.minecraft.scoreboard.Score; -import net.minecraft.scoreboard.ScoreObjective; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.scoreboard.Scoreboard; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; - -public class LeaderboardGetter { - - private static Map<Integer, String> cachedScores = new HashMap<>(); - private static List<String> cachedScoresList = new ArrayList<>(); - - private static int ticks = 0; - - public static List<String> getCachedScores() { - return cachedScoresList; - } - - @SubscribeEvent - public void onClientUpdate(TickEvent.ClientTickEvent event) { - if (event.phase.equals(TickEvent.Phase.START)) return; - ticks++; - if (ticks % 5 != 0) return; - - Minecraft mc = Minecraft.getMinecraft(); - if (mc.theWorld != null && LorenzMod.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, (s1, s2) -> s1)); - - if (!cachedScores.equals(scores)) { - scores.forEach((score, name) -> { - if (cachedScores.get(score) == null || !cachedScores.get(score).equals(name)) { - MinecraftForge.EVENT_BUS.post(new SidebarLineUpdateEvent(name, SCOREBOARD_CHARACTERS.matcher(name).replaceAll("").trim(), score, scores.size(), scoreboard, sidebarObjective)); - } - }); - cachedScores = scores; - cachedScoresList = scores.values().stream().map(name -> SCOREBOARD_CHARACTERS.matcher(name).replaceAll("").trim()).collect(Collectors.toList()); - } - MinecraftForge.EVENT_BUS.post(new SidebarPostEvent(scoreboard, sidebarObjective, cachedScoresList)); - } - } - } - - public String getLine(Score score) { - ScorePlayerTeam scorePlayerTeam = score.getScoreScoreboard().getPlayersTeam(score.getPlayerName()); - return Utils.removeColor(ScorePlayerTeam.formatPlayerName(scorePlayerTeam, score.getPlayerName())); - } -} +//package com.thatgravyboat.skyblockhud.api; +// +//import static com.thatgravyboat.skyblockhud.ComponentHandler.SCOREBOARD_CHARACTERS; +// +//import at.lorenz.mod.LorenzMod; +//import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent; +//import com.thatgravyboat.skyblockhud.api.events.SidebarPostEvent; +//import com.thatgravyboat.skyblockhud.api.events.SidebarPreGetEvent; +//import com.thatgravyboat.skyblockhud.utils.Utils; +//import java.util.*; +//import java.util.stream.Collectors; +//import net.minecraft.client.Minecraft; +//import net.minecraft.scoreboard.Score; +//import net.minecraft.scoreboard.ScoreObjective; +//import net.minecraft.scoreboard.ScorePlayerTeam; +//import net.minecraft.scoreboard.Scoreboard; +//import net.minecraftforge.common.MinecraftForge; +//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +//import net.minecraftforge.fml.common.gameevent.TickEvent; +// +//public class LeaderboardGetter { +// +// private static Map<Integer, String> cachedScores = new HashMap<>(); +// private static List<String> cachedScoresList = new ArrayList<>(); +// +// private static int ticks = 0; +// +// public static List<String> getCachedScores() { +// return cachedScoresList; +// } +// +// @SubscribeEvent +// public void onClientUpdate(TickEvent.ClientTickEvent event) { +// if (event.phase.equals(TickEvent.Phase.START)) return; +// ticks++; +// if (ticks % 5 != 0) return; +// +// Minecraft mc = Minecraft.getMinecraft(); +// if (mc.theWorld != null && LorenzMod.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, (s1, s2) -> s1)); +// +// if (!cachedScores.equals(scores)) { +// scores.forEach((score, name) -> { +// if (cachedScores.get(score) == null || !cachedScores.get(score).equals(name)) { +// MinecraftForge.EVENT_BUS.post(new SidebarLineUpdateEvent(name, SCOREBOARD_CHARACTERS.matcher(name).replaceAll("").trim(), score, scores.size(), scoreboard, sidebarObjective)); +// } +// }); +// cachedScores = scores; +// cachedScoresList = scores.values().stream().map(name -> SCOREBOARD_CHARACTERS.matcher(name).replaceAll("").trim()).collect(Collectors.toList()); +// } +// MinecraftForge.EVENT_BUS.post(new SidebarPostEvent(scoreboard, sidebarObjective, cachedScoresList)); +// } +// } +// } +// +// public String getLine(Score score) { +// ScorePlayerTeam scorePlayerTeam = score.getScoreScoreboard().getPlayersTeam(score.getPlayerName()); +// return Utils.removeColor(ScorePlayerTeam.formatPlayerName(scorePlayerTeam, score.getPlayerName())); +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/events/LocationChangeEvent.java b/src/main/java/com/thatgravyboat/skyblockhud/api/events/LocationChangeEvent.java index 384e76d2e..560ad32e4 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/api/events/LocationChangeEvent.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/api/events/LocationChangeEvent.java @@ -1,15 +1,15 @@ -package com.thatgravyboat.skyblockhud.api.events; - -import com.thatgravyboat.skyblockhud.location.Locations; -import net.minecraftforge.fml.common.eventhandler.Event; - -public class LocationChangeEvent extends Event { - - public Locations oldLocation; - public Locations newLocation; - - public LocationChangeEvent(Locations oldLocation, Locations newLocation) { - this.oldLocation = oldLocation; - this.newLocation = newLocation; - } -} +//package com.thatgravyboat.skyblockhud.api.events; +// +//import com.thatgravyboat.skyblockhud.location.Locations; +//import net.minecraftforge.fml.common.eventhandler.Event; +// +//public class LocationChangeEvent extends Event { +// +// public Locations oldLocation; +// public Locations newLocation; +// +// public LocationChangeEvent(Locations oldLocation, Locations newLocation) { +// this.oldLocation = oldLocation; +// this.newLocation = newLocation; +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeHelper.java b/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeHelper.java index bb14e5d21..2d8a17e4b 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeHelper.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeHelper.java @@ -1,36 +1,36 @@ -package com.thatgravyboat.skyblockhud.api.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.entity.monster.EntityZombie; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; - -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 == 13000 || (maxHealthBase == 2000d && enderman.getHeldBlockState().getBlock().equals(Blocks.end_portal_frame))) { - return LocationHandler.getCurrentLocation().equals(Locations.DRAGONSNEST); - } - } - return false; - } - - public static boolean isCrypt(Entity entity) { - if (entity instanceof EntityZombie) { - EntityZombie zombie = ((EntityZombie) entity); - double maxHealthBase = zombie.getAttributeMap().getAttributeInstanceByName("generic.maxHealth").getBaseValue(); - if (maxHealthBase != 2000d) return false; - if (zombie.getEquipmentInSlot(0) == null || !zombie.getEquipmentInSlot(0).getItem().equals(Items.iron_sword)) return false; - if (zombie.getEquipmentInSlot(1) == null || !zombie.getEquipmentInSlot(1).getItem().equals(Items.chainmail_boots)) return false; - if (zombie.getEquipmentInSlot(2) == null || !zombie.getEquipmentInSlot(2).getItem().equals(Items.chainmail_leggings)) return false; - return zombie.getEquipmentInSlot(3) != null && zombie.getEquipmentInSlot(3).getItem().equals(Items.chainmail_chestplate); - } - return false; - } -} +//package com.thatgravyboat.skyblockhud.api.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.entity.monster.EntityZombie; +//import net.minecraft.init.Blocks; +//import net.minecraft.init.Items; +// +//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 == 13000 || (maxHealthBase == 2000d && enderman.getHeldBlockState().getBlock().equals(Blocks.end_portal_frame))) { +// return LocationHandler.getCurrentLocation().equals(Locations.DRAGONSNEST); +// } +// } +// return false; +// } +// +// public static boolean isCrypt(Entity entity) { +// if (entity instanceof EntityZombie) { +// EntityZombie zombie = ((EntityZombie) entity); +// double maxHealthBase = zombie.getAttributeMap().getAttributeInstanceByName("generic.maxHealth").getBaseValue(); +// if (maxHealthBase != 2000d) return false; +// if (zombie.getEquipmentInSlot(0) == null || !zombie.getEquipmentInSlot(0).getItem().equals(Items.iron_sword)) return false; +// if (zombie.getEquipmentInSlot(1) == null || !zombie.getEquipmentInSlot(1).getItem().equals(Items.chainmail_boots)) return false; +// if (zombie.getEquipmentInSlot(2) == null || !zombie.getEquipmentInSlot(2).getItem().equals(Items.chainmail_leggings)) return false; +// return zombie.getEquipmentInSlot(3) != null && zombie.getEquipmentInSlot(3).getItem().equals(Items.chainmail_chestplate); +// } +// return false; +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeRegistry.java b/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeRegistry.java index 6ff88fafb..d507eecfd 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeRegistry.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeRegistry.java @@ -1,27 +1,27 @@ -package com.thatgravyboat.skyblockhud.api.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; -import net.minecraft.entity.monster.EntityZombie; - -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))); - entities.put(EntityZombie.class, ImmutableList.of(SkyBlockEntity.of("CRYPT_GHOUL", EntityTypeHelper::isCrypt))); - } - - 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; - } -} +//package com.thatgravyboat.skyblockhud.api.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; +//import net.minecraft.entity.monster.EntityZombie; +// +//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))); +// entities.put(EntityZombie.class, ImmutableList.of(SkyBlockEntity.of("CRYPT_GHOUL", EntityTypeHelper::isCrypt))); +// } +// +// 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/commands/Commands.java b/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java index 94bbb3262..360c35578 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java @@ -3,7 +3,7 @@ package com.thatgravyboat.skyblockhud.commands; import at.lorenz.mod.LorenzMod; import com.thatgravyboat.skyblockhud.config.SBHConfigEditor; import com.thatgravyboat.skyblockhud.core.GuiScreenElementWrapper; -import com.thatgravyboat.skyblockhud.handlers.CrystalWaypoints; +//import com.thatgravyboat.skyblockhud.handlers.CrystalWaypoints; import net.minecraft.command.ICommandSender; import net.minecraftforge.client.ClientCommandHandler; import org.apache.commons.lang3.StringUtils; @@ -80,7 +80,7 @@ public class Commands { ClientCommandHandler.instance.registerCommand(settingsCommand2); // ClientCommandHandler.instance.registerCommand(mapCommand); // ClientCommandHandler.instance.registerCommand(devCommand); - ClientCommandHandler.instance.registerCommand(new CrystalWaypoints.WaypointCommand()); +// ClientCommandHandler.instance.registerCommand(new CrystalWaypoints.WaypointCommand()); } // private static void sendSBHMessage(ICommandSender sender, String message) { // sender.addChatMessage(new ChatComponentText("[" + EnumChatFormatting.RED + EnumChatFormatting.BOLD + "SkyBlockHud" + EnumChatFormatting.RESET + "] : " + EnumChatFormatting.GRAY + message)); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/commands/SimpleSubCommand.java b/src/main/java/com/thatgravyboat/skyblockhud/commands/SimpleSubCommand.java index 6bb62acff..4869d6bc9 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/commands/SimpleSubCommand.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/commands/SimpleSubCommand.java @@ -1,61 +1,61 @@ -package com.thatgravyboat.skyblockhud.commands; - -import java.util.List; -import java.util.Set; -import net.minecraft.command.CommandBase; -import net.minecraft.command.ICommandSender; -import net.minecraft.util.BlockPos; -import org.apache.commons.lang3.ArrayUtils; - -public abstract class SimpleSubCommand extends CommandBase { - - private final String commandName; - private final Set<String> subCommands; - - public SimpleSubCommand(String commandName, Set<String> subCommands) { - this.commandName = commandName; - this.subCommands = subCommands; - } - - @Override - public String getCommandName() { - return commandName; - } - - @Override - public String getCommandUsage(ICommandSender sender) { - return "/" + commandName; - } - - @Override - public void processCommand(ICommandSender sender, String[] args) { - if (args.length == 0) { - processNoSubCommand(sender); - return; - } - if (subCommands.contains(args[0])) { - processSubCommand(sender, args[0], ArrayUtils.remove(args, 0)); - return; - } - processBadSubCommand(sender, args[0]); - } - - @Override - public boolean canCommandSenderUseCommand(ICommandSender sender) { - return true; - } - - @Override - public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { - if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, subCommands); - } - return null; - } - - abstract void processSubCommand(ICommandSender sender, String subCommand, String[] args); - - abstract void processNoSubCommand(ICommandSender sender); - - public void processBadSubCommand(ICommandSender sender, String subCommand) {} -} +//package com.thatgravyboat.skyblockhud.commands; +// +//import java.util.List; +//import java.util.Set; +//import net.minecraft.command.CommandBase; +//import net.minecraft.command.ICommandSender; +//import net.minecraft.util.BlockPos; +//import org.apache.commons.lang3.ArrayUtils; +// +//public abstract class SimpleSubCommand extends CommandBase { +// +// private final String commandName; +// private final Set<String> subCommands; +// +// public SimpleSubCommand(String commandName, Set<String> subCommands) { +// this.commandName = commandName; +// this.subCommands = subCommands; +// } +// +// @Override +// public String getCommandName() { +// return commandName; +// } +// +// @Override +// public String getCommandUsage(ICommandSender sender) { +// return "/" + commandName; +// } +// +// @Override +// public void processCommand(ICommandSender sender, String[] args) { +// if (args.length == 0) { +// processNoSubCommand(sender); +// return; +// } +// if (subCommands.contains(args[0])) { +// processSubCommand(sender, args[0], ArrayUtils.remove(args, 0)); +// return; +// } +// processBadSubCommand(sender, args[0]); +// } +// +// @Override +// public boolean canCommandSenderUseCommand(ICommandSender sender) { +// return true; +// } +// +// @Override +// public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { +// if (args.length == 1) { +// return getListOfStringsMatchingLastWord(args, subCommands); +// } +// return null; +// } +// +// abstract void processSubCommand(ICommandSender sender, String subCommand, String[] args); +// +// abstract void processNoSubCommand(ICommandSender sender); +// +// public void processBadSubCommand(ICommandSender sender, String subCommand) {} +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java index b462831ad..62cd406fc 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java @@ -1,457 +1,456 @@ -package com.thatgravyboat.skyblockhud.config; - -import com.google.gson.annotations.Expose; -import at.lorenz.mod.LorenzMod; -import com.thatgravyboat.skyblockhud.core.GuiScreenElementWrapper; -import com.thatgravyboat.skyblockhud.core.config.Config; -import com.thatgravyboat.skyblockhud.core.config.Position; -import com.thatgravyboat.skyblockhud.core.config.annotations.*; -import com.thatgravyboat.skyblockhud.core.config.gui.GuiPositionEditor; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import net.minecraft.client.Minecraft; - -public class SBHConfig extends Config { - - private void editOverlay(String activeConfig, int width, int height, Position position) { - Minecraft.getMinecraft().displayGuiScreen(new GuiPositionEditor(position, width, height, () -> {}, () -> {}, () -> LorenzMod.screenToOpen = new GuiScreenElementWrapper(new SBHConfigEditor(LorenzMod.config, activeConfig)))); - } - - @Override - public void executeRunnable(String runnableId) { - // String activeConfigCategory = null; - // if (Minecraft.getMinecraft().currentScreen instanceof GuiScreenElementWrapper) { - // GuiScreenElementWrapper wrapper = (GuiScreenElementWrapper) Minecraft.getMinecraft().currentScreen; - // if (wrapper.element instanceof SBHConfigEditor) { - // activeConfigCategory = ((SBHConfigEditor) wrapper.element).getSelectedCategoryName(); - // } - // } - // - // switch (runnableId) { - // case "rpg": - // editOverlay(activeConfigCategory, 120, 47, rpg.rpgHudPosition); - // return; - // case "d1": - // editOverlay(activeConfigCategory, 120, 32, dungeon.dungeonPlayer1); - // return; - // case "d2": - // editOverlay(activeConfigCategory, 120, 32, dungeon.dungeonPlayer2); - // return; - // case "d3": - // editOverlay(activeConfigCategory, 120, 32, dungeon.dungeonPlayer3); - // return; - // case "d4": - // editOverlay(activeConfigCategory, 120, 32, dungeon.dungeonPlayer4); - // return; - // case "main": - // editOverlay(activeConfigCategory, 1000, 34, main.mainHudPos); - // return; - // case "ultimate": - // editOverlay(activeConfigCategory, 182, 5, dungeon.barPosition); - // return; - // case "map": - // editOverlay(activeConfigCategory, 72, 72, map.miniMapPosition); - // return; - // case "tracker": - // editOverlay(activeConfigCategory, 130, 70, trackers.trackerPosition); - // return; - // case "drill": - // editOverlay(activeConfigCategory, 136, 7, mining.drillBar); - // return; - // case "heat": - // editOverlay(activeConfigCategory, 45, 7, mining.heatBar); - // return; - // case "dialogue": - // editOverlay(activeConfigCategory, 182, 68, misc.dialoguePos); - // return; - // } - } - - @Expose - @Category(name = "Lorenz Options", desc = "Just a test by lorenz.") - public Lorenz lorenz = new Lorenz(); - - @Expose - @Category(name = "Misc Options", desc = "Just a bunch of random options.") - public Misc misc = new Misc(); - - @Expose - @Category(name = "Main Hud", desc = "All Options for the main hud.") - public MainHud main = new MainHud(); - - @Expose - @Category(name = "RPG Hud", desc = "All Options for the RPG hud.") - public RPGHud rpg = new RPGHud(); - - @Expose - @Category(name = "Dungeon Hud", desc = "All Options for the Dungeon hud.") - public DungeonHud dungeon = new DungeonHud(); - - @Expose - @Category(name = "Renderer", desc = "All Options for rendering.") - public Renderer renderer = new Renderer(); - - @Expose - @Category(name = "Map", desc = "All Options for the Map.") - public Map map = new Map(); - - @Expose - @Category(name = "Mining", desc = "All Options for the Mining Stuff.") - public Mining mining = new Mining(); - - // @Expose - // @Category(name = "Tracker", desc = "All Options for the Trackers.") - // public Trackers trackers = new Trackers(); - - public static class Lorenz { - - @Expose - @ConfigOption(name = "Lorenz Small Test A", desc = "abc") - @ConfigEditorBoolean - public boolean test = false; - - @Expose - @ConfigOption(name = "Lorenz Small Test B", desc = "abc") - @ConfigEditorBoolean - public boolean test2 = false; - - @Expose - @ConfigOption(name = "Lorenz Small Test C", desc = "abc") - @ConfigEditorBoolean - public boolean test3 = false; - } - - public static class Misc { - - @Expose - @ConfigOption(name = "Hide Scoreboard", desc = "Hides the scoreboard when in Skyblock.") - @ConfigEditorBoolean - public boolean hideScoreboard = false; - - @Expose - @ConfigOption(name = "Texture Styles", desc = "If this list only contains 1 thing that means your texture pack doesnt support styles") - @ConfigEditorStyle - public int style = 0; - - @Expose - @ConfigOption(name = "Hide Dialogue Box", desc = "Hides the Dialogue Box.") - @ConfigEditorBoolean - public boolean hideDialogueBox = true; - - @Expose - @ConfigOption(name = "Dialogue Box", desc = "") - @ConfigEditorButton(runnableId = "dialogue", buttonText = "Edit") - public Position dialoguePos = new Position(0, -50, true, false); - - @Expose - @ConfigOption(name = "Hide Item Cooldowns", desc = "Hides item cooldowns") - @ConfigEditorBoolean - public boolean hideItemCooldowns = false; - } - - 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); - - @Expose - @ConfigOption(name = "Twelve Hour Clock", desc = "Allows you to change the clock to be 12 hour instead of 24 hour.") - @ConfigEditorBoolean - public boolean twelveHourClock = false; - - @Expose - @ConfigOption(name = "Shift hud with boss", desc = "Shifts the hud when bossbar is visible.") - @ConfigEditorBoolean - public boolean bossShiftHud = true; - - @Expose - @ConfigOption(name = "Require Redstone", desc = "Allows to make it so that the redstone percentage requires you to hold a redstone item to show.") - @ConfigEditorBoolean - public boolean requireRedstone = true; - } - - public static class RPGHud { - - @Expose - @ConfigOption(name = "Show RPG Hud", desc = "Allows you to show or hide the RPG Hud.") - @ConfigEditorBoolean - public boolean showRpgHud = true; - - @Expose - @ConfigOption(name = "Flip Hud", desc = "Flips the hud when half way across the screen.") - @ConfigEditorBoolean - public boolean flipHud = true; - - @Expose - @ConfigOption(name = "RPG Hud Position", desc = "Allows you to change the position of the RPG Hud.") - @ConfigEditorButton(runnableId = "rpg", buttonText = "Edit") - public Position rpgHudPosition = new Position(1, 1); - } - - public static class DungeonHud { - - @Expose - @ConfigOption(name = "Dungeon Ultimate Bar", desc = "") - @ConfigEditorAccordion(id = 2) - public boolean ultimateBar = false; - - @Expose - @ConfigOption(name = "Hide Ultimate Bar", desc = "Hides the custom ultimate bar.") - @ConfigEditorBoolean - @ConfigAccordionId(id = 2) - public boolean hideUltimateBar = false; - - @Expose - @ConfigOption(name = "Bar Position", desc = "Change the position of the bar.") - @ConfigEditorButton(runnableId = "ultimate", buttonText = "Edit") - @ConfigAccordionId(id = 2) - public Position barPosition = new Position(0, 50, true, false); - - @Expose - @ConfigOption(name = "Bar Loading Color", desc = "The color of the bar when its loading.") - @ConfigEditorColour - @ConfigAccordionId(id = 2) - public String barLoadColor = "159:0:0:0:255"; - - @Expose - @ConfigOption(name = "Bar Full Color", desc = "The color of the bar when its full.") - @ConfigEditorColour - @ConfigAccordionId(id = 2) - public String barFullColor = "255:0:0:0:255"; - - @Expose - @ConfigOption(name = "Bar Style", desc = "Change the style of the bar") - @ConfigEditorDropdown(values = { "No Notch", "6 Notch", "10 Notch", "12 Notch", "20 Notch" }) - @ConfigAccordionId(id = 2) - public int barStyle = 2; - - @Expose - @ConfigOption(name = "Dungeon Players", desc = "") - @ConfigEditorAccordion(id = 1) - public boolean dungeonPlayerAccordion = false; - - @Expose - @ConfigOption(name = "Hide Dungeon Players", desc = "Allows you to hide the dungeon player hud") - @ConfigEditorBoolean - @ConfigAccordionId(id = 1) - public boolean hideDungeonPlayers = false; - - @Expose - @ConfigOption(name = "Dungeon Player Opacity", desc = "Allows you to change the opacity of the dungeon players.") - @ConfigEditorSlider(minValue = 0, maxValue = 100, minStep = 1) - @ConfigAccordionId(id = 1) - public int dungeonPlayerOpacity = 0; - - @Expose - @ConfigOption(name = "Hide Dead Players", desc = "Allows you to hide players that are dead or have left.") - @ConfigEditorBoolean - @ConfigAccordionId(id = 1) - public boolean hideDeadDungeonPlayers = false; - - @Expose - @ConfigOption(name = "Player Position 1", desc = "Change the position of this dungeon player.") - @ConfigEditorButton(runnableId = "d1", buttonText = "Edit") - @ConfigAccordionId(id = 1) - public Position dungeonPlayer1 = new Position(5, 5); - - @Expose - @ConfigOption(name = "Player Position 2", desc = "Change the position of this dungeon player.") - @ConfigEditorButton(runnableId = "d2", buttonText = "Edit") - @ConfigAccordionId(id = 1) - public Position dungeonPlayer2 = new Position(5, 42); - - @Expose - @ConfigOption(name = "Player Position 3", desc = "Change the position of this dungeon player.") - @ConfigEditorButton(runnableId = "d3", buttonText = "Edit") - @ConfigAccordionId(id = 1) - public Position dungeonPlayer3 = new Position(5, 79); - - @Expose - @ConfigOption(name = "Player Position 4", desc = "Change the position of this dungeon player.") - @ConfigEditorButton(runnableId = "d4", buttonText = "Edit") - @ConfigAccordionId(id = 1) - public Position dungeonPlayer4 = new Position(5, 116); - } - - public static class Renderer { - - @Expose - @ConfigOption(name = "Add Overflow Mana Back", desc = "Adds overflow mana back to the actionbar") - @ConfigEditorBoolean - public boolean addOverflowMana = false; - - @Expose - @ConfigOption(name = "Hide Boss Bar", desc = "Hides Boss Bar when certain conditions are met such as the name is just wither or it starts with objective:") - @ConfigEditorBoolean - public boolean hideBossBar = true; - - @Expose - @ConfigOption(name = "Hide XP Bar", desc = "Hides xp bar.") - @ConfigEditorBoolean - public boolean hideXpBar = true; - - @Expose - @ConfigOption(name = "Hide Food", desc = "Hides food.") - @ConfigEditorBoolean - public boolean hideFood = true; - - @Expose - @ConfigOption(name = "Hide air", desc = "Hides air.") - @ConfigEditorBoolean - public boolean hideAir = true; - - @Expose - @ConfigOption(name = "Hide hearts", desc = "Hides hearts.") - @ConfigEditorBoolean - public boolean hideHearts = true; - - @Expose - @ConfigOption(name = "Hide armor", desc = "Hides armor.") - @ConfigEditorBoolean - public boolean hideArmor = true; - - @Expose - @ConfigOption(name = "Hide Animal Hearts", desc = "Hides Animal Hearts.") - @ConfigEditorBoolean - public boolean hideAnimalHearts = true; - } - - public static class Map { - - @Expose - @ConfigOption(name = "Show Player Location", desc = "This feature is off by default as Hypixel's rules are so vague that this would fall under their disallowed modifications.") - @ConfigEditorBoolean - public boolean showPlayerLocation = false; - - @Expose - @ConfigOption(name = "Show Mini-Map", desc = "Shows the Mini-Map on your overlay if turned off you can still use /sbhmap to see the map in fullscreen.") - @ConfigEditorBoolean - public boolean showMiniMap = false; - - @Expose - @ConfigOption(name = "Map Locations", desc = "Remove a location from this list if you would like the map to not show up in that location. This is so you can use other mods maps.") - @ConfigEditorDraggableList(exampleText = { "HUB", "BARN", "MUSHROOMDESERT", "GOLDMINE (No Map Yet)", "DEEPCAVERNS (No Map Yet)", "SPIDERSDEN", "PARK", "FORTRESS", "DUNGEONHUB (No Map Yet)", "JERRY (No Map Yet)", "THEEND (No Map Yet)", "DWARVENMINES", "CRYSTALHOLLOWS" }) - public List<Integer> mapLocations = new ArrayList<>(Arrays.asList(0, 1, 2, 5, 6, 7, 11)); - - @Expose - @ConfigOption(name = "Mini-Map Position", desc = "Allows you to change the position of the Mini-Map.") - @ConfigEditorButton(runnableId = "map", buttonText = "Edit") - public Position miniMapPosition = new Position(0, 100, false, false); - - @Expose - @ConfigOption(name = "Icons", desc = "") - @ConfigEditorAccordion(id = 3) - public boolean icons = false; - - @Expose - @ConfigOption(name = "NPC", desc = "Show NPC Icons") - @ConfigEditorBoolean - @ConfigAccordionId(id = 3) - public boolean showNpcIcons = true; - - @Expose - @ConfigOption(name = "Info", desc = "Show Info Icons") - @ConfigEditorBoolean - @ConfigAccordionId(id = 3) - public boolean showInfoIcons = true; - - @Expose - @ConfigOption(name = "Misc", desc = "Show Misc Icons") - @ConfigEditorBoolean - @ConfigAccordionId(id = 3) - public boolean showMiscIcons = true; - - @Expose - @ConfigOption(name = "Shops", desc = "Show Shop Icons") - @ConfigEditorBoolean - @ConfigAccordionId(id = 3) - public boolean showShopIcons = true; - - @Expose - @ConfigOption(name = "Quests", desc = "Show Quest Icons") - @ConfigEditorBoolean - @ConfigAccordionId(id = 3) - public boolean showQuestIcons = false; - } - - public static class Mining { - - @Expose - @ConfigOption(name = "Mining Bars", desc = "") - @ConfigEditorAccordion(id = 4) - public boolean miningBars = false; - - @Expose - @ConfigOption(name = "Bar Mode", desc = "Change the mode of bar. Static mode will allow it to auto replace the xp when drill is held or you are heating up.") - @ConfigEditorDropdown(values = { "Moveable", "Static" }) - @ConfigAccordionId(id = 4) - public int barMode = 1; - - @Expose - @ConfigOption(name = "Show Drill Bar", desc = "Allows you to show or hide the Drill Bar.") - @ConfigEditorBoolean - @ConfigAccordionId(id = 4) - public boolean showDrillBar = true; - - @Expose - @ConfigOption(name = "Show Heat Bar", desc = "Allows you to show or hide the Heat Bar.") - @ConfigEditorBoolean - @ConfigAccordionId(id = 4) - public boolean showHeatBar = true; - - @Expose - @ConfigOption(name = "Bar Positions (Requires mode to be Moveable)", desc = "") - @ConfigAccordionId(id = 4) - @ConfigEditorAccordion(id = 5) - public boolean barPositions = false; - - @Expose - @ConfigOption(name = "Drill Bar Position", desc = "Allows you to change the position of the Drill Bar.") - @ConfigEditorButton(runnableId = "drill", buttonText = "Edit") - @ConfigAccordionId(id = 5) - public Position drillBar = new Position(-1, -1); - - @Expose - @ConfigOption(name = "Heat Bar Position", desc = "Allows you to change the position of the Heat Bar.") - @ConfigEditorButton(runnableId = "heat", buttonText = "Edit") - @ConfigAccordionId(id = 5) - public Position heatBar = new Position(-1, -9); - - @Expose - @ConfigOption(name = "Crystal Hollow Waypoints", desc = "") - @ConfigEditorAccordion(id = 6) - public boolean waypoints = false; - - @Expose - @ConfigOption(name = "Auto Waypoint", desc = "Turns on auto waypoints for the main areas of crystal hollows.") - @ConfigEditorBoolean - @ConfigAccordionId(id = 6) - public boolean autoWaypoint = true; - - @Expose - @ConfigOption(name = "Chat Waypoint Mode", desc = "Change the mode of the chat waypoint In Chat Bar will allow you to edit it before adding it to your waypoints.") - @ConfigEditorDropdown(values = { "Instant Add", "In chat bar" }) - @ConfigAccordionId(id = 6) - public int chatWaypointMode = 1; - } - // public static class Trackers { - // - // @Expose - // @ConfigOption(name = "Tracker Position", desc = "Allows you to change the position of the Trackers.") - // @ConfigEditorButton(runnableId = "tracker", buttonText = "Edit") - // public Position trackerPosition = new Position(-1, 200); - // - // @Expose - // @ConfigOption(name = "Hide Tracker", desc = "It will still track the data just in case.") - // @ConfigEditorBoolean - // public boolean hideTracker = true; - // } -} +//package com.thatgravyboat.skyblockhud.config; +// +//import com.google.gson.annotations.Expose; +//import at.lorenz.mod.LorenzMod; +//import com.thatgravyboat.skyblockhud.core.GuiScreenElementWrapper; +//import com.thatgravyboat.skyblockhud.core.config.Config; +//import com.thatgravyboat.skyblockhud.core.config.Position; +//import com.thatgravyboat.skyblockhud.core.config.annotations.*; +//import com.thatgravyboat.skyblockhud.core.config.gui.GuiPositionEditor; +//import java.util.ArrayList; +//import java.util.Arrays; +//import java.util.List; +//import net.minecraft.client.Minecraft; +// +//public class SBHConfig extends Config { +// +// private void editOverlay(String activeConfig, int width, int height, Position position) { +// Minecraft.getMinecraft().displayGuiScreen(new GuiPositionEditor(position, width, height, () -> {}, () -> {}, () -> LorenzMod.screenToOpen = new GuiScreenElementWrapper(new SBHConfigEditor(LorenzMod.config, activeConfig)))); +// } +// +// public void executeRunnable(String runnableId) { +// // String activeConfigCategory = null; +// // if (Minecraft.getMinecraft().currentScreen instanceof GuiScreenElementWrapper) { +// // GuiScreenElementWrapper wrapper = (GuiScreenElementWrapper) Minecraft.getMinecraft().currentScreen; +// // if (wrapper.element instanceof SBHConfigEditor) { +// // activeConfigCategory = ((SBHConfigEditor) wrapper.element).getSelectedCategoryName(); +// // } +// // } +// // +// // switch (runnableId) { +// // case "rpg": +// // editOverlay(activeConfigCategory, 120, 47, rpg.rpgHudPosition); +// // return; +// // case "d1": +// // editOverlay(activeConfigCategory, 120, 32, dungeon.dungeonPlayer1); +// // return; +// // case "d2": +// // editOverlay(activeConfigCategory, 120, 32, dungeon.dungeonPlayer2); +// // return; +// // case "d3": +// // editOverlay(activeConfigCategory, 120, 32, dungeon.dungeonPlayer3); +// // return; +// // case "d4": +// // editOverlay(activeConfigCategory, 120, 32, dungeon.dungeonPlayer4); +// // return; +// // case "main": +// // editOverlay(activeConfigCategory, 1000, 34, main.mainHudPos); +// // return; +// // case "ultimate": +// // editOverlay(activeConfigCategory, 182, 5, dungeon.barPosition); +// // return; +// // case "map": +// // editOverlay(activeConfigCategory, 72, 72, map.miniMapPosition); +// // return; +// // case "tracker": +// // editOverlay(activeConfigCategory, 130, 70, trackers.trackerPosition); +// // return; +// // case "drill": +// // editOverlay(activeConfigCategory, 136, 7, mining.drillBar); +// // return; +// // case "heat": +// // editOverlay(activeConfigCategory, 45, 7, mining.heatBar); +// // return; +// // case "dialogue": +// // editOverlay(activeConfigCategory, 182, 68, misc.dialoguePos); +// // return; +// // } +// } +// +// @Expose +// @Category(name = "Lorenz Options", desc = "Just a test by lorenz.") +// public Lorenz lorenz = new Lorenz(); +// +// @Expose +// @Category(name = "Misc Options", desc = "Just a bunch of random options.") +// public Misc misc = new Misc(); +// +// @Expose +// @Category(name = "Main Hud", desc = "All Options for the main hud.") +// public MainHud main = new MainHud(); +// +// @Expose +// @Category(name = "RPG Hud", desc = "All Options for the RPG hud.") +// public RPGHud rpg = new RPGHud(); +// +// @Expose +// @Category(name = "Dungeon Hud", desc = "All Options for the Dungeon hud.") +// public DungeonHud dungeon = new DungeonHud(); +// +// @Expose +// @Category(name = "Renderer", desc = "All Options for rendering.") +// public Renderer renderer = new Renderer(); +// +// @Expose +// @Category(name = "Map", desc = "All Options for the Map.") +// public Map map = new Map(); +// +// @Expose +// @Category(name = "Mining", desc = "All Options for the Mining Stuff.") +// public Mining mining = new Mining(); +// +// // @Expose +// // @Category(name = "Tracker", desc = "All Options for the Trackers.") +// // public Trackers trackers = new Trackers(); +// +// public static class Lorenz { +// +// @Expose +// @ConfigOption(name = "Lorenz Small Test A", desc = "abc") +// @ConfigEditorBoolean +// public boolean test = false; +// +// @Expose +// @ConfigOption(name = "Lorenz Small Test B", desc = "abc") +// @ConfigEditorBoolean +// public boolean test2 = false; +// +// @Expose +// @ConfigOption(name = "Lorenz Small Test C", desc = "abc") +// @ConfigEditorBoolean +// public boolean test3 = false; +// } +// +// public static class Misc { +// +// @Expose +// @ConfigOption(name = "Hide Scoreboard", desc = "Hides the scoreboard when in Skyblock.") +// @ConfigEditorBoolean +// public boolean hideScoreboard = false; +// +// @Expose +// @ConfigOption(name = "Texture Styles", desc = "If this list only contains 1 thing that means your texture pack doesnt support styles") +// @ConfigEditorStyle +// public int style = 0; +// +// @Expose +// @ConfigOption(name = "Hide Dialogue Box", desc = "Hides the Dialogue Box.") +// @ConfigEditorBoolean +// public boolean hideDialogueBox = true; +// +// @Expose +// @ConfigOption(name = "Dialogue Box", desc = "") +// @ConfigEditorButton(runnableId = "dialogue", buttonText = "Edit") +// public Position dialoguePos = new Position(0, -50, true, false); +// +// @Expose +// @ConfigOption(name = "Hide Item Cooldowns", desc = "Hides item cooldowns") +// @ConfigEditorBoolean +// public boolean hideItemCooldowns = false; +// } +// +// 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); +// +// @Expose +// @ConfigOption(name = "Twelve Hour Clock", desc = "Allows you to change the clock to be 12 hour instead of 24 hour.") +// @ConfigEditorBoolean +// public boolean twelveHourClock = false; +// +// @Expose +// @ConfigOption(name = "Shift hud with boss", desc = "Shifts the hud when bossbar is visible.") +// @ConfigEditorBoolean +// public boolean bossShiftHud = true; +// +// @Expose +// @ConfigOption(name = "Require Redstone", desc = "Allows to make it so that the redstone percentage requires you to hold a redstone item to show.") +// @ConfigEditorBoolean +// public boolean requireRedstone = true; +// } +// +// public static class RPGHud { +// +// @Expose +// @ConfigOption(name = "Show RPG Hud", desc = "Allows you to show or hide the RPG Hud.") +// @ConfigEditorBoolean +// public boolean showRpgHud = true; +// +// @Expose +// @ConfigOption(name = "Flip Hud", desc = "Flips the hud when half way across the screen.") +// @ConfigEditorBoolean +// public boolean flipHud = true; +// +// @Expose +// @ConfigOption(name = "RPG Hud Position", desc = "Allows you to change the position of the RPG Hud.") +// @ConfigEditorButton(runnableId = "rpg", buttonText = "Edit") +// public Position rpgHudPosition = new Position(1, 1); +// } +// +// public static class DungeonHud { +// +// @Expose +// @ConfigOption(name = "Dungeon Ultimate Bar", desc = "") +// @ConfigEditorAccordion(id = 2) +// public boolean ultimateBar = false; +// +// @Expose +// @ConfigOption(name = "Hide Ultimate Bar", desc = "Hides the custom ultimate bar.") +// @ConfigEditorBoolean +// @ConfigAccordionId(id = 2) +// public boolean hideUltimateBar = false; +// +// @Expose +// @ConfigOption(name = "Bar Position", desc = "Change the position of the bar.") +// @ConfigEditorButton(runnableId = "ultimate", buttonText = "Edit") +// @ConfigAccordionId(id = 2) +// public Position barPosition = new Position(0, 50, true, false); +// +// @Expose +// @ConfigOption(name = "Bar Loading Color", desc = "The color of the bar when its loading.") +// @ConfigEditorColour +// @ConfigAccordionId(id = 2) +// public String barLoadColor = "159:0:0:0:255"; +// +// @Expose +// @ConfigOption(name = "Bar Full Color", desc = "The color of the bar when its full.") +// @ConfigEditorColour +// @ConfigAccordionId(id = 2) +// public String barFullColor = "255:0:0:0:255"; +// +// @Expose +// @ConfigOption(name = "Bar Style", desc = "Change the style of the bar") +// @ConfigEditorDropdown(values = { "No Notch", "6 Notch", "10 Notch", "12 Notch", "20 Notch" }) +// @ConfigAccordionId(id = 2) +// public int barStyle = 2; +// +// @Expose +// @ConfigOption(name = "Dungeon Players", desc = "") +// @ConfigEditorAccordion(id = 1) +// public boolean dungeonPlayerAccordion = false; +// +// @Expose +// @ConfigOption(name = "Hide Dungeon Players", desc = "Allows you to hide the dungeon player hud") +// @ConfigEditorBoolean +// @ConfigAccordionId(id = 1) +// public boolean hideDungeonPlayers = false; +// +// @Expose +// @ConfigOption(name = "Dungeon Player Opacity", desc = "Allows you to change the opacity of the dungeon players.") +// @ConfigEditorSlider(minValue = 0, maxValue = 100, minStep = 1) +// @ConfigAccordionId(id = 1) +// public int dungeonPlayerOpacity = 0; +// +// @Expose +// @ConfigOption(name = "Hide Dead Players", desc = "Allows you to hide players that are dead or have left.") +// @ConfigEditorBoolean +// @ConfigAccordionId(id = 1) +// public boolean hideDeadDungeonPlayers = false; +// +// @Expose +// @ConfigOption(name = "Player Position 1", desc = "Change the position of this dungeon player.") +// @ConfigEditorButton(runnableId = "d1", buttonText = "Edit") +// @ConfigAccordionId(id = 1) +// public Position dungeonPlayer1 = new Position(5, 5); +// +// @Expose +// @ConfigOption(name = "Player Position 2", desc = "Change the position of this dungeon player.") +// @ConfigEditorButton(runnableId = "d2", buttonText = "Edit") +// @ConfigAccordionId(id = 1) +// public Position dungeonPlayer2 = new Position(5, 42); +// +// @Expose +// @ConfigOption(name = "Player Position 3", desc = "Change the position of this dungeon player.") +// @ConfigEditorButton(runnableId = "d3", buttonText = "Edit") +// @ConfigAccordionId(id = 1) +// public Position dungeonPlayer3 = new Position(5, 79); +// +// @Expose +// @ConfigOption(name = "Player Position 4", desc = "Change the position of this dungeon player.") +// @ConfigEditorButton(runnableId = "d4", buttonText = "Edit") +// @ConfigAccordionId(id = 1) +// public Position dungeonPlayer4 = new Position(5, 116); +// } +// +// public static class Renderer { +// +// @Expose +// @ConfigOption(name = "Add Overflow Mana Back", desc = "Adds overflow mana back to the actionbar") +// @ConfigEditorBoolean +// public boolean addOverflowMana = false; +// +// @Expose +// @ConfigOption(name = "Hide Boss Bar", desc = "Hides Boss Bar when certain conditions are met such as the name is just wither or it starts with objective:") +// @ConfigEditorBoolean +// public boolean hideBossBar = true; +// +// @Expose +// @ConfigOption(name = "Hide XP Bar", desc = "Hides xp bar.") +// @ConfigEditorBoolean +// public boolean hideXpBar = true; +// +// @Expose +// @ConfigOption(name = "Hide Food", desc = "Hides food.") +// @ConfigEditorBoolean +// public boolean hideFood = true; +// +// @Expose +// @ConfigOption(name = "Hide air", desc = "Hides air.") +// @ConfigEditorBoolean +// public boolean hideAir = true; +// +// @Expose +// @ConfigOption(name = "Hide hearts", desc = "Hides hearts.") +// @ConfigEditorBoolean +// public boolean hideHearts = true; +// +// @Expose +// @ConfigOption(name = "Hide armor", desc = "Hides armor.") +// @ConfigEditorBoolean +// public boolean hideArmor = true; +// +// @Expose +// @ConfigOption(name = "Hide Animal Hearts", desc = "Hides Animal Hearts.") +// @ConfigEditorBoolean +// public boolean hideAnimalHearts = true; +// } +// +// public static class Map { +// +// @Expose +// @ConfigOption(name = "Show Player Location", desc = "This feature is off by default as Hypixel's rules are so vague that this would fall under their disallowed modifications.") +// @ConfigEditorBoolean +// public boolean showPlayerLocation = false; +// +// @Expose +// @ConfigOption(name = "Show Mini-Map", desc = "Shows the Mini-Map on your overlay if turned off you can still use /sbhmap to see the map in fullscreen.") +// @ConfigEditorBoolean +// public boolean showMiniMap = false; +// +// @Expose +// @ConfigOption(name = "Map Locations", desc = "Remove a location from this list if you would like the map to not show up in that location. This is so you can use other mods maps.") +// @ConfigEditorDraggableList(exampleText = { "HUB", "BARN", "MUSHROOMDESERT", "GOLDMINE (No Map Yet)", "DEEPCAVERNS (No Map Yet)", "SPIDERSDEN", "PARK", "FORTRESS", "DUNGEONHUB (No Map Yet)", "JERRY (No Map Yet)", "THEEND (No Map Yet)", "DWARVENMINES", "CRYSTALHOLLOWS" }) +// public List<Integer> mapLocations = new ArrayList<>(Arrays.asList(0, 1, 2, 5, 6, 7, 11)); +// +// @Expose +// @ConfigOption(name = "Mini-Map Position", desc = "Allows you to change the position of the Mini-Map.") +// @ConfigEditorButton(runnableId = "map", buttonText = "Edit") +// public Position miniMapPosition = new Position(0, 100, false, false); +// +// @Expose +// @ConfigOption(name = "Icons", desc = "") +// @ConfigEditorAccordion(id = 3) +// public boolean icons = false; +// +// @Expose +// @ConfigOption(name = "NPC", desc = "Show NPC Icons") +// @ConfigEditorBoolean +// @ConfigAccordionId(id = 3) +// public boolean showNpcIcons = true; +// +// @Expose +// @ConfigOption(name = "Info", desc = "Show Info Icons") +// @ConfigEditorBoolean +// @ConfigAccordionId(id = 3) +// public boolean showInfoIcons = true; +// +// @Expose +// @ConfigOption(name = "Misc", desc = "Show Misc Icons") +// @ConfigEditorBoolean +// @ConfigAccordionId(id = 3) +// public boolean showMiscIcons = true; +// +// @Expose +// @ConfigOption(name = "Shops", desc = "Show Shop Icons") +// @ConfigEditorBoolean +// @ConfigAccordionId(id = 3) +// public boolean showShopIcons = true; +// +// @Expose +// @ConfigOption(name = "Quests", desc = "Show Quest Icons") +// @ConfigEditorBoolean +// @ConfigAccordionId(id = 3) +// public boolean showQuestIcons = false; +// } +// +// public static class Mining { +// +// @Expose +// @ConfigOption(name = "Mining Bars", desc = "") +// @ConfigEditorAccordion(id = 4) +// public boolean miningBars = false; +// +// @Expose +// @ConfigOption(name = "Bar Mode", desc = "Change the mode of bar. Static mode will allow it to auto replace the xp when drill is held or you are heating up.") +// @ConfigEditorDropdown(values = { "Moveable", "Static" }) +// @ConfigAccordionId(id = 4) +// public int barMode = 1; +// +// @Expose +// @ConfigOption(name = "Show Drill Bar", desc = "Allows you to show or hide the Drill Bar.") +// @ConfigEditorBoolean +// @ConfigAccordionId(id = 4) +// public boolean showDrillBar = true; +// +// @Expose +// @ConfigOption(name = "Show Heat Bar", desc = "Allows you to show or hide the Heat Bar.") +// @ConfigEditorBoolean +// @ConfigAccordionId(id = 4) +// public boolean showHeatBar = true; +// +// @Expose +// @ConfigOption(name = "Bar Positions (Requires mode to be Moveable)", desc = "") +// @ConfigAccordionId(id = 4) +// @ConfigEditorAccordion(id = 5) +// public boolean barPositions = false; +// +// @Expose +// @ConfigOption(name = "Drill Bar Position", desc = "Allows you to change the position of the Drill Bar.") +// @ConfigEditorButton(runnableId = "drill", buttonText = "Edit") +// @ConfigAccordionId(id = 5) +// public Position drillBar = new Position(-1, -1); +// +// @Expose +// @ConfigOption(name = "Heat Bar Position", desc = "Allows you to change the position of the Heat Bar.") +// @ConfigEditorButton(runnableId = "heat", buttonText = "Edit") +// @ConfigAccordionId(id = 5) +// public Position heatBar = new Position(-1, -9); +// +// @Expose +// @ConfigOption(name = "Crystal Hollow Waypoints", desc = "") +// @ConfigEditorAccordion(id = 6) +// public boolean waypoints = false; +// +// @Expose +// @ConfigOption(name = "Auto Waypoint", desc = "Turns on auto waypoints for the main areas of crystal hollows.") +// @ConfigEditorBoolean +// @ConfigAccordionId(id = 6) +// public boolean autoWaypoint = true; +// +// @Expose +// @ConfigOption(name = "Chat Waypoint Mode", desc = "Change the mode of the chat waypoint In Chat Bar will allow you to edit it before adding it to your waypoints.") +// @ConfigEditorDropdown(values = { "Instant Add", "In chat bar" }) +// @ConfigAccordionId(id = 6) +// public int chatWaypointMode = 1; +// } +// // public static class Trackers { +// // +// // @Expose +// // @ConfigOption(name = "Tracker Position", desc = "Allows you to change the position of the Trackers.") +// // @ConfigEditorButton(runnableId = "tracker", buttonText = "Edit") +// // public Position trackerPosition = new Position(-1, 200); +// // +// // @Expose +// // @ConfigOption(name = "Hide Tracker", desc = "It will still track the data just in case.") +// // @ConfigEditorBoolean +// // public boolean hideTracker = true; +// // } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java index f8f5dc66c..1e8fd5721 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java @@ -3,10 +3,10 @@ package com.thatgravyboat.skyblockhud.config; import static com.thatgravyboat.skyblockhud.GuiTextures.DISCORD; import static com.thatgravyboat.skyblockhud.GuiTextures.TWITTER; +import at.lorenz.mod.config.Features; import com.google.common.collect.Lists; import com.thatgravyboat.skyblockhud.core.GlScissorStack; import com.thatgravyboat.skyblockhud.core.GuiElement; -import com.thatgravyboat.skyblockhud.core.config.Config; import com.thatgravyboat.skyblockhud.core.config.gui.GuiOptionEditor; import com.thatgravyboat.skyblockhud.core.config.gui.GuiOptionEditorAccordion; import com.thatgravyboat.skyblockhud.core.config.struct.ConfigProcessor; @@ -44,11 +44,11 @@ public class SBHConfigEditor extends GuiElement { private final TreeMap<String, Set<ConfigProcessor.ProcessedOption>> searchOptionMap = new TreeMap<>(); private final HashMap<ConfigProcessor.ProcessedOption, ConfigProcessor.ProcessedCategory> categoryForOption = new HashMap<>(); - public SBHConfigEditor(Config config) { + public SBHConfigEditor(Features config) { this(config, null); } - public SBHConfigEditor(Config config, String categoryOpen) { + public SBHConfigEditor(Features config, String categoryOpen) { this.openedMillis = System.currentTimeMillis(); this.processedConfig = ConfigProcessor.create(config); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/Config.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/Config.java index dbbca7495..6baf651b4 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/Config.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/Config.java @@ -1,6 +1,6 @@ package com.thatgravyboat.skyblockhud.core.config; -public class Config { - - public void executeRunnable(String runnableId) {} -} +//public class Config { +// +// public void executeRunnable(String runnableId) {} +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorButton.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorButton.java index 9cc76c283..0d2f99faa 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorButton.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorButton.java @@ -2,7 +2,7 @@ package com.thatgravyboat.skyblockhud.core.config.gui; import static com.thatgravyboat.skyblockhud.GuiTextures.button_tex; -import com.thatgravyboat.skyblockhud.core.config.Config; +import at.lorenz.mod.config.Features; import com.thatgravyboat.skyblockhud.core.config.struct.ConfigProcessor; import com.thatgravyboat.skyblockhud.core.util.render.RenderUtils; import com.thatgravyboat.skyblockhud.core.util.render.TextRenderUtils; @@ -12,11 +12,11 @@ import org.lwjgl.input.Mouse; public class GuiOptionEditorButton extends GuiOptionEditor { - private String runnableId; + private final String runnableId; private String buttonText; - private Config config; + private final Features config; - public GuiOptionEditorButton(ConfigProcessor.ProcessedOption option, String runnableId, String buttonText, Config config) { + public GuiOptionEditorButton(ConfigProcessor.ProcessedOption option, String runnableId, String buttonText, Features config) { super(option); this.runnableId = runnableId; this.config = config; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/struct/ConfigProcessor.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/struct/ConfigProcessor.java index 9e0a9d899..a1a901cdb 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/struct/ConfigProcessor.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/struct/ConfigProcessor.java @@ -1,7 +1,7 @@ package com.thatgravyboat.skyblockhud.core.config.struct; +import at.lorenz.mod.config.Features; import com.google.gson.annotations.Expose; -import com.thatgravyboat.skyblockhud.core.config.Config; import com.thatgravyboat.skyblockhud.core.config.annotations.*; import com.thatgravyboat.skyblockhud.core.config.gui.*; import java.lang.reflect.Field; @@ -66,7 +66,7 @@ public class ConfigProcessor { } } - public static LinkedHashMap<String, ProcessedCategory> create(Config config) { + public static LinkedHashMap<String, ProcessedCategory> create(Features config) { LinkedHashMap<String, ProcessedCategory> processedConfig = new LinkedHashMap<>(); for (Field categoryField : config.getClass().getDeclaredFields()) { boolean exposePresent = categoryField.isAnnotationPresent(Expose.class); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/dungeons/DungeonHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/dungeons/DungeonHandler.java index 5a5e4ec16..e2117c26f 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/dungeons/DungeonHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/dungeons/DungeonHandler.java @@ -1,195 +1,195 @@ -package com.thatgravyboat.skyblockhud.dungeons; - -import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent; -import com.thatgravyboat.skyblockhud.api.events.SidebarPostEvent; -import com.thatgravyboat.skyblockhud.location.LocationHandler; -import com.thatgravyboat.skyblockhud.location.Locations; -import com.thatgravyboat.skyblockhud.utils.Utils; -import java.util.HashMap; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import net.minecraft.client.Minecraft; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class DungeonHandler { - - private static final HashMap<String, DungeonPlayer> dungeonPlayersMap = new HashMap<>(); - private static int dungeonTime = 0; - private static int dungeonCleared = 0; - private static boolean bloodKey = false; - private static int witherKeys = 0; - private static int maxSecrets = 0; - private static int secrets = 0; - private static int totalSecrets = 0; - private static int deaths = 0; - private static int crypts = 0; - - private static final Pattern DungeonPlayerRegex = Pattern.compile("^\\[([HMBAT])] ([\\w]+) ([0-9]+|DEAD)$"); - - @SubscribeEvent - public void onSidebarLineUpdate(SidebarLineUpdateEvent event) { - if (LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) { - DungeonHandler.checkForDungeonTime(event.formattedLine); - DungeonHandler.checkForDungeonCleared(event.formattedLine); - DungeonHandler.checkForDungeonKeys(event.formattedLine, event.rawLine); - DungeonHandler.checkForDungeonPlayers(event.formattedLine, Minecraft.getMinecraft()); - } - } - - @SubscribeEvent - public void onSidebarPost(SidebarPostEvent event) { - if (!LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) { - DungeonHandler.clearDungeonStats(); - } - } - - public static void checkForDungeonPlayers(String scoreLine, Minecraft mc) { - Matcher dungeonMatcher = DungeonPlayerRegex.matcher(scoreLine); - if (dungeonMatcher.matches() && DungeonHandler.dungeonTime > 0) { - Classes playerClass = Classes.valueOf(dungeonMatcher.group(1)); - String displayName = dungeonMatcher.group(2); - String health = dungeonMatcher.group(3); - if (!mc.thePlayer.getName().toLowerCase().startsWith(displayName.toLowerCase().trim())) { - int healthNum = 0; - if (!health.equalsIgnoreCase("dead")) { - try { - healthNum = Integer.parseInt(health); - } catch (NumberFormatException ignored) {} - } - DungeonPlayer player = new DungeonPlayer(playerClass, displayName, healthNum, health.equalsIgnoreCase("dead")); - dungeonPlayersMap.put(displayName.toLowerCase(), player); - } - } - } - - public static void checkForDungeonTime(String scoreLine) { - if (scoreLine.toLowerCase().trim().contains("time elapsed:")) { - String timeLine = scoreLine.toLowerCase().trim().replace("time elapsed:", ""); - String[] times = timeLine.split("m "); - int time = 0; - try { - time += Integer.parseInt(times[0].replace(" ", "").replace("m", "")) * 60; - time += Integer.parseInt(times[1].replace(" ", "").replace("s", "")); - } catch (NumberFormatException ignored) {} - dungeonTime = time; - } - } - - public static void checkForDungeonCleared(String scoreline) { - if (scoreline.toLowerCase().trim().contains("dungeon cleared:")) { - String dungeonClearedText = scoreline.toLowerCase().trim().replace("dungeon cleared:", "").replace(" ", "").replace("%", ""); - try { - dungeonCleared = Integer.parseInt(dungeonClearedText); - } catch (NumberFormatException ignored) {} - } - } - - public static void checkForDungeonKeys(String scoreline, String rawString) { - if (scoreline.toLowerCase().trim().contains("keys:")) { - String dungeonClearedText = scoreline.toLowerCase().trim().replace("keys:", "").replace(" ", "").replace("x", ""); - bloodKey = rawString.contains("\u2713"); - try { - witherKeys = Integer.parseInt(dungeonClearedText); - } catch (NumberFormatException ignored) {} - } - } - - public static void parseSecrets(String statusBar) { - boolean hasSecrets = false; - String[] parts = statusBar.split(" {4,}"); - for (String part : parts) { - if (part.toLowerCase().contains("secrets") && !statusBar.toLowerCase().contains("no secrets")) { - hasSecrets = true; - try { - String secret = Utils.removeColor(part.replace("Secrets", "")).replace(" ", ""); - maxSecrets = Integer.parseInt(secret.split("/")[1]); - secrets = Integer.parseInt(secret.split("/")[0]); - } catch (NumberFormatException ignored) {} - } - } - if (!hasSecrets) { - maxSecrets = 0; - secrets = 0; - } - } - - public static void parseTotalSecrets(String playerName) { - if (playerName.toLowerCase().contains("secrets found:")) { - String totalSecret = Utils.removeColor(playerName.toLowerCase().replace("secrets found:", "")).replace(" ", ""); - try { - totalSecrets = Integer.parseInt(totalSecret); - } catch (NumberFormatException ignored) {} - } - } - - public static void parseDeaths(String playerName) { - if (playerName.toLowerCase().contains("deaths:")) { - String death = Utils.removeColor(playerName.toLowerCase().replace("deaths:", "")).replace("(", "").replace(")", "").replace(" ", ""); - try { - deaths = Integer.parseInt(death); - } catch (NumberFormatException ignored) {} - } - } - - public static void parseCrypts(String playerName) { - if (playerName.toLowerCase().contains("crypts:")) { - String crypt = Utils.removeColor(playerName.toLowerCase().replace("crypts:", "")).replace(" ", ""); - try { - crypts = Integer.parseInt(crypt); - } catch (NumberFormatException ignored) {} - } - } - - public static void clearDungeonStats() { - dungeonPlayersMap.clear(); - dungeonTime = 0; - dungeonCleared = 0; - bloodKey = false; - witherKeys = 0; - maxSecrets = 0; - secrets = 0; - totalSecrets = 0; - deaths = 0; - crypts = 0; - } - - public static HashMap<String, DungeonPlayer> getDungeonPlayers() { - return dungeonPlayersMap; - } - - public static int getDungeonTime() { - return dungeonTime; - } - - public static int getDungeonCleared() { - return dungeonCleared; - } - - public static int getWitherKeys() { - return witherKeys; - } - - public static boolean hasBloodkey() { - return bloodKey; - } - - public static int getMaxSecrets() { - return maxSecrets; - } - - public static int getSecrets() { - return secrets; - } - - public static int getDeaths() { - return deaths; - } - - public static int getTotalSecrets() { - return totalSecrets; - } - - public static int getCrypts() { - return crypts; - } -} +//package com.thatgravyboat.skyblockhud.dungeons; +// +//import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent; +//import com.thatgravyboat.skyblockhud.api.events.SidebarPostEvent; +//import com.thatgravyboat.skyblockhud.location.LocationHandler; +//import com.thatgravyboat.skyblockhud.location.Locations; +//import com.thatgravyboat.skyblockhud.utils.Utils; +//import java.util.HashMap; +//import java.util.regex.Matcher; +//import java.util.regex.Pattern; +//import net.minecraft.client.Minecraft; +//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +// +//public class DungeonHandler { +// +// private static final HashMap<String, DungeonPlayer> dungeonPlayersMap = new HashMap<>(); +// private static int dungeonTime = 0; +// private static int dungeonCleared = 0; +// private static boolean bloodKey = false; +// private static int witherKeys = 0; +// private static int maxSecrets = 0; +// private static int secrets = 0; +// private static int totalSecrets = 0; +// private static int deaths = 0; +// private static int crypts = 0; +// +// private static final Pattern DungeonPlayerRegex = Pattern.compile("^\\[([HMBAT])] ([\\w]+) ([0-9]+|DEAD)$"); +// +// @SubscribeEvent +// public void onSidebarLineUpdate(SidebarLineUpdateEvent event) { +// if (LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) { +// DungeonHandler.checkForDungeonTime(event.formattedLine); +// DungeonHandler.checkForDungeonCleared(event.formattedLine); +// DungeonHandler.checkForDungeonKeys(event.formattedLine, event.rawLine); +// DungeonHandler.checkForDungeonPlayers(event.formattedLine, Minecraft.getMinecraft()); +// } +// } +// +// @SubscribeEvent +// public void onSidebarPost(SidebarPostEvent event) { +// if (!LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) { +// DungeonHandler.clearDungeonStats(); +// } +// } +// +// public static void checkForDungeonPlayers(String scoreLine, Minecraft mc) { +// Matcher dungeonMatcher = DungeonPlayerRegex.matcher(scoreLine); +// if (dungeonMatcher.matches() && DungeonHandler.dungeonTime > 0) { +// Classes playerClass = Classes.valueOf(dungeonMatcher.group(1)); +// String displayName = dungeonMatcher.group(2); +// String health = dungeonMatcher.group(3); +// if (!mc.thePlayer.getName().toLowerCase().startsWith(displayName.toLowerCase().trim())) { +// int healthNum = 0; +// if (!health.equalsIgnoreCase("dead")) { +// try { +// healthNum = Integer.parseInt(health); +// } catch (NumberFormatException ignored) {} +// } +// DungeonPlayer player = new DungeonPlayer(playerClass, displayName, healthNum, health.equalsIgnoreCase("dead")); +// dungeonPlayersMap.put(displayName.toLowerCase(), player); +// } +// } +// } +// +// public static void checkForDungeonTime(String scoreLine) { +// if (scoreLine.toLowerCase().trim().contains("time elapsed:")) { +// String timeLine = scoreLine.toLowerCase().trim().replace("time elapsed:", ""); +// String[] times = timeLine.split("m "); +// int time = 0; +// try { +// time += Integer.parseInt(times[0].replace(" ", "").replace("m", "")) * 60; +// time += Integer.parseInt(times[1].replace(" ", "").replace("s", "")); +// } catch (NumberFormatException ignored) {} +// dungeonTime = time; +// } +// } +// +// public static void checkForDungeonCleared(String scoreline) { +// if (scoreline.toLowerCase().trim().contains("dungeon cleared:")) { +// String dungeonClearedText = scoreline.toLowerCase().trim().replace("dungeon cleared:", "").replace(" ", "").replace("%", ""); +// try { +// dungeonCleared = Integer.parseInt(dungeonClearedText); +// } catch (NumberFormatException ignored) {} +// } +// } +// +// public static void checkForDungeonKeys(String scoreline, String rawString) { +// if (scoreline.toLowerCase().trim().contains("keys:")) { +// String dungeonClearedText = scoreline.toLowerCase().trim().replace("keys:", "").replace(" ", "").replace("x", ""); +// bloodKey = rawString.contains("\u2713"); +// try { +// witherKeys = Integer.parseInt(dungeonClearedText); +// } catch (NumberFormatException ignored) {} +// } +// } +// +// public static void parseSecrets(String statusBar) { +// boolean hasSecrets = false; +// String[] parts = statusBar.split(" {4,}"); +// for (String part : parts) { +// if (part.toLowerCase().contains("secrets") && !statusBar.toLowerCase().contains("no secrets")) { +// hasSecrets = true; +// try { +// String secret = Utils.removeColor(part.replace("Secrets", "")).replace(" ", ""); +// maxSecrets = Integer.parseInt(secret.split("/")[1]); +// secrets = Integer.parseInt(secret.split("/")[0]); +// } catch (NumberFormatException ignored) {} +// } +// } +// if (!hasSecrets) { +// maxSecrets = 0; +// secrets = 0; +// } +// } +// +// public static void parseTotalSecrets(String playerName) { +// if (playerName.toLowerCase().contains("secrets found:")) { +// String totalSecret = Utils.removeColor(playerName.toLowerCase().replace("secrets found:", "")).replace(" ", ""); +// try { +// totalSecrets = Integer.parseInt(totalSecret); +// } catch (NumberFormatException ignored) {} +// } +// } +// +// public static void parseDeaths(String playerName) { +// if (playerName.toLowerCase().contains("deaths:")) { +// String death = Utils.removeColor(playerName.toLowerCase().replace("deaths:", "")).replace("(", "").replace(")", "").replace(" ", ""); +// try { +// deaths = Integer.parseInt(death); +// } catch (NumberFormatException ignored) {} +// } +// } +// +// public static void parseCrypts(String playerName) { +// if (playerName.toLowerCase().contains("crypts:")) { +// String crypt = Utils.removeColor(playerName.toLowerCase().replace("crypts:", "")).replace(" ", ""); +// try { +// crypts = Integer.parseInt(crypt); +// } catch (NumberFormatException ignored) {} +// } +// } +// +// public static void clearDungeonStats() { +// dungeonPlayersMap.clear(); +// dungeonTime = 0; +// dungeonCleared = 0; +// bloodKey = false; +// witherKeys = 0; +// maxSecrets = 0; +// secrets = 0; +// totalSecrets = 0; +// deaths = 0; +// crypts = 0; +// } +// +// public static HashMap<String, DungeonPlayer> getDungeonPlayers() { +// return dungeonPlayersMap; +// } +// +// public static int getDungeonTime() { +// return dungeonTime; +// } +// +// public static int getDungeonCleared() { +// return dungeonCleared; +// } +// +// public static int getWitherKeys() { +// return witherKeys; +// } +// +// public static boolean hasBloodkey() { +// return bloodKey; +// } +// +// public static int getMaxSecrets() { +// return maxSecrets; +// } +// +// public static int getSecrets() { +// return secrets; +// } +// +// public static int getDeaths() { +// return deaths; +// } +// +// public static int getTotalSecrets() { +// return totalSecrets; +// } +// +// public static int getCrypts() { +// return crypts; +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java index b92cee0ae..7c80fe6cc 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java @@ -1,36 +1,36 @@ -package com.thatgravyboat.skyblockhud.handlers; - -import at.lorenz.mod.LorenzMod; -import com.thatgravyboat.skyblockhud.location.LocationHandler; -import com.thatgravyboat.skyblockhud.location.Locations; -import com.thatgravyboat.skyblockhud.utils.Utils; -import net.minecraft.entity.boss.BossStatus; -import net.minecraftforge.client.event.RenderGameOverlayEvent; -import net.minecraftforge.fml.common.eventhandler.EventPriority; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class BossbarHandler { - - 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 (!LorenzMod.config.main.bossShiftHud) { - bossBarRendered = false; - } - String bossName = Utils.removeColor(BossStatus.bossName); - if (LorenzMod.config.renderer.hideBossBar && !LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) { - if (bossName.equalsIgnoreCase("wither")) { - event.setCanceled(true); - bossBarRendered = false; - } - if (bossName.toLowerCase().startsWith("objective:")) { - event.setCanceled(true); - bossBarRendered = false; - } - } - } - } -} +//package com.thatgravyboat.skyblockhud.handlers; +// +//import at.lorenz.mod.LorenzMod; +//import com.thatgravyboat.skyblockhud.location.LocationHandler; +//import com.thatgravyboat.skyblockhud.location.Locations; +//import com.thatgravyboat.skyblockhud.utils.Utils; +//import net.minecraft.entity.boss.BossStatus; +//import net.minecraftforge.client.event.RenderGameOverlayEvent; +//import net.minecraftforge.fml.common.eventhandler.EventPriority; +//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +// +//public class BossbarHandler { +// +// 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 (!LorenzMod.config.main.bossShiftHud) { +// bossBarRendered = false; +// } +// String bossName = Utils.removeColor(BossStatus.bossName); +// if (LorenzMod.config.renderer.hideBossBar && !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/CooldownHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CooldownHandler.java index 784e79db7..7c4d39ab6 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CooldownHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CooldownHandler.java @@ -1,121 +1,121 @@ -package com.thatgravyboat.skyblockhud.handlers; - -import com.google.common.collect.Sets; -import at.lorenz.mod.LorenzMod; -import com.thatgravyboat.skyblockhud.api.item.IAbility; -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; - -public class CooldownHandler { - - private static final Pattern ABILITY_REGEX = Pattern.compile("\u00A76Ability: (.*) \u00A7e\u00A7lRIGHT CLICK .* \u00A78Cooldown: \u00A7a(\\d*)s"); - - 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"); - if (display != null && display.hasKey("Lore")) { - NBTTagList lore = display.getTagList("Lore", 8); - List<String> loreList = new ArrayList<>(); - for (int i = 0; i < lore.tagCount(); i++) { - String loreLine = lore.getStringTagAt(i).trim(); - if (!loreLine.isEmpty()) loreList.add(loreLine); - } - Matcher abilityMatcher = ABILITY_REGEX.matcher(String.join(" ", loreList)); - if (abilityMatcher.find()) { - return abilityMatcher; - } - } - } - return null; - } - - 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 - public void tick(TickEvent.ClientTickEvent event) { - if (LorenzMod.config.misc.hideItemCooldowns) return; - if (event.phase.equals(TickEvent.Phase.END)) { - COOLDOWNS.values().forEach(Cooldown::tick); - COOLDOWNS.entrySet().removeIf(entry -> entry.getValue().isOver()); - } - } - - @SubscribeEvent - public void onPlayerInteract(PlayerInteractEvent event) { - if (LorenzMod.config.misc.hideItemCooldowns) return; - if (event.action.equals(PlayerInteractEvent.Action.RIGHT_CLICK_AIR) || event.action.equals(PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK)) { - if (event.entityPlayer.getHeldItem() != null) { - IAbility ability = (IAbility) ((Object) event.entityPlayer.getHeldItem()); - if (ability.getAbility() != null) { - addCooldown(ability, false); - } - } - } - } - - public static float getAbilityTime(ItemStack stack) { - IAbility ability = (IAbility) ((Object) stack); - if (ability.getAbility() != null) { - return COOLDOWNS.containsKey(ability.getAbility()) ? COOLDOWNS.get(ability.getAbility()).getTime() : -1f; - } - return -1f; - } - - private static class Cooldown { - - public int current; - public final int end; - - Cooldown(int end) { - this.end = end; - } - - public boolean isOver() { - return current >= end; - } - - public void tick() { - current++; - } - - public float getTime() { - return current / (float) end; - } - } -} +//package com.thatgravyboat.skyblockhud.handlers; +// +//import com.google.common.collect.Sets; +//import at.lorenz.mod.LorenzMod; +//import com.thatgravyboat.skyblockhud.api.item.IAbility; +//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; +// +//public class CooldownHandler { +// +// private static final Pattern ABILITY_REGEX = Pattern.compile("\u00A76Ability: (.*) \u00A7e\u00A7lRIGHT CLICK .* \u00A78Cooldown: \u00A7a(\\d*)s"); +// +// 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"); +// if (display != null && display.hasKey("Lore")) { +// NBTTagList lore = display.getTagList("Lore", 8); +// List<String> loreList = new ArrayList<>(); +// for (int i = 0; i < lore.tagCount(); i++) { +// String loreLine = lore.getStringTagAt(i).trim(); +// if (!loreLine.isEmpty()) loreList.add(loreLine); +// } +// Matcher abilityMatcher = ABILITY_REGEX.matcher(String.join(" ", loreList)); +// if (abilityMatcher.find()) { +// return abilityMatcher; +// } +// } +// } +// return null; +// } +// +// 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 +// public void tick(TickEvent.ClientTickEvent event) { +// if (LorenzMod.config.misc.hideItemCooldowns) return; +// if (event.phase.equals(TickEvent.Phase.END)) { +// COOLDOWNS.values().forEach(Cooldown::tick); +// COOLDOWNS.entrySet().removeIf(entry -> entry.getValue().isOver()); +// } +// } +// +// @SubscribeEvent +// public void onPlayerInteract(PlayerInteractEvent event) { +// if (LorenzMod.config.misc.hideItemCooldowns) return; +// if (event.action.equals(PlayerInteractEvent.Action.RIGHT_CLICK_AIR) || event.action.equals(PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK)) { +// if (event.entityPlayer.getHeldItem() != null) { +// IAbility ability = (IAbility) ((Object) event.entityPlayer.getHeldItem()); +// if (ability.getAbility() != null) { +// addCooldown(ability, false); +// } +// } +// } +// } +// +// public static float getAbilityTime(ItemStack stack) { +// IAbility ability = (IAbility) ((Object) stack); +// if (ability.getAbility() != null) { +// return COOLDOWNS.containsKey(ability.getAbility()) ? COOLDOWNS.get(ability.getAbility()).getTime() : -1f; +// } +// return -1f; +// } +// +// private static class Cooldown { +// +// public int current; +// public final int end; +// +// Cooldown(int end) { +// this.end = end; +// } +// +// public boolean isOver() { +// return current >= end; +// } +// +// public void tick() { +// current++; +// } +// +// public float getTime() { +// return current / (float) end; +// } +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java index 593099c8f..6a160c790 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java @@ -1,196 +1,196 @@ -package com.thatgravyboat.skyblockhud.handlers; - -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; -import at.lorenz.mod.LorenzMod; -import com.thatgravyboat.skyblockhud.api.events.LocationChangeEvent; -import com.thatgravyboat.skyblockhud.commands.SimpleCommand; -import com.thatgravyboat.skyblockhud.location.LocationCategory; -import com.thatgravyboat.skyblockhud.location.LocationHandler; -import com.thatgravyboat.skyblockhud.location.Locations; -import com.thatgravyboat.skyblockhud.utils.Utils; -import java.awt.*; -import java.awt.datatransfer.StringSelection; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.command.ICommandSender; -import net.minecraft.event.ClickEvent; -import net.minecraft.event.HoverEvent; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.ChatStyle; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import net.minecraftforge.client.event.RenderWorldLastEvent; -import net.minecraftforge.event.entity.EntityJoinWorldEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class CrystalWaypoints { - - public static final Pattern LOCATION_MESSAGE_REGEX = Pattern.compile("\\{(.*) : \\((-?\\d+)/(-?\\d+)/(-?\\d+)\\)}"); - - public static final HashMap<String, BlockPos> waypoints = new HashMap<>(); - - private static final Set<Locations> IMPORTANT_WAYPOINTS = Sets.newHashSet(Locations.GOBLINQUEENSDEN, Locations.LOSTPRECURSORCITY, Locations.JUNGLETEMPLE, Locations.MINESOFDIVAN, Locations.KHAZADDM, Locations.FAIRYGROTTO); - - @SubscribeEvent - public void onRenderLast(RenderWorldLastEvent event) { - GlStateManager.disableCull(); - GlStateManager.disableDepth(); - waypoints.forEach((text, pos) -> Utils.renderWaypointText(text, pos, event.partialTicks)); - GlStateManager.enableCull(); - GlStateManager.enableDepth(); - } - - @SubscribeEvent - public void onWorldChange(EntityJoinWorldEvent event) { - if (event.entity == Minecraft.getMinecraft().thePlayer) { - waypoints.clear(); - } - } - - @SubscribeEvent - public void onLocationChange(LocationChangeEvent event) { - if (!event.newLocation.getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) { - waypoints.clear(); - } else if (!waypoints.containsKey("Crystal Nucleus") && LorenzMod.config.mining.autoWaypoint) { - waypoints.put("Crystal Nucleus", new BlockPos(512.5, 106.5, 512.5)); - } - if (IMPORTANT_WAYPOINTS.contains(event.newLocation) && LorenzMod.config.mining.autoWaypoint) { - if (!waypoints.containsKey(event.newLocation.getDisplayName())) { - waypoints.put(event.newLocation.getDisplayName(), Minecraft.getMinecraft().thePlayer.getPosition()); - } - } - } - - @SubscribeEvent - public void onChatMessage(ClientChatReceivedEvent event) { - if (event.type != 2 && LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) { - Matcher matcher = LOCATION_MESSAGE_REGEX.matcher(event.message.getUnformattedText()); - if (!matcher.find()) return; - ChatStyle style = new ChatStyle(); - style.setParentStyle(event.message.getChatStyle()); - ClickEvent.Action action = LorenzMod.config.mining.chatWaypointMode == 0 ? ClickEvent.Action.RUN_COMMAND : ClickEvent.Action.SUGGEST_COMMAND; - style.setChatClickEvent(new ClickEvent(action, "/sbhpoints addat " + matcher.group(2) + " " + matcher.group(3) + " " + matcher.group(4) + " " + matcher.group(1))); - style.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText("Click to add waypoint!").setChatStyle(new ChatStyle().setBold(true)))); - event.message.setChatStyle(style); - } - } - - private static String copyWayPoint(String name) { - BlockPos pos = waypoints.get(name); - if (pos == null) { - return null; - } - return "{" + name + " : (" + pos.getX() + "/" + pos.getY() + "/" + pos.getZ() + ")}"; - } - - public static class WaypointCommand extends SimpleCommand { - - public WaypointCommand() { - super( - "sbhpoints", - new ProcessCommandRunnable() { - @Override - public void processCommand(ICommandSender sender, String[] args) { - if (args.length == 0) return; - String subCommand = args[0].toLowerCase(); - String name = String.join(" ", Arrays.copyOfRange(args, 1, args.length)); - switch (subCommand) { - case "add": - if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) { - if (!CrystalWaypoints.waypoints.containsKey(name) && name.length() > 1) { - CrystalWaypoints.waypoints.put(name, sender.getPosition().add(0.5, 0.5, 0.5)); - } else if (name.length() < 2) { - sbhMessage(sender, "Waypoint name needs to be longer than 1"); - } else { - sbhMessage(sender, "Waypoint already exists!"); - } - } - break; - case "remove": - if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) { - if (CrystalWaypoints.waypoints.containsKey(name)) { - CrystalWaypoints.waypoints.remove(name); - } else { - sbhMessage(sender, "Waypoint doesnt exist!"); - } - } - break; - case "move": - if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) { - if (CrystalWaypoints.waypoints.containsKey(name)) { - CrystalWaypoints.waypoints.put(name, sender.getPosition().add(0.5, 0.5, 0.5)); - } else { - sbhMessage(sender, "Waypoint doesnt exist!"); - } - } - break; - case "clear": - CrystalWaypoints.waypoints.clear(); - break; - case "addat": - if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) { - name = String.join(" ", Arrays.copyOfRange(args, 4, args.length)); - try { - if (!CrystalWaypoints.waypoints.containsKey(name)) { - CrystalWaypoints.waypoints.put(name, parseBlockPos(sender, args, 1, true)); - } else if (name.length() < 2) { - sbhMessage(sender, "Waypoint name needs to be longer than 1"); - } else { - sbhMessage(sender, "Waypoint already exists!"); - } - } catch (Exception e) { - sbhMessage(sender, "Error!"); - } - } - break; - case "copy": - String copyText = copyWayPoint(name); - if (copyText == null) { - sbhMessage(sender, "No waypoint with that name!"); - break; - } - StringSelection clipboard = new StringSelection(copyText); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(clipboard, clipboard); - break; - case "send": - String sendText = copyWayPoint(name); - if (sendText == null) { - sbhMessage(sender, "No waypoint with that name!"); - break; - } - Minecraft.getMinecraft().thePlayer.sendChatMessage(sendText); - break; - } - } - }, - new TabCompleteRunnable() { - @Override - public List<String> tabComplete(ICommandSender sender, String[] args, BlockPos pos) { - if (args.length == 2 && Utils.equalsIgnoreCaseAnyOf(args[0], "remove", "copy", "move", "send")) { - return getListOfStringsMatchingLastWord(args, waypoints.keySet()); - } - if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, Lists.newArrayList("add", "clear", "remove", "copy", "addat", "move", "send")); - } - if (args.length > 1 && args[0].equalsIgnoreCase("addat")) { - return func_175771_a(args, 1, pos); - } - return null; - } - } - ); - } - - private static void sbhMessage(ICommandSender sender, String message) { - sender.addChatMessage(new ChatComponentText("[" + EnumChatFormatting.RED + EnumChatFormatting.BOLD + "SkyBlockHud" + EnumChatFormatting.RESET + "] : " + EnumChatFormatting.GRAY + message)); - } - } -} +//package com.thatgravyboat.skyblockhud.handlers; +// +//import com.google.common.collect.Lists; +//import com.google.common.collect.Sets; +//import at.lorenz.mod.LorenzMod; +//import com.thatgravyboat.skyblockhud.api.events.LocationChangeEvent; +//import com.thatgravyboat.skyblockhud.commands.SimpleCommand; +//import com.thatgravyboat.skyblockhud.location.LocationCategory; +//import com.thatgravyboat.skyblockhud.location.LocationHandler; +//import com.thatgravyboat.skyblockhud.location.Locations; +//import com.thatgravyboat.skyblockhud.utils.Utils; +//import java.awt.*; +//import java.awt.datatransfer.StringSelection; +//import java.util.Arrays; +//import java.util.HashMap; +//import java.util.List; +//import java.util.Set; +//import java.util.regex.Matcher; +//import java.util.regex.Pattern; +//import net.minecraft.client.Minecraft; +//import net.minecraft.client.renderer.GlStateManager; +//import net.minecraft.command.ICommandSender; +//import net.minecraft.event.ClickEvent; +//import net.minecraft.event.HoverEvent; +//import net.minecraft.util.BlockPos; +//import net.minecraft.util.ChatComponentText; +//import net.minecraft.util.ChatStyle; +//import net.minecraft.util.EnumChatFormatting; +//import net.minecraftforge.client.event.ClientChatReceivedEvent; +//import net.minecraftforge.client.event.RenderWorldLastEvent; +//import net.minecraftforge.event.entity.EntityJoinWorldEvent; +//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +// +//public class CrystalWaypoints { +// +// public static final Pattern LOCATION_MESSAGE_REGEX = Pattern.compile("\\{(.*) : \\((-?\\d+)/(-?\\d+)/(-?\\d+)\\)}"); +// +// public static final HashMap<String, BlockPos> waypoints = new HashMap<>(); +// +// private static final Set<Locations> IMPORTANT_WAYPOINTS = Sets.newHashSet(Locations.GOBLINQUEENSDEN, Locations.LOSTPRECURSORCITY, Locations.JUNGLETEMPLE, Locations.MINESOFDIVAN, Locations.KHAZADDM, Locations.FAIRYGROTTO); +// +// @SubscribeEvent +// public void onRenderLast(RenderWorldLastEvent event) { +// GlStateManager.disableCull(); +// GlStateManager.disableDepth(); +// waypoints.forEach((text, pos) -> Utils.renderWaypointText(text, pos, event.partialTicks)); +// GlStateManager.enableCull(); +// GlStateManager.enableDepth(); +// } +// +// @SubscribeEvent +// public void onWorldChange(EntityJoinWorldEvent event) { +// if (event.entity == Minecraft.getMinecraft().thePlayer) { +// waypoints.clear(); +// } +// } +// +// @SubscribeEvent +// public void onLocationChange(LocationChangeEvent event) { +// if (!event.newLocation.getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) { +// waypoints.clear(); +// } else if (!waypoints.containsKey("Crystal Nucleus") && LorenzMod.config.mining.autoWaypoint) { +// waypoints.put("Crystal Nucleus", new BlockPos(512.5, 106.5, 512.5)); +// } +// if (IMPORTANT_WAYPOINTS.contains(event.newLocation) && LorenzMod.config.mining.autoWaypoint) { +// if (!waypoints.containsKey(event.newLocation.getDisplayName())) { +// waypoints.put(event.newLocation.getDisplayName(), Minecraft.getMinecraft().thePlayer.getPosition()); +// } +// } +// } +// +// @SubscribeEvent +// public void onChatMessage(ClientChatReceivedEvent event) { +// if (event.type != 2 && LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) { +// Matcher matcher = LOCATION_MESSAGE_REGEX.matcher(event.message.getUnformattedText()); +// if (!matcher.find()) return; +// ChatStyle style = new ChatStyle(); +// style.setParentStyle(event.message.getChatStyle()); +// ClickEvent.Action action = LorenzMod.config.mining.chatWaypointMode == 0 ? ClickEvent.Action.RUN_COMMAND : ClickEvent.Action.SUGGEST_COMMAND; +// style.setChatClickEvent(new ClickEvent(action, "/sbhpoints addat " + matcher.group(2) + " " + matcher.group(3) + " " + matcher.group(4) + " " + matcher.group(1))); +// style.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText("Click to add waypoint!").setChatStyle(new ChatStyle().setBold(true)))); +// event.message.setChatStyle(style); +// } +// } +// +// private static String copyWayPoint(String name) { +// BlockPos pos = waypoints.get(name); +// if (pos == null) { +// return null; +// } +// return "{" + name + " : (" + pos.getX() + "/" + pos.getY() + "/" + pos.getZ() + ")}"; +// } +// +// public static class WaypointCommand extends SimpleCommand { +// +// public WaypointCommand() { +// super( +// "sbhpoints", +// new ProcessCommandRunnable() { +// @Override +// public void processCommand(ICommandSender sender, String[] args) { +// if (args.length == 0) return; +// String subCommand = args[0].toLowerCase(); +// String name = String.join(" ", Arrays.copyOfRange(args, 1, args.length)); +// switch (subCommand) { +// case "add": +// if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) { +// if (!CrystalWaypoints.waypoints.containsKey(name) && name.length() > 1) { +// CrystalWaypoints.waypoints.put(name, sender.getPosition().add(0.5, 0.5, 0.5)); +// } else if (name.length() < 2) { +// sbhMessage(sender, "Waypoint name needs to be longer than 1"); +// } else { +// sbhMessage(sender, "Waypoint already exists!"); +// } +// } +// break; +// case "remove": +// if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) { +// if (CrystalWaypoints.waypoints.containsKey(name)) { +// CrystalWaypoints.waypoints.remove(name); +// } else { +// sbhMessage(sender, "Waypoint doesnt exist!"); +// } +// } +// break; +// case "move": +// if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) { +// if (CrystalWaypoints.waypoints.containsKey(name)) { +// CrystalWaypoints.waypoints.put(name, sender.getPosition().add(0.5, 0.5, 0.5)); +// } else { +// sbhMessage(sender, "Waypoint doesnt exist!"); +// } +// } +// break; +// case "clear": +// CrystalWaypoints.waypoints.clear(); +// break; +// case "addat": +// if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) { +// name = String.join(" ", Arrays.copyOfRange(args, 4, args.length)); +// try { +// if (!CrystalWaypoints.waypoints.containsKey(name)) { +// CrystalWaypoints.waypoints.put(name, parseBlockPos(sender, args, 1, true)); +// } else if (name.length() < 2) { +// sbhMessage(sender, "Waypoint name needs to be longer than 1"); +// } else { +// sbhMessage(sender, "Waypoint already exists!"); +// } +// } catch (Exception e) { +// sbhMessage(sender, "Error!"); +// } +// } +// break; +// case "copy": +// String copyText = copyWayPoint(name); +// if (copyText == null) { +// sbhMessage(sender, "No waypoint with that name!"); +// break; +// } +// StringSelection clipboard = new StringSelection(copyText); +// Toolkit.getDefaultToolkit().getSystemClipboard().setContents(clipboard, clipboard); +// break; +// case "send": +// String sendText = copyWayPoint(name); +// if (sendText == null) { +// sbhMessage(sender, "No waypoint with that name!"); +// break; +// } +// Minecraft.getMinecraft().thePlayer.sendChatMessage(sendText); +// break; +// } +// } +// }, +// new TabCompleteRunnable() { +// @Override +// public List<String> tabComplete(ICommandSender sender, String[] args, BlockPos pos) { +// if (args.length == 2 && Utils.equalsIgnoreCaseAnyOf(args[0], "remove", "copy", "move", "send")) { +// return getListOfStringsMatchingLastWord(args, waypoints.keySet()); +// } +// if (args.length == 1) { +// return getListOfStringsMatchingLastWord(args, Lists.newArrayList("add", "clear", "remove", "copy", "addat", "move", "send")); +// } +// if (args.length > 1 && args[0].equalsIgnoreCase("addat")) { +// return func_175771_a(args, 1, pos); +// } +// return null; +// } +// } +// ); +// } +// +// private static void sbhMessage(ICommandSender sender, String message) { +// sender.addChatMessage(new ChatComponentText("[" + EnumChatFormatting.RED + EnumChatFormatting.BOLD + "SkyBlockHud" + EnumChatFormatting.RESET + "] : " + EnumChatFormatting.GRAY + message)); +// } +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java index 9da08c3eb..5f6b2c64c 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java @@ -1,206 +1,206 @@ -package com.thatgravyboat.skyblockhud.handlers; - -import static com.thatgravyboat.skyblockhud.GuiTextures.mapOverlay; - -import at.lorenz.mod.LorenzMod; -import com.thatgravyboat.skyblockhud.config.KeyBindings; -import com.thatgravyboat.skyblockhud.config.SBHConfig; -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 com.thatgravyboat.skyblockhud.utils.Utils; -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; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.event.RenderGameOverlayEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; -import org.lwjgl.opengl.GL11; - -public class MapHandler { - - public enum MapIconTypes { - SHOPS, - MISC, - NPC, - INFO, - QUEST - } - - 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) { - this(pos, icon, tooltip, 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 boolean cantRender() { - SBHConfig.Map mapConfig = LorenzMod.config.map; - if (mapConfig.showInfoIcons && type.equals(MapIconTypes.INFO)) return false; else if (mapConfig.showMiscIcons && type.equals(MapIconTypes.MISC)) return false; else if (mapConfig.showNpcIcons && type.equals(MapIconTypes.NPC)) return false; else if (mapConfig.showQuestIcons && type.equals(MapIconTypes.QUEST)) return false; else return (!mapConfig.showShopIcons || !type.equals(MapIconTypes.SHOPS)); - } - } - - 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), - CRYSTAL(0.5f, 624, 624, -202, -215.7, -202, -212, new ResourceLocation("skyblockhud", "maps/crystal.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; - public int height; - public double xMiniOffset; - public double yMiniOffset; - public double xOffset; - public double yOffset; - public ResourceLocation mapTexture; - public List<MapIcon> icons; - - Maps(float scaleFactor, int width, int height, double xMiniOffset, double yMiniOffset, double xOffset, double 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, LorenzMod.hasSkyblockScoreboard(), LorenzMod.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 = LorenzMod.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); - - double x = mc.thePlayer.getPosition().getX() + map.xMiniOffset; - double z = mc.thePlayer.getPosition().getZ() + map.yMiniOffset; - float u = (float) ((x / (map.width / 256f)) - 33f); - float v = (float) ((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 (LorenzMod.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) + (pos.rightAligned(event.resolution, 72) ? 50 : 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) + (pos.rightAligned(event.resolution, 72) ? 21 : 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 && LorenzMod.hasSkyblockScoreboard()) LorenzMod.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 && LorenzMod.config.map.showPlayerLocation) { - double x = this.mc.thePlayer.getPosition().getX() + map.xOffset; - double 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.cantRender()) continue; - GlStateManager.enableBlend(); - GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(icon.icon); - double x = ((icon.position.x + map.xOffset) * map.scaleFactor) + startX - 4; - double 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.cantRender()) 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.cantRender()) 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; - } - } - } - } -} +//package com.thatgravyboat.skyblockhud.handlers; +// +//import static com.thatgravyboat.skyblockhud.GuiTextures.mapOverlay; +// +//import at.lorenz.mod.LorenzMod; +//import com.thatgravyboat.skyblockhud.config.KeyBindings; +//import com.thatgravyboat.skyblockhud.config.SBHConfig; +//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 com.thatgravyboat.skyblockhud.utils.Utils; +//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; +//import net.minecraft.client.renderer.GlStateManager; +//import net.minecraft.client.settings.GameSettings; +//import net.minecraft.util.BlockPos; +//import net.minecraft.util.ResourceLocation; +//import net.minecraftforge.client.event.RenderGameOverlayEvent; +//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +//import net.minecraftforge.fml.common.gameevent.TickEvent; +//import org.lwjgl.opengl.GL11; +// +//public class MapHandler { +// +// public enum MapIconTypes { +// SHOPS, +// MISC, +// NPC, +// INFO, +// QUEST +// } +// +// 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) { +// this(pos, icon, tooltip, 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 boolean cantRender() { +// SBHConfig.Map mapConfig = LorenzMod.config.map; +// if (mapConfig.showInfoIcons && type.equals(MapIconTypes.INFO)) return false; else if (mapConfig.showMiscIcons && type.equals(MapIconTypes.MISC)) return false; else if (mapConfig.showNpcIcons && type.equals(MapIconTypes.NPC)) return false; else if (mapConfig.showQuestIcons && type.equals(MapIconTypes.QUEST)) return false; else return (!mapConfig.showShopIcons || !type.equals(MapIconTypes.SHOPS)); +// } +// } +// +// 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), +// CRYSTAL(0.5f, 624, 624, -202, -215.7, -202, -212, new ResourceLocation("skyblockhud", "maps/crystal.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; +// public int height; +// public double xMiniOffset; +// public double yMiniOffset; +// public double xOffset; +// public double yOffset; +// public ResourceLocation mapTexture; +// public List<MapIcon> icons; +// +// Maps(float scaleFactor, int width, int height, double xMiniOffset, double yMiniOffset, double xOffset, double 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, LorenzMod.hasSkyblockScoreboard(), LorenzMod.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 = LorenzMod.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); +// +// double x = mc.thePlayer.getPosition().getX() + map.xMiniOffset; +// double z = mc.thePlayer.getPosition().getZ() + map.yMiniOffset; +// float u = (float) ((x / (map.width / 256f)) - 33f); +// float v = (float) ((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 (LorenzMod.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) + (pos.rightAligned(event.resolution, 72) ? 50 : 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) + (pos.rightAligned(event.resolution, 72) ? 21 : 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 && LorenzMod.hasSkyblockScoreboard()) LorenzMod.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 && LorenzMod.config.map.showPlayerLocation) { +// double x = this.mc.thePlayer.getPosition().getX() + map.xOffset; +// double 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.cantRender()) continue; +// GlStateManager.enableBlend(); +// GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); +// this.mc.renderEngine.bindTexture(icon.icon); +// double x = ((icon.position.x + map.xOffset) * map.scaleFactor) + startX - 4; +// double 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.cantRender()) 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.cantRender()) 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/NpcDialogue.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/NpcDialogue.java index 1b29442ff..4159cb63f 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/NpcDialogue.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/NpcDialogue.java @@ -1,131 +1,131 @@ -package com.thatgravyboat.skyblockhud.handlers; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import at.lorenz.mod.LorenzMod; -import com.thatgravyboat.skyblockhud.textures.Textures; -import com.thatgravyboat.skyblockhud.utils.Utils; -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.resources.IResourceManager; -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; - -public class NpcDialogue implements IResourceManagerReloadListener { - - public static final Pattern NPC_DIALOGUE_REGEX = Pattern.compile("\\[NPC] (.*): (.*)"); - - private static final Gson gson = new GsonBuilder().create(); - private static final Map<String, ResourceLocation> NPCS = new HashMap<>(); - - private static boolean showDialogue = false; - private static int ticks = 0; - - private static final Queue<Dialogue> DIALOGUE = new ArrayDeque<>(); - private static Dialogue currentDialogue = null; - - @SubscribeEvent - public void onTick(TickEvent.ClientTickEvent event) { - if (event.phase.equals(TickEvent.Phase.START) || LorenzMod.config.misc.hideDialogueBox) return; - if (showDialogue) ticks++; else ticks = 0; - - if (showDialogue && ticks % 60 == 0) { - currentDialogue = DIALOGUE.poll(); - - if (currentDialogue == null) { - showDialogue = false; - } - } - } - - @SubscribeEvent(priority = EventPriority.LOWEST) - public void onChat(ClientChatReceivedEvent event) { - if (event.type != 2 && !LorenzMod.config.misc.hideDialogueBox) { - String message = Utils.removeColor(event.message.getUnformattedText()); - if (message.toLowerCase(Locale.ENGLISH).startsWith("[npc]")) { - Matcher matcher = NPC_DIALOGUE_REGEX.matcher(message); - if (matcher.find()) { - showDialogue = true; - event.setCanceled(true); - - Dialogue dialogue = new Dialogue(matcher.group(1), matcher.group(2)); - if (currentDialogue == null) currentDialogue = dialogue; else DIALOGUE.add(dialogue); - } - } - } - } - - @SubscribeEvent - public void renderOverlay(RenderGameOverlayEvent.Post event) { - if (Utils.overlayShouldRender(event.type, LorenzMod.hasSkyblockScoreboard(), showDialogue, !LorenzMod.config.misc.hideDialogueBox)) { - Minecraft mc = Minecraft.getMinecraft(); - mc.renderEngine.bindTexture(Textures.texture.dialogue); - GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); - - int x = LorenzMod.config.misc.dialoguePos.getAbsX(event.resolution, 182) - 91; - int y = LorenzMod.config.misc.dialoguePos.getAbsY(event.resolution, 68); - - Gui.drawModalRectWithCustomSizedTexture(x, y, 0, 0, 182, 68, 256, 256); - - String npcID = currentDialogue.name.toLowerCase(Locale.ENGLISH).replace(" ", "_"); - - if (NPCS.containsKey(npcID)) { - mc.renderEngine.bindTexture(NPCS.get(npcID)); - Gui.drawModalRectWithCustomSizedTexture(x + 4, y + 4, 0, 0, 32, 60, 128, 128); - } - - FontRenderer font = mc.fontRendererObj; - - font.drawString(currentDialogue.name, x + 40, y + 10, 0xffffff); - - 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); - } - } - } - - @Override - public void onResourceManagerReload(IResourceManager resourceManager) { - NPCS.clear(); - try { - ResourceLocation npcs = new ResourceLocation("skyblockhud:data/npc_textures.json"); - InputStream is = resourceManager.getResource(npcs).getInputStream(); - - try (BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) { - for (JsonElement npc : gson.fromJson(reader, JsonObject.class).getAsJsonArray("npcs")) { - JsonObject npcObject = npc.getAsJsonObject(); - String npcName = npcObject.get("name").getAsString(); - ResourceLocation rl = new ResourceLocation(npcObject.get("texture").getAsString()); - NPCS.put(npcName.toLowerCase(Locale.ENGLISH).replace(" ", "_"), rl); - } - } - } 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; - } - } -} +//package com.thatgravyboat.skyblockhud.handlers; +// +//import com.google.gson.Gson; +//import com.google.gson.GsonBuilder; +//import com.google.gson.JsonElement; +//import com.google.gson.JsonObject; +//import at.lorenz.mod.LorenzMod; +//import com.thatgravyboat.skyblockhud.textures.Textures; +//import com.thatgravyboat.skyblockhud.utils.Utils; +//import java.io.BufferedReader; +//import java.io.InputStream; +//import java.io.InputStreamReader; +//import java.nio.charset.StandardCharsets; +//import java.util.*; +//import java.util.regex.Matcher; +//import java.util.regex.Pattern; +//import net.minecraft.client.Minecraft; +//import net.minecraft.client.gui.FontRenderer; +//import net.minecraft.client.gui.Gui; +//import net.minecraft.client.renderer.GlStateManager; +//import net.minecraft.client.resources.IResourceManager; +//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; +// +//public class NpcDialogue implements IResourceManagerReloadListener { +// +// public static final Pattern NPC_DIALOGUE_REGEX = Pattern.compile("\\[NPC] (.*): (.*)"); +// +// private static final Gson gson = new GsonBuilder().create(); +// private static final Map<String, ResourceLocation> NPCS = new HashMap<>(); +// +// private static boolean showDialogue = false; +// private static int ticks = 0; +// +// private static final Queue<Dialogue> DIALOGUE = new ArrayDeque<>(); +// private static Dialogue currentDialogue = null; +// +// @SubscribeEvent +// public void onTick(TickEvent.ClientTickEvent event) { +// if (event.phase.equals(TickEvent.Phase.START) || LorenzMod.config.misc.hideDialogueBox) return; +// if (showDialogue) ticks++; else ticks = 0; +// +// if (showDialogue && ticks % 60 == 0) { +// currentDialogue = DIALOGUE.poll(); +// +// if (currentDialogue == null) { +// showDialogue = false; +// } +// } +// } +// +// @SubscribeEvent(priority = EventPriority.LOWEST) +// public void onChat(ClientChatReceivedEvent event) { +// if (event.type != 2 && !LorenzMod.config.misc.hideDialogueBox) { +// String message = Utils.removeColor(event.message.getUnformattedText()); +// if (message.toLowerCase(Locale.ENGLISH).startsWith("[npc]")) { +// Matcher matcher = NPC_DIALOGUE_REGEX.matcher(message); +// if (matcher.find()) { +// showDialogue = true; +// event.setCanceled(true); +// +// Dialogue dialogue = new Dialogue(matcher.group(1), matcher.group(2)); +// if (currentDialogue == null) currentDialogue = dialogue; else DIALOGUE.add(dialogue); +// } +// } +// } +// } +// +// @SubscribeEvent +// public void renderOverlay(RenderGameOverlayEvent.Post event) { +// if (Utils.overlayShouldRender(event.type, LorenzMod.hasSkyblockScoreboard(), showDialogue, !LorenzMod.config.misc.hideDialogueBox)) { +// Minecraft mc = Minecraft.getMinecraft(); +// mc.renderEngine.bindTexture(Textures.texture.dialogue); +// GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); +// +// int x = LorenzMod.config.misc.dialoguePos.getAbsX(event.resolution, 182) - 91; +// int y = LorenzMod.config.misc.dialoguePos.getAbsY(event.resolution, 68); +// +// Gui.drawModalRectWithCustomSizedTexture(x, y, 0, 0, 182, 68, 256, 256); +// +// String npcID = currentDialogue.name.toLowerCase(Locale.ENGLISH).replace(" ", "_"); +// +// if (NPCS.containsKey(npcID)) { +// mc.renderEngine.bindTexture(NPCS.get(npcID)); +// Gui.drawModalRectWithCustomSizedTexture(x + 4, y + 4, 0, 0, 32, 60, 128, 128); +// } +// +// FontRenderer font = mc.fontRendererObj; +// +// font.drawString(currentDialogue.name, x + 40, y + 10, 0xffffff); +// +// 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); +// } +// } +// } +// +// @Override +// public void onResourceManagerReload(IResourceManager resourceManager) { +// NPCS.clear(); +// try { +// ResourceLocation npcs = new ResourceLocation("skyblockhud:data/npc_textures.json"); +// InputStream is = resourceManager.getResource(npcs).getInputStream(); +// +// try (BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) { +// for (JsonElement npc : gson.fromJson(reader, JsonObject.class).getAsJsonArray("npcs")) { +// JsonObject npcObject = npc.getAsJsonObject(); +// String npcName = npcObject.get("name").getAsString(); +// ResourceLocation rl = new ResourceLocation(npcObject.get("texture").getAsString()); +// NPCS.put(npcName.toLowerCase(Locale.ENGLISH).replace(" ", "_"), rl); +// } +// } +// } 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/handlers/mapicons/DwarvenIcons.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/DwarvenIcons.java index 211ed4b68..1dfb12a0a 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/DwarvenIcons.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/DwarvenIcons.java @@ -1,39 +1,39 @@ -package com.thatgravyboat.skyblockhud.handlers.mapicons; - -import com.thatgravyboat.skyblockhud.handlers.MapHandler; -import com.thatgravyboat.skyblockhud.utils.ComponentBuilder; -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(); - } - - private static void setupNpcIcons() { - dwarvenIcons.add(new MapHandler.MapIcon(new Vector2f(181, 135), new ResourceLocation("skyblockhud", "maps/icons/puzzle.png"), new ComponentBuilder().nl("Puzzler", '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 setupMiscIcons() {} - - private static void setupInfoIcons() { - dwarvenIcons.add(new MapHandler.MapIcon(new Vector2f(129, 187), new ResourceLocation("skyblockhud", "maps/icons/crown.png"), new ComponentBuilder().nl("King", '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", '6', 'l').build(), MapHandler.MapIconTypes.INFO, "hotm")); - } - - private static void setupShopIcons() { - dwarvenIcons.add(new MapHandler.MapIcon(new Vector2f(4, 8), new ResourceLocation("skyblockhud", "maps/icons/blacksmith.png"), new ComponentBuilder().nl("Forge", 'a', 'l').nl("Description", 'l').nl("The Forge is where you can go craft special items").nl("and fuel your drill.").nl("NPCS", 'c', 'l').nl(" Forger - Allows you to forge special items").nl(" Jotraeline Greatforge - Allows you to refuel your drill.").nl().apd("Click to warp", '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", '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)); - } -} +//package com.thatgravyboat.skyblockhud.handlers.mapicons; +// +//import com.thatgravyboat.skyblockhud.handlers.MapHandler; +//import com.thatgravyboat.skyblockhud.utils.ComponentBuilder; +//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(); +// } +// +// private static void setupNpcIcons() { +// dwarvenIcons.add(new MapHandler.MapIcon(new Vector2f(181, 135), new ResourceLocation("skyblockhud", "maps/icons/puzzle.png"), new ComponentBuilder().nl("Puzzler", '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 setupMiscIcons() {} +// +// private static void setupInfoIcons() { +// dwarvenIcons.add(new MapHandler.MapIcon(new Vector2f(129, 187), new ResourceLocation("skyblockhud", "maps/icons/crown.png"), new ComponentBuilder().nl("King", '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", '6', 'l').build(), MapHandler.MapIconTypes.INFO, "hotm")); +// } +// +// private static void setupShopIcons() { +// dwarvenIcons.add(new MapHandler.MapIcon(new Vector2f(4, 8), new ResourceLocation("skyblockhud", "maps/icons/blacksmith.png"), new ComponentBuilder().nl("Forge", 'a', 'l').nl("Description", 'l').nl("The Forge is where you can go craft special items").nl("and fuel your drill.").nl("NPCS", 'c', 'l').nl(" Forger - Allows you to forge special items").nl(" Jotraeline Greatforge - Allows you to refuel your drill.").nl().apd("Click to warp", '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", '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 7de7d92cf..0192be305 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/HubIcons.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/HubIcons.java @@ -1,55 +1,55 @@ -package com.thatgravyboat.skyblockhud.handlers.mapicons; - -import com.thatgravyboat.skyblockhud.handlers.MapHandler; -import com.thatgravyboat.skyblockhud.utils.ComponentBuilder; -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<>(); - - 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", 'a', 'l').nl("Description", 'l').nl("The Event Hut is where special event npcs").nl("are during some events.").nl("NPC'S", '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", '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", 'a', 'l').nl("NPCS", '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", 'a', 'l').nl("NPCS", '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", 'a', 'l').nl("NPCS", '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", '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", '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", 'a', 'l').nl("Merchants", '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", 'a', 'l').nl("NPCS", '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", 'a', 'l').nl("NPCS", '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", '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", 'a', 'l').nl("Shop", '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", 'a', 'l').nl("NPCS", '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", '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", '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", '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", '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", '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", '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)); - } -} +//package com.thatgravyboat.skyblockhud.handlers.mapicons; +// +//import com.thatgravyboat.skyblockhud.handlers.MapHandler; +//import com.thatgravyboat.skyblockhud.utils.ComponentBuilder; +//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<>(); +// +// 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", 'a', 'l').nl("Description", 'l').nl("The Event Hut is where special event npcs").nl("are during some events.").nl("NPC'S", '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", '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", 'a', 'l').nl("NPCS", '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", 'a', 'l').nl("NPCS", '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", 'a', 'l').nl("NPCS", '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", '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", '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", 'a', 'l').nl("Merchants", '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", 'a', 'l').nl("NPCS", '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", 'a', 'l').nl("NPCS", '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", '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", 'a', 'l').nl("Shop", '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", 'a', 'l').nl("NPCS", '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", '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", '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", '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", '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", '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", '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/location/FarmingIslandHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/FarmingIslandHandler.java index a4abaaec8..db71fab5d 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/location/FarmingIslandHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/location/FarmingIslandHandler.java @@ -1,28 +1,28 @@ -package com.thatgravyboat.skyblockhud.location; - -import com.thatgravyboat.skyblockhud.api.events.SidebarPostEvent; -import java.util.Arrays; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class FarmingIslandHandler { - - public static Locations location = Locations.NONE; - public static int pelts; - - @SubscribeEvent - public void onSidebarPost(SidebarPostEvent event) { - boolean isTracking = Arrays.toString(event.arrayScores).toLowerCase().contains("tracker mob location:"); - if (isTracking && location == Locations.NONE) { - for (int i = 0; i < event.scores.size(); i++) { - String line = event.scores.get(i); - if (line.toLowerCase().contains("tracker mob location:") && i > 2) { - location = Locations.get(event.scores.get(i - 1).toLowerCase()); - break; - } - } - } - if (!isTracking && location != Locations.NONE) { - location = Locations.NONE; - } - } -} +//package com.thatgravyboat.skyblockhud.location; +// +//import com.thatgravyboat.skyblockhud.api.events.SidebarPostEvent; +//import java.util.Arrays; +//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +// +//public class FarmingIslandHandler { +// +// public static Locations location = Locations.NONE; +// public static int pelts; +// +// @SubscribeEvent +// public void onSidebarPost(SidebarPostEvent event) { +// boolean isTracking = Arrays.toString(event.arrayScores).toLowerCase().contains("tracker mob location:"); +// if (isTracking && location == Locations.NONE) { +// for (int i = 0; i < event.scores.size(); i++) { +// String line = event.scores.get(i); +// if (line.toLowerCase().contains("tracker mob location:") && i > 2) { +// location = Locations.get(event.scores.get(i - 1).toLowerCase()); +// break; +// } +// } +// } +// if (!isTracking && location != Locations.NONE) { +// location = Locations.NONE; +// } +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/IslandHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/IslandHandler.java index cc6668a17..d0a4d0eb1 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/location/IslandHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/location/IslandHandler.java @@ -1,67 +1,67 @@ -package com.thatgravyboat.skyblockhud.location; - -import com.thatgravyboat.skyblockhud.api.events.ProfileSwitchedEvent; -import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent; -import com.thatgravyboat.skyblockhud.utils.Utils; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class IslandHandler { - - public static int flightTime; - public static boolean hadFlightTime; - - public static int redstone; - public static boolean hadRedstone; - - @SubscribeEvent - public void onSidebarLineUpdate(SidebarLineUpdateEvent event) { - hadFlightTime = checkFlightDuration(event.formattedLine); - hadRedstone = checkRestone(event.formattedLine); - } - - @SubscribeEvent - public void onProfileSwitch(ProfileSwitchedEvent event) { - flightTime = 0; - } - - public static boolean checkFlightDuration(String formatedScoreboardLine) { - if (LocationHandler.getCurrentLocation() == Locations.YOURISLAND && Utils.removeColor(formatedScoreboardLine.toLowerCase().trim()).contains("flight duration:")) { - String timeString = formatedScoreboardLine.toLowerCase().replace("flight duration:", "").replace(" ", ""); - String[] times = timeString.split(":"); - if (times.length == 2) { - int s = 0; - try { - s += Integer.parseInt(times[0]) * 60; - } catch (NumberFormatException ignored) {} - try { - s += Integer.parseInt(times[1]); - } catch (NumberFormatException ignored) {} - flightTime = s - 1; - } else if (times.length == 3) { - int s = 0; - try { - s += Integer.parseInt(times[0]) * 3600; - } catch (NumberFormatException ignored) {} - try { - s += Integer.parseInt(times[1]) * 60; - } catch (NumberFormatException ignored) {} - try { - s += Integer.parseInt(times[2]); - } catch (NumberFormatException ignored) {} - flightTime = s - 1; - } - return true; - } - return false; - } - - public static boolean checkRestone(String formatedScoreboardLine) { - if (LocationHandler.getCurrentLocation() == Locations.YOURISLAND) { - if (formatedScoreboardLine.toLowerCase().contains("redstone:")) return true; - try { - redstone = formatedScoreboardLine.toLowerCase().contains("redstone:") ? Integer.parseInt(Utils.removeWhiteSpaceAndRemoveWord(formatedScoreboardLine, "redstone:")) : 0; - } catch (Exception ignored) {} - } - return false; - } -} +//package com.thatgravyboat.skyblockhud.location; +// +//import com.thatgravyboat.skyblockhud.api.events.ProfileSwitchedEvent; +//import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent; +//import com.thatgravyboat.skyblockhud.utils.Utils; +//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +// +//public class IslandHandler { +// +// public static int flightTime; +// public static boolean hadFlightTime; +// +// public static int redstone; +// public static boolean hadRedstone; +// +// @SubscribeEvent +// public void onSidebarLineUpdate(SidebarLineUpdateEvent event) { +// hadFlightTime = checkFlightDuration(event.formattedLine); +// hadRedstone = checkRestone(event.formattedLine); +// } +// +// @SubscribeEvent +// public void onProfileSwitch(ProfileSwitchedEvent event) { +// flightTime = 0; +// } +// +// public static boolean checkFlightDuration(String formatedScoreboardLine) { +// if (LocationHandler.getCurrentLocation() == Locations.YOURISLAND && Utils.removeColor(formatedScoreboardLine.toLowerCase().trim()).contains("flight duration:")) { +// String timeString = formatedScoreboardLine.toLowerCase().replace("flight duration:", "").replace(" ", ""); +// String[] times = timeString.split(":"); +// if (times.length == 2) { +// int s = 0; +// try { +// s += Integer.parseInt(times[0]) * 60; +// } catch (NumberFormatException ignored) {} +// try { +// s += Integer.parseInt(times[1]); +// } catch (NumberFormatException ignored) {} +// flightTime = s - 1; +// } else if (times.length == 3) { +// int s = 0; +// try { +// s += Integer.parseInt(times[0]) * 3600; +// } catch (NumberFormatException ignored) {} +// try { +// s += Integer.parseInt(times[1]) * 60; +// } catch (NumberFormatException ignored) {} +// try { +// s += Integer.parseInt(times[2]); +// } catch (NumberFormatException ignored) {} +// flightTime = s - 1; +// } +// return true; +// } +// return false; +// } +// +// public static boolean checkRestone(String formatedScoreboardLine) { +// if (LocationHandler.getCurrentLocation() == Locations.YOURISLAND) { +// if (formatedScoreboardLine.toLowerCase().contains("redstone:")) return true; +// try { +// redstone = formatedScoreboardLine.toLowerCase().contains("redstone:") ? Integer.parseInt(Utils.removeWhiteSpaceAndRemoveWord(formatedScoreboardLine, "redstone:")) : 0; +// } catch (Exception ignored) {} +// } +// return false; +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/LocationCategory.java b/src/main/java/com/thatgravyboat/skyblockhud/location/LocationCategory.java index b5b77c7c2..de5c1d223 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/location/LocationCategory.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/location/LocationCategory.java @@ -1,54 +1,54 @@ -package com.thatgravyboat.skyblockhud.location; - -import static com.thatgravyboat.skyblockhud.handlers.MapHandler.Maps; - -import at.lorenz.mod.LorenzMod; -import com.thatgravyboat.skyblockhud.handlers.MapHandler; - -public enum LocationCategory { - ERROR("error", 34), - ISLAND("island", 43), - HUB("hub", 34, Maps.HUB), - BARN("barn", 67, Maps.BARN), - MUSHROOMDESERT("mushroomdesert", 75, Maps.MUSHROOM), - GOLDMINE("gold_mine", 83), - DEEPCAVERNS("deepcaverns", 91), - SPIDERSDEN("spiders_den", 99, Maps.SPIDERS), - PARK("park", 51, Maps.PARK), - FORTRESS("fortress", 107, Maps.NETHER), - DUNGEONHUB("dungeonhub", 115), - JERRY("jerry", 59), - THEEND("the_end", 123), - DWARVENMINES("dwarven_mines", 131, Maps.DWARVEN), - CRYSTALHOLLOWS("crystal_hollows", 139, Maps.CRYSTAL); - - private final String name; - private final int texturePos; - private final MapHandler.Maps map; - - LocationCategory(String name, int texturePos) { - this(name, texturePos, null); - } - - LocationCategory(String name, int texturePos, MapHandler.Maps map) { - this.name = name; - this.texturePos = texturePos; - this.map = map; - } - - public String getName() { - return this.name; - } - - public int getTexturePos() { - return this.texturePos; - } - - public MapHandler.Maps getMap() { - if (this.map != null && LorenzMod.config.map.mapLocations.contains(this.ordinal() - 2)) return this.map; else return null; - } - - public boolean isMiningCategory() { - return this == LocationCategory.DWARVENMINES || this == LocationCategory.CRYSTALHOLLOWS; - } -} +//package com.thatgravyboat.skyblockhud.location; +// +//import static com.thatgravyboat.skyblockhud.handlers.MapHandler.Maps; +// +//import at.lorenz.mod.LorenzMod; +//import com.thatgravyboat.skyblockhud.handlers.MapHandler; +// +//public enum LocationCategory { +// ERROR("error", 34), +// ISLAND("island", 43), +// HUB("hub", 34, Maps.HUB), +// BARN("barn", 67, Maps.BARN), +// MUSHROOMDESERT("mushroomdesert", 75, Maps.MUSHROOM), +// GOLDMINE("gold_mine", 83), +// DEEPCAVERNS("deepcaverns", 91), +// SPIDERSDEN("spiders_den", 99, Maps.SPIDERS), +// PARK("park", 51, Maps.PARK), +// FORTRESS("fortress", 107, Maps.NETHER), +// DUNGEONHUB("dungeonhub", 115), +// JERRY("jerry", 59), +// THEEND("the_end", 123), +// DWARVENMINES("dwarven_mines", 131, Maps.DWARVEN), +// CRYSTALHOLLOWS("crystal_hollows", 139, Maps.CRYSTAL); +// +// private final String name; +// private final int texturePos; +// private final MapHandler.Maps map; +// +// LocationCategory(String name, int texturePos) { +// this(name, texturePos, null); +// } +// +// LocationCategory(String name, int texturePos, MapHandler.Maps map) { +// this.name = name; +// this.texturePos = texturePos; +// this.map = map; +// } +// +// public String getName() { +// return this.name; +// } +// +// public int getTexturePos() { +// return this.texturePos; +// } +// +// public MapHandler.Maps getMap() { +// if (this.map != null && LorenzMod.config.map.mapLocations.contains(this.ordinal() - 2)) return this.map; else return null; +// } +// +// public boolean isMiningCategory() { +// return this == LocationCategory.DWARVENMINES || this == LocationCategory.CRYSTALHOLLOWS; +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java index cfbfdc324..292429571 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java @@ -1,44 +1,44 @@ -package com.thatgravyboat.skyblockhud.location; - -import com.thatgravyboat.skyblockhud.api.events.LocationChangeEvent; -import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent; -import java.util.Locale; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class LocationHandler { - - private static Locations currentLocation = Locations.NONE; - - @SubscribeEvent - public void onSidebarLineUpdate(SidebarLineUpdateEvent event) { - if (event.rawLine.contains("\u23E3")) { - String objectiveName = event.objective.getDisplayName().replaceAll("(?i)\\u00A7.", ""); - if (objectiveName.toLowerCase(Locale.ENGLISH).endsWith("guest")) { - LocationHandler.setCurrentLocation(Locations.GUESTISLAND); - } else { - LocationHandler.handleLocation(event.formattedLine); - } - } - } - - public static void setCurrentLocation(Locations location) { - currentLocation = location; - } - - public static Locations getCurrentLocation() { - return currentLocation; - } - - public static void handleLocation(String locationLine) { - String location = locationLine.replace(" ", "").toUpperCase(Locale.ENGLISH).trim(); - if (location.startsWith("THECATACOMBS")) { - MinecraftForge.EVENT_BUS.post(new LocationChangeEvent(currentLocation, Locations.CATACOMBS)); - currentLocation = Locations.CATACOMBS; - } else { - Locations locations = Locations.get(location.replaceAll("[^A-Za-z0-9]", "")); - MinecraftForge.EVENT_BUS.post(new LocationChangeEvent(currentLocation, locations)); - currentLocation = locations; - } - } -} +//package com.thatgravyboat.skyblockhud.location; +// +//import com.thatgravyboat.skyblockhud.api.events.LocationChangeEvent; +//import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent; +//import java.util.Locale; +//import net.minecraftforge.common.MinecraftForge; +//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +// +//public class LocationHandler { +// +// private static Locations currentLocation = Locations.NONE; +// +// @SubscribeEvent +// public void onSidebarLineUpdate(SidebarLineUpdateEvent event) { +// if (event.rawLine.contains("\u23E3")) { +// String objectiveName = event.objective.getDisplayName().replaceAll("(?i)\\u00A7.", ""); +// if (objectiveName.toLowerCase(Locale.ENGLISH).endsWith("guest")) { +// LocationHandler.setCurrentLocation(Locations.GUESTISLAND); +// } else { +// LocationHandler.handleLocation(event.formattedLine); +// } +// } +// } +// +// public static void setCurrentLocation(Locations location) { +// currentLocation = location; +// } +// +// public static Locations getCurrentLocation() { +// return currentLocation; +// } +// +// public static void handleLocation(String locationLine) { +// String location = locationLine.replace(" ", "").toUpperCase(Locale.ENGLISH).trim(); +// if (location.startsWith("THECATACOMBS")) { +// MinecraftForge.EVENT_BUS.post(new LocationChangeEvent(currentLocation, Locations.CATACOMBS)); +// currentLocation = Locations.CATACOMBS; +// } else { +// Locations locations = Locations.get(location.replaceAll("[^A-Za-z0-9]", "")); +// MinecraftForge.EVENT_BUS.post(new LocationChangeEvent(currentLocation, locations)); +// currentLocation = locations; +// } +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/Locations.java b/src/main/java/com/thatgravyboat/skyblockhud/location/Locations.java index 5077bce99..1f5fce003 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/location/Locations.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/location/Locations.java @@ -1,161 +1,161 @@ -package com.thatgravyboat.skyblockhud.location; - -public enum Locations { - //ERROR LOCATIONS - DEFAULT("unknown", "Error", LocationCategory.ERROR), - NONE("none", "Unknown", LocationCategory.ERROR), - //ISLAND - YOURISLAND("yourisland", "Your Island", LocationCategory.ISLAND), - GUESTISLAND("guestisland", "Guest Island", LocationCategory.ISLAND), - MOULBERRYSISLAND("moulberryisland", "Cool Dude Hub", LocationCategory.ISLAND), - //HUB - VILLAGE("village", "Village", LocationCategory.HUB), - AUCTIONHOUSE("auctionhouse", "Auction House", LocationCategory.HUB), - BAZAARALLEY("bazaaralley", "Bazaar Alley", LocationCategory.HUB), - BANK("bank", "Bank", LocationCategory.HUB), - FASHIONSHOP("fashionshop", "Fashion Shop", LocationCategory.HUB), - COLOSSEUM("colosseum", "Colosseum", LocationCategory.HUB), - COLOSSEUMARENA("colosseumarena", "Colosseum Arena", LocationCategory.HUB), - MOUNTAIN("mountain", "Mountain", LocationCategory.HUB), - HIGHLEVEL("highlevel", "High Level", LocationCategory.HUB), - WILDERNESS("wilderness", "Wilderness", LocationCategory.HUB), - FISHERMANSHUT("fishermanshut", "Fisherman's Hut", LocationCategory.HUB), - FLOWERHOUSE("flowerhouse", "Flower House", LocationCategory.HUB), - CANVASROOM("canvasroom", "Canvas Room", LocationCategory.HUB), - TAVERN("tavern", "Tavern", LocationCategory.HUB), - FOREST("forest", "Forest", LocationCategory.HUB), - RUINS("ruins", "Ruins", LocationCategory.HUB), - GRAVEYARD("graveyard", "Graveyard", LocationCategory.HUB), - COALMINE("coalmine", "Coal Mine", LocationCategory.HUB), - FARM("farm", "Farm", LocationCategory.HUB), - LIBRARY("library", "Library", LocationCategory.HUB), - COMMUNITYCENTER("communitycenter", "Community Center", LocationCategory.HUB), - ELECTIONROOM("electionroom", "Election Room", LocationCategory.HUB), - BUILDERSHOUSE("buildershouse", "Builder's House", LocationCategory.HUB), - BLACKSMITH("blacksmith", "Blacksmith", LocationCategory.HUB), - FARMHOUSE("farmhouse", "Farmhouse", LocationCategory.HUB), - WIZARDTOWER("wizardtower", "Wizard Tower", LocationCategory.HUB), - //THE BARN - THEBARN("thebarn", "The Barn", LocationCategory.BARN), - WINDMILL("windmill", "Windmill", LocationCategory.BARN), - //MUSHROOM DESERT - MUSHROOMDESERT("mushroomdesert", "Mushroom Desert", LocationCategory.MUSHROOMDESERT), - DESERTSETTLEMENT("desertsettlement", "Desert Settlement", LocationCategory.MUSHROOMDESERT), - OASIS("oasis", "Oasis", LocationCategory.MUSHROOMDESERT), - MUSHROOMGORGE("mushroomgorge", "Mushroom Gorge", LocationCategory.MUSHROOMDESERT), - SHEPHERDSKEEP("shepherdskeep", "Shepherds Keep", LocationCategory.MUSHROOMDESERT), - JAKESHOUSE("jakeshouse", "Jake's House", LocationCategory.MUSHROOMDESERT), - TREASUREHUNTERCAMP("treasurehuntercamp", "Treasure Hunter Camp", LocationCategory.MUSHROOMDESERT), - GLOWINGMUSHROOMCAVE("glowingmushroomcave", "Glowing Mushroom Cave", LocationCategory.MUSHROOMDESERT), - TRAPPERSDEN("trappersden", "Trappers Den", LocationCategory.MUSHROOMDESERT), - OVERGROWNMUSHROOMCAVE("overgrownmushroomcave", "Overgrown Mushroom Cave", LocationCategory.MUSHROOMDESERT), - //GOLD MINE - GOLDMINE("goldmine", "Gold Mine", LocationCategory.GOLDMINE), - //DEEP CAVERNS - DEEPCAVERNS("deepcaverns", "Deep Caverns", LocationCategory.DEEPCAVERNS), - GUNPOWDERMINES("gunpowdermines", "Gunpowder Mines", LocationCategory.DEEPCAVERNS), - LAPISQUARRY("lapisquarry", "Lapis Quarry", LocationCategory.DEEPCAVERNS), - PIGMENSDEN("pigmensden", "Pigmen's Den", LocationCategory.DEEPCAVERNS), - SLIMEHILL("slimehill", "Slimehill", LocationCategory.DEEPCAVERNS), - DIAMONDRESERVE("diamondreserve", "Diamond Reserve", LocationCategory.DEEPCAVERNS), - OBSIDIANSANCTUARY("obsidiansanctuary", "Obsidian Sanctuary", LocationCategory.DEEPCAVERNS), - //SPIDERS DEN - SPIDERSDEN("spidersden", "Spider's Den", LocationCategory.SPIDERSDEN), - - //THE END - THEEND("theend", "The End", LocationCategory.THEEND), - DRAGONSNEST("dragonsnest", "Dragon's Nest", LocationCategory.THEEND), - VOIDSEPULTURE("voidsepulture", "Void Sepulture", LocationCategory.THEEND), - //PARK - HOWLINGCAVE("howlingcave", "Howling Cave", LocationCategory.PARK), - BIRCHPARK("birchpark", "Birch Park", LocationCategory.PARK), - SPRUCEWOODS("sprucewoods", "Spruce Woods", LocationCategory.PARK), - DARKTHICKET("darkthicket", "Dark Thicket", LocationCategory.PARK), - SAVANNAWOODLAND("savannawoodland", "Savanna Woodland", LocationCategory.PARK), - JUNGLEISLAND("jungleisland", "Jungle Island", LocationCategory.PARK), - //BLAZING FORTRESS - BLAZINGFORTRESS("blazingfortress", "Blazing Fortress", LocationCategory.FORTRESS), - //DUNGEONS - DUNGEONHUB("dungeonhub", "Dungeon Hub", LocationCategory.DUNGEONHUB), - CATACOMBS("catacombs", "The Catacombs", LocationCategory.DUNGEONHUB), - CATACOMBSENTRANCE("catacombsentrance", "Catacombs Entrance", LocationCategory.DUNGEONHUB), - //JERRYISLAND - JERRYSWORKSHOP("jerrysworkshop", "Jerry's Workshop", LocationCategory.JERRY), - JERRYPOND("jerrypond", "Jerry Pond", LocationCategory.JERRY), - //DWARVENMINES - THELIFT("thelift", "The Lift", LocationCategory.DWARVENMINES), - DWARVENVILLAGE("dwarvenvillage", "Dwarven Village", LocationCategory.DWARVENMINES), - DWARVENMINES("dwarvenmines", "Dwarven Mines", LocationCategory.DWARVENMINES), - DWARVENTAVERN("dwarvemtavern", "Dwarven Tavern", LocationCategory.DWARVENMINES), - LAVASPRINGS("lavasprings", "Lava Springs", LocationCategory.DWARVENMINES), - PALACEBRIDGE("palacebridge", "Palace Bridge", LocationCategory.DWARVENMINES), - ROYALPALACE("royalpalace", "Royal Palace", LocationCategory.DWARVENMINES), - GRANDLIBRARY("grandlibrary", "Grand Library", LocationCategory.DWARVENMINES), - ROYALQUARTERS("royalquarters", "Royal Quarters", LocationCategory.DWARVENMINES), - BARRACKSOFHEROES("barracksofheroes", "Barracks of Heroes", LocationCategory.DWARVENMINES), - HANGINGCOURT("hangingcourt", "Hanging Court", LocationCategory.DWARVENMINES), - GREATICEWALL("greaticewall", "Great Ice Wall", LocationCategory.DWARVENMINES), - GOBLINBURROWS("goblinburrows", "Goblin Burrows", LocationCategory.DWARVENMINES), - FARRESERVE("farreserve", "Far Reserve", LocationCategory.DWARVENMINES), - CCMINECARTSCO("ccminecartco", "Minecart Co.", LocationCategory.DWARVENMINES), - UPPERMINES("uppermines", "Upper Mines", LocationCategory.DWARVENMINES), - RAMPARTSQUARRY("rampartsquarry", "Ramparts Quarry", LocationCategory.DWARVENMINES), - GATESTOTHEMINES("gatestothemines", "Gates to The Mines", LocationCategory.DWARVENMINES), - FORGEBASIN("forgebasin", "Forge Basin", LocationCategory.DWARVENMINES), - THEFORGE("theforge", "The Forge", LocationCategory.DWARVENMINES), - CLIFFSIDEVEINS("cliffsideveins", "Cliffside Veins", LocationCategory.DWARVENMINES), - DIVANSGATEWAY("divansgateway", "Divan's Gateway", LocationCategory.DWARVENMINES), - THEMIST("themist", "The Mist", LocationCategory.DWARVENMINES), - ROYALMINES("royalmines", "Royal Mines", LocationCategory.DWARVENMINES), - ARISTOCRATPASSAGE("aristocratpassage", "Aristocrat Passage", LocationCategory.DWARVENMINES), - MINERSGUILD("minersguild", "Miner's Guild", LocationCategory.DWARVENMINES), - //CRYSTALHOLLOWS - JUNGLE("jungle", "Jungle", LocationCategory.CRYSTALHOLLOWS), - JUNGLETEMPLE("jungletemple", "Jungle Temple", LocationCategory.CRYSTALHOLLOWS), - MITHRILDEPOSITS("mithrildeposits", "Mithril Deposits", LocationCategory.CRYSTALHOLLOWS), - MINESOFDIVAN("minesofdivan", "Mines of Divan", LocationCategory.CRYSTALHOLLOWS), - MAGMAFIELDS("magmafields", "Magma Fields", LocationCategory.CRYSTALHOLLOWS), - KHAZADDM("khzaddm", "Khazad-d\u00FBm", LocationCategory.CRYSTALHOLLOWS), - GOBLINHOLDOUT("goblinholdout", "Goblin Holdout", LocationCategory.CRYSTALHOLLOWS), - GOBLINQUEENSDEN("goblinqueensden", "Goblin Queens Den", LocationCategory.CRYSTALHOLLOWS), - PRECURSORREMNANTS("precursorremnants", "Precursor Remnants", LocationCategory.CRYSTALHOLLOWS), - LOSTPRECURSORCITY("lostprecursorcity", "Lost Precursor City", LocationCategory.CRYSTALHOLLOWS), - CRYSTALNUCLEUS("crystalnucleus", "Crystal Nucleus", LocationCategory.CRYSTALHOLLOWS), - CRYSTALHOLLOWS("crystalhollows", "Crystal Hollows", LocationCategory.CRYSTALHOLLOWS), - FAIRYGROTTO("fairygrotto", "Fairy Grotto", LocationCategory.CRYSTALHOLLOWS); - - private final String name; - private final String displayName; - private final LocationCategory category; - - Locations(String name, String displayName, LocationCategory category) { - this.name = name; - this.displayName = displayName; - this.category = category; - } - - public String getName() { - return this.name; - } - - public String getDisplayName() { - return this.displayName; - } - - public LocationCategory getCategory() { - return this.category; - } - - public static Locations get(String id) { - try { - return Locations.valueOf(id.replace(" ", "").toUpperCase()); - } catch (IllegalArgumentException ex) { - return DEFAULT; - } - } - - @Override - public String toString() { - return this.name; - } -} +//package com.thatgravyboat.skyblockhud.location; +// +//public enum Locations { +// //ERROR LOCATIONS +// DEFAULT("unknown", "Error", LocationCategory.ERROR), +// NONE("none", "Unknown", LocationCategory.ERROR), +// //ISLAND +// YOURISLAND("yourisland", "Your Island", LocationCategory.ISLAND), +// GUESTISLAND("guestisland", "Guest Island", LocationCategory.ISLAND), +// MOULBERRYSISLAND("moulberryisland", "Cool Dude Hub", LocationCategory.ISLAND), +// //HUB +// VILLAGE("village", "Village", LocationCategory.HUB), +// AUCTIONHOUSE("auctionhouse", "Auction House", LocationCategory.HUB), +// BAZAARALLEY("bazaaralley", "Bazaar Alley", LocationCategory.HUB), +// BANK("bank", "Bank", LocationCategory.HUB), +// FASHIONSHOP("fashionshop", "Fashion Shop", LocationCategory.HUB), +// COLOSSEUM("colosseum", "Colosseum", LocationCategory.HUB), +// COLOSSEUMARENA("colosseumarena", "Colosseum Arena", LocationCategory.HUB), +// MOUNTAIN("mountain", "Mountain", LocationCategory.HUB), +// HIGHLEVEL("highlevel", "High Level", LocationCategory.HUB), +// WILDERNESS("wilderness", "Wilderness", LocationCategory.HUB), +// FISHERMANSHUT("fishermanshut", "Fisherman's Hut", LocationCategory.HUB), +// FLOWERHOUSE("flowerhouse", "Flower House", LocationCategory.HUB), +// CANVASROOM("canvasroom", "Canvas Room", LocationCategory.HUB), +// TAVERN("tavern", "Tavern", LocationCategory.HUB), +// FOREST("forest", "Forest", LocationCategory.HUB), +// RUINS("ruins", "Ruins", LocationCategory.HUB), +// GRAVEYARD("graveyard", "Graveyard", LocationCategory.HUB), +// COALMINE("coalmine", "Coal Mine", LocationCategory.HUB), +// FARM("farm", "Farm", LocationCategory.HUB), +// LIBRARY("library", "Library", LocationCategory.HUB), +// COMMUNITYCENTER("communitycenter", "Community Center", LocationCategory.HUB), +// ELECTIONROOM("electionroom", "Election Room", LocationCategory.HUB), +// BUILDERSHOUSE("buildershouse", "Builder's House", LocationCategory.HUB), +// BLACKSMITH("blacksmith", "Blacksmith", LocationCategory.HUB), +// FARMHOUSE("farmhouse", "Farmhouse", LocationCategory.HUB), +// WIZARDTOWER("wizardtower", "Wizard Tower", LocationCategory.HUB), +// //THE BARN +// THEBARN("thebarn", "The Barn", LocationCategory.BARN), +// WINDMILL("windmill", "Windmill", LocationCategory.BARN), +// //MUSHROOM DESERT +// MUSHROOMDESERT("mushroomdesert", "Mushroom Desert", LocationCategory.MUSHROOMDESERT), +// DESERTSETTLEMENT("desertsettlement", "Desert Settlement", LocationCategory.MUSHROOMDESERT), +// OASIS("oasis", "Oasis", LocationCategory.MUSHROOMDESERT), +// MUSHROOMGORGE("mushroomgorge", "Mushroom Gorge", LocationCategory.MUSHROOMDESERT), +// SHEPHERDSKEEP("shepherdskeep", "Shepherds Keep", LocationCategory.MUSHROOMDESERT), +// JAKESHOUSE("jakeshouse", "Jake's House", LocationCategory.MUSHROOMDESERT), +// TREASUREHUNTERCAMP("treasurehuntercamp", "Treasure Hunter Camp", LocationCategory.MUSHROOMDESERT), +// GLOWINGMUSHROOMCAVE("glowingmushroomcave", "Glowing Mushroom Cave", LocationCategory.MUSHROOMDESERT), +// TRAPPERSDEN("trappersden", "Trappers Den", LocationCategory.MUSHROOMDESERT), +// OVERGROWNMUSHROOMCAVE("overgrownmushroomcave", "Overgrown Mushroom Cave", LocationCategory.MUSHROOMDESERT), +// //GOLD MINE +// GOLDMINE("goldmine", "Gold Mine", LocationCategory.GOLDMINE), +// //DEEP CAVERNS +// DEEPCAVERNS("deepcaverns", "Deep Caverns", LocationCategory.DEEPCAVERNS), +// GUNPOWDERMINES("gunpowdermines", "Gunpowder Mines", LocationCategory.DEEPCAVERNS), +// LAPISQUARRY("lapisquarry", "Lapis Quarry", LocationCategory.DEEPCAVERNS), +// PIGMENSDEN("pigmensden", "Pigmen's Den", LocationCategory.DEEPCAVERNS), +// SLIMEHILL("slimehill", "Slimehill", LocationCategory.DEEPCAVERNS), +// DIAMONDRESERVE("diamondreserve", "Diamond Reserve", LocationCategory.DEEPCAVERNS), +// OBSIDIANSANCTUARY("obsidiansanctuary", "Obsidian Sanctuary", LocationCategory.DEEPCAVERNS), +// //SPIDERS DEN +// SPIDERSDEN("spidersden", "Spider's Den", LocationCategory.SPIDERSDEN), +// +// //THE END +// THEEND("theend", "The End", LocationCategory.THEEND), +// DRAGONSNEST("dragonsnest", "Dragon's Nest", LocationCategory.THEEND), +// VOIDSEPULTURE("voidsepulture", "Void Sepulture", LocationCategory.THEEND), +// //PARK +// HOWLINGCAVE("howlingcave", "Howling Cave", LocationCategory.PARK), +// BIRCHPARK("birchpark", "Birch Park", LocationCategory.PARK), +// SPRUCEWOODS("sprucewoods", "Spruce Woods", LocationCategory.PARK), +// DARKTHICKET("darkthicket", "Dark Thicket", LocationCategory.PARK), +// SAVANNAWOODLAND("savannawoodland", "Savanna Woodland", LocationCategory.PARK), +// JUNGLEISLAND("jungleisland", "Jungle Island", LocationCategory.PARK), +// //BLAZING FORTRESS +// BLAZINGFORTRESS("blazingfortress", "Blazing Fortress", LocationCategory.FORTRESS), +// //DUNGEONS +// DUNGEONHUB("dungeonhub", "Dungeon Hub", LocationCategory.DUNGEONHUB), +// CATACOMBS("catacombs", "The Catacombs", LocationCategory.DUNGEONHUB), +// CATACOMBSENTRANCE("catacombsentrance", "Catacombs Entrance", LocationCategory.DUNGEONHUB), +// //JERRYISLAND +// JERRYSWORKSHOP("jerrysworkshop", "Jerry's Workshop", LocationCategory.JERRY), +// JERRYPOND("jerrypond", "Jerry Pond", LocationCategory.JERRY), +// //DWARVENMINES +// THELIFT("thelift", "The Lift", LocationCategory.DWARVENMINES), +// DWARVENVILLAGE("dwarvenvillage", "Dwarven Village", LocationCategory.DWARVENMINES), +// DWARVENMINES("dwarvenmines", "Dwarven Mines", LocationCategory.DWARVENMINES), +// DWARVENTAVERN("dwarvemtavern", "Dwarven Tavern", LocationCategory.DWARVENMINES), +// LAVASPRINGS("lavasprings", "Lava Springs", LocationCategory.DWARVENMINES), +// PALACEBRIDGE("palacebridge", "Palace Bridge", LocationCategory.DWARVENMINES), +// ROYALPALACE("royalpalace", "Royal Palace", LocationCategory.DWARVENMINES), +// GRANDLIBRARY("grandlibrary", "Grand Library", LocationCategory.DWARVENMINES), +// ROYALQUARTERS("royalquarters", "Royal Quarters", LocationCategory.DWARVENMINES), +// BARRACKSOFHEROES("barracksofheroes", "Barracks of Heroes", LocationCategory.DWARVENMINES), +// HANGINGCOURT("hangingcourt", "Hanging Court", LocationCategory.DWARVENMINES), +// GREATICEWALL("greaticewall", "Great Ice Wall", LocationCategory.DWARVENMINES), +// GOBLINBURROWS("goblinburrows", "Goblin Burrows", LocationCategory.DWARVENMINES), +// FARRESERVE("farreserve", "Far Reserve", LocationCategory.DWARVENMINES), +// CCMINECARTSCO("ccminecartco", "Minecart Co.", LocationCategory.DWARVENMINES), +// UPPERMINES("uppermines", "Upper Mines", LocationCategory.DWARVENMINES), +// RAMPARTSQUARRY("rampartsquarry", "Ramparts Quarry", LocationCategory.DWARVENMINES), +// GATESTOTHEMINES("gatestothemines", "Gates to The Mines", LocationCategory.DWARVENMINES), +// FORGEBASIN("forgebasin", "Forge Basin", LocationCategory.DWARVENMINES), +// THEFORGE("theforge", "The Forge", LocationCategory.DWARVENMINES), +// CLIFFSIDEVEINS("cliffsideveins", "Cliffside Veins", LocationCategory.DWARVENMINES), +// DIVANSGATEWAY("divansgateway", "Divan's Gateway", LocationCategory.DWARVENMINES), +// THEMIST("themist", "The Mist", LocationCategory.DWARVENMINES), +// ROYALMINES("royalmines", "Royal Mines", LocationCategory.DWARVENMINES), +// ARISTOCRATPASSAGE("aristocratpassage", "Aristocrat Passage", LocationCategory.DWARVENMINES), +// MINERSGUILD("minersguild", "Miner's Guild", LocationCategory.DWARVENMINES), +// //CRYSTALHOLLOWS +// JUNGLE("jungle", "Jungle", LocationCategory.CRYSTALHOLLOWS), +// JUNGLETEMPLE("jungletemple", "Jungle Temple", LocationCategory.CRYSTALHOLLOWS), +// MITHRILDEPOSITS("mithrildeposits", "Mithril Deposits", LocationCategory.CRYSTALHOLLOWS), +// MINESOFDIVAN("minesofdivan", "Mines of Divan", LocationCategory.CRYSTALHOLLOWS), +// MAGMAFIELDS("magmafields", "Magma Fields", LocationCategory.CRYSTALHOLLOWS), +// KHAZADDM("khzaddm", "Khazad-d\u00FBm", LocationCategory.CRYSTALHOLLOWS), +// GOBLINHOLDOUT("goblinholdout", "Goblin Holdout", LocationCategory.CRYSTALHOLLOWS), +// GOBLINQUEENSDEN("goblinqueensden", "Goblin Queens Den", LocationCategory.CRYSTALHOLLOWS), +// PRECURSORREMNANTS("precursorremnants", "Precursor Remnants", LocationCategory.CRYSTALHOLLOWS), +// LOSTPRECURSORCITY("lostprecursorcity", "Lost Precursor City", LocationCategory.CRYSTALHOLLOWS), +// CRYSTALNUCLEUS("crystalnucleus", "Crystal Nucleus", LocationCategory.CRYSTALHOLLOWS), +// CRYSTALHOLLOWS("crystalhollows", "Crystal Hollows", LocationCategory.CRYSTALHOLLOWS), +// FAIRYGROTTO("fairygrotto", "Fairy Grotto", LocationCategory.CRYSTALHOLLOWS); +// +// private final String name; +// private final String displayName; +// private final LocationCategory category; +// +// Locations(String name, String displayName, LocationCategory category) { +// this.name = name; +// this.displayName = displayName; +// this.category = category; +// } +// +// public String getName() { +// return this.name; +// } +// +// public String getDisplayName() { +// return this.displayName; +// } +// +// public LocationCategory getCategory() { +// return this.category; +// } +// +// public static Locations get(String id) { +// try { +// return Locations.valueOf(id.replace(" ", "").toUpperCase()); +// } catch (IllegalArgumentException ex) { +// return DEFAULT; +// } +// } +// +// @Override +// public String toString() { +// return this.name; +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java index ebde7dba7..b9c7657bc 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java @@ -1,192 +1,192 @@ -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 { - - public enum Event { - NONE(0, "Unknown", false, false), - TICKET(107, "Raffle", true, true), - GOBLIN(99, "Goblin Raid", true, true), - WIND(0, "Gone With The Wind", false, false), - TOGETHER(171, "Better Together", false, true); - - public int x; - public String displayName; - public boolean needsMax; - public boolean display; - - Event(int x, String displayName, boolean needsMax, boolean display) { - this.x = x; - this.displayName = displayName; - this.needsMax = needsMax; - this.display = display; - } - } - - public static int mithril; - public static int gemstone; - - public static int eventMax; - public static int eventProgress; - public static Event currentEvent; - - private static final DecimalFormat NORMAL_FORMATTER = new DecimalFormat("#,###", DecimalFormatSymbols.getInstance(Locale.CANADA)); - private static final DecimalFormat SHORT_FORMATTER = new DecimalFormat("#.#", DecimalFormatSymbols.getInstance(Locale.CANADA)); - - static { - SHORT_FORMATTER.setRoundingMode(RoundingMode.FLOOR); - } - - public static String getMithrilFormatted() { - String output = NORMAL_FORMATTER.format(mithril); - if (output.equals(".0")) output = "0.0"; else if (output.equals(",0")) output = "0,0"; - return output; - } - - public static String getMithrilShortFormatted() { - return mithril > 999 ? SHORT_FORMATTER.format((double) mithril / 1000) + "k" : String.valueOf(mithril); - } - - public static String getGemstoneFormatted() { - String output = NORMAL_FORMATTER.format(gemstone); - if (output.equals(".0")) output = "0.0"; else if (output.equals(",0")) output = "0,0"; - return output; - } - - public static String getGemstoneShortFormatted() { - return gemstone > 999 ? SHORT_FORMATTER.format((double) gemstone / 1000) + "k" : String.valueOf(gemstone); - } - - public static void parseMithril(String line) { - try { - mithril = Integer.parseInt(line.toLowerCase().replace("mithril powder:", "").trim()); - } catch (Exception ignored) {} - } - - public static void parseGemstone(String line) { - try { - gemstone = Integer.parseInt(line.toLowerCase().replace("gemstone powder:", "").trim()); - } catch (Exception ignored) {} - } - - @SubscribeEvent - public void onSidebarLineUpdate(SidebarLineUpdateEvent event) { - if (event.formattedLine.toLowerCase().contains("heat")) { - try { - MiningHud.setHeat(Integer.parseInt(event.formattedLine.toLowerCase().replace("heat:", "").trim())); - } catch (Exception ignored) {} - } - if (event.formattedLine.toLowerCase().contains("mithril")) { - try { - mithril = Integer.parseInt(event.formattedLine.toLowerCase().replace("mithril:", "").trim()); - } catch (Exception ignored) {} - } - if (event.formattedLine.toLowerCase().contains("gemstone")) { - try { - gemstone = Integer.parseInt(event.formattedLine.toLowerCase().replace("gemstone:", "").trim()); - } catch (Exception ignored) {} - } - if (event.formattedLine.toLowerCase().contains("event")) { - if (event.formattedLine.toLowerCase().contains("raffle")) { - MinesHandler.currentEvent = Event.TICKET; - } else if (event.formattedLine.toLowerCase().contains("goblin raid")) { - MinesHandler.currentEvent = Event.GOBLIN; - } - } - if (event.formattedLine.equalsIgnoreCase("wind compass")) { - MinesHandler.currentEvent = Event.WIND; - } - if (event.formattedLine.toLowerCase(Locale.ENGLISH).contains("nearby players")) { - MinesHandler.currentEvent = Event.TOGETHER; - try { - MinesHandler.eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("nearby players:", "").trim()); - } catch (Exception ignored) {} - } - - if (MinesHandler.currentEvent != Event.NONE) { - if (MinesHandler.currentEvent == Event.TICKET) { - if (event.formattedLine.toLowerCase().contains("pool:")) { - try { - eventMax = Integer.parseInt(event.formattedLine.toLowerCase().replace("pool:", "").trim().split("/")[0].trim()); - } catch (Exception ignored) {} - } else if (event.formattedLine.toLowerCase().contains("tickets:")) { - try { - eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("tickets:", "").split("\\(")[0].trim()); - } catch (Exception ignored) {} - } - } else if (MinesHandler.currentEvent == Event.GOBLIN) { - if (event.formattedLine.toLowerCase().contains("remaining:")) { - try { - eventMax = Integer.parseInt(event.formattedLine.toLowerCase().replace("goblins", "").replace("remaining:", "").trim()); - } catch (Exception ignored) {} - } else if (event.formattedLine.toLowerCase().contains("your kills:") && !event.formattedLine.toLowerCase().contains("(")) { - try { - eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("your kills:", "").trim()); - } catch (Exception ignored) {} - } - } - } - } - - @SubscribeEvent - public void onSidebarPost(SidebarPostEvent event) { - String arrayString = Arrays.toString(event.arrayScores); - boolean hasEvent = arrayString.toLowerCase().contains("event:"); - boolean hasWind = arrayString.toLowerCase().contains("wind compass"); - boolean hasNearbyPlayers = arrayString.toLowerCase().contains("nearby players"); - - if (!hasEvent && !hasWind && !hasNearbyPlayers) { - MinesHandler.currentEvent = Event.NONE; - MinesHandler.eventProgress = 0; - MinesHandler.eventMax = 0; - } - if (!arrayString.toLowerCase().contains("heat:")) { - 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; - } -} +//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 { +// +// public enum Event { +// NONE(0, "Unknown", false, false), +// TICKET(107, "Raffle", true, true), +// GOBLIN(99, "Goblin Raid", true, true), +// WIND(0, "Gone With The Wind", false, false), +// TOGETHER(171, "Better Together", false, true); +// +// public int x; +// public String displayName; +// public boolean needsMax; +// public boolean display; +// +// Event(int x, String displayName, boolean needsMax, boolean display) { +// this.x = x; +// this.displayName = displayName; +// this.needsMax = needsMax; +// this.display = display; +// } +// } +// +// public static int mithril; +// public static int gemstone; +// +// public static int eventMax; +// public static int eventProgress; +// public static Event currentEvent; +// +// private static final DecimalFormat NORMAL_FORMATTER = new DecimalFormat("#,###", DecimalFormatSymbols.getInstance(Locale.CANADA)); +// private static final DecimalFormat SHORT_FORMATTER = new DecimalFormat("#.#", DecimalFormatSymbols.getInstance(Locale.CANADA)); +// +// static { +// SHORT_FORMATTER.setRoundingMode(RoundingMode.FLOOR); +// } +// +// public static String getMithrilFormatted() { +// String output = NORMAL_FORMATTER.format(mithril); +// if (output.equals(".0")) output = "0.0"; else if (output.equals(",0")) output = "0,0"; +// return output; +// } +// +// public static String getMithrilShortFormatted() { +// return mithril > 999 ? SHORT_FORMATTER.format((double) mithril / 1000) + "k" : String.valueOf(mithril); +// } +// +// public static String getGemstoneFormatted() { +// String output = NORMAL_FORMATTER.format(gemstone); +// if (output.equals(".0")) output = "0.0"; else if (output.equals(",0")) output = "0,0"; +// return output; +// } +// +// public static String getGemstoneShortFormatted() { +// return gemstone > 999 ? SHORT_FORMATTER.format((double) gemstone / 1000) + "k" : String.valueOf(gemstone); +// } +// +// public static void parseMithril(String line) { +// try { +// mithril = Integer.parseInt(line.toLowerCase().replace("mithril powder:", "").trim()); +// } catch (Exception ignored) {} +// } +// +// public static void parseGemstone(String line) { +// try { +// gemstone = Integer.parseInt(line.toLowerCase().replace("gemstone powder:", "").trim()); +// } catch (Exception ignored) {} +// } +// +// @SubscribeEvent +// public void onSidebarLineUpdate(SidebarLineUpdateEvent event) { +// if (event.formattedLine.toLowerCase().contains("heat")) { +// try { +// MiningHud.setHeat(Integer.parseInt(event.formattedLine.toLowerCase().replace("heat:", "").trim())); +// } catch (Exception ignored) {} +// } +// if (event.formattedLine.toLowerCase().contains("mithril")) { +// try { +// mithril = Integer.parseInt(event.formattedLine.toLowerCase().replace("mithril:", "").trim()); +// } catch (Exception ignored) {} +// } +// if (event.formattedLine.toLowerCase().contains("gemstone")) { +// try { +// gemstone = Integer.parseInt(event.formattedLine.toLowerCase().replace("gemstone:", "").trim()); +// } catch (Exception ignored) {} +// } +// if (event.formattedLine.toLowerCase().contains("event")) { +// if (event.formattedLine.toLowerCase().contains("raffle")) { +// MinesHandler.currentEvent = Event.TICKET; +// } else if (event.formattedLine.toLowerCase().contains("goblin raid")) { +// MinesHandler.currentEvent = Event.GOBLIN; +// } +// } +// if (event.formattedLine.equalsIgnoreCase("wind compass")) { +// MinesHandler.currentEvent = Event.WIND; +// } +// if (event.formattedLine.toLowerCase(Locale.ENGLISH).contains("nearby players")) { +// MinesHandler.currentEvent = Event.TOGETHER; +// try { +// MinesHandler.eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("nearby players:", "").trim()); +// } catch (Exception ignored) {} +// } +// +// if (MinesHandler.currentEvent != Event.NONE) { +// if (MinesHandler.currentEvent == Event.TICKET) { +// if (event.formattedLine.toLowerCase().contains("pool:")) { +// try { +// eventMax = Integer.parseInt(event.formattedLine.toLowerCase().replace("pool:", "").trim().split("/")[0].trim()); +// } catch (Exception ignored) {} +// } else if (event.formattedLine.toLowerCase().contains("tickets:")) { +// try { +// eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("tickets:", "").split("\\(")[0].trim()); +// } catch (Exception ignored) {} +// } +// } else if (MinesHandler.currentEvent == Event.GOBLIN) { +// if (event.formattedLine.toLowerCase().contains("remaining:")) { +// try { +// eventMax = Integer.parseInt(event.formattedLine.toLowerCase().replace("goblins", "").replace("remaining:", "").trim()); +// } catch (Exception ignored) {} +// } else if (event.formattedLine.toLowerCase().contains("your kills:") && !event.formattedLine.toLowerCase().contains("(")) { +// try { +// eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("your kills:", "").trim()); +// } catch (Exception ignored) {} +// } +// } +// } +// } +// +// @SubscribeEvent +// public void onSidebarPost(SidebarPostEvent event) { +// String arrayString = Arrays.toString(event.arrayScores); +// boolean hasEvent = arrayString.toLowerCase().contains("event:"); +// boolean hasWind = arrayString.toLowerCase().contains("wind compass"); +// boolean hasNearbyPlayers = arrayString.toLowerCase().contains("nearby players"); +// +// if (!hasEvent && !hasWind && !hasNearbyPlayers) { +// MinesHandler.currentEvent = Event.NONE; +// MinesHandler.eventProgress = 0; +// MinesHandler.eventMax = 0; +// } +// if (!arrayString.toLowerCase().contains("heat:")) { +// 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/MixinEntityArrow.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEntityArrow.java index dbde075ee..d892c01f1 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEntityArrow.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEntityArrow.java @@ -1,26 +1,26 @@ -package com.thatgravyboat.skyblockhud.mixins; - -import com.thatgravyboat.skyblockhud.api.KillTracking; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; -import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.util.MovingObjectPosition; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.ModifyVariable; - -@Mixin(EntityArrow.class) -public class MixinEntityArrow { - - @Shadow - public Entity shootingEntity; - - @ModifyVariable(method = "onUpdate", at = @At(value = "STORE", ordinal = 1)) - public MovingObjectPosition onUpdate(MovingObjectPosition position) { - if (position != null && position.entityHit != null && this.shootingEntity != null && this.shootingEntity.getUniqueID().equals(Minecraft.getMinecraft().thePlayer.getUniqueID())) { - KillTracking.attackedEntities.add(position.entityHit.getUniqueID()); - } - return position; - } -} +//package com.thatgravyboat.skyblockhud.mixins; +// +//import com.thatgravyboat.skyblockhud.api.KillTracking; +//import net.minecraft.client.Minecraft; +//import net.minecraft.entity.Entity; +//import net.minecraft.entity.projectile.EntityArrow; +//import net.minecraft.util.MovingObjectPosition; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.Shadow; +//import org.spongepowered.asm.mixin.injection.At; +//import org.spongepowered.asm.mixin.injection.ModifyVariable; +// +//@Mixin(EntityArrow.class) +//public class MixinEntityArrow { +// +// @Shadow +// public Entity shootingEntity; +// +// @ModifyVariable(method = "onUpdate", at = @At(value = "STORE", ordinal = 1)) +// public MovingObjectPosition onUpdate(MovingObjectPosition position) { +// if (position != null && position.entityHit != null && this.shootingEntity != null && this.shootingEntity.getUniqueID().equals(Minecraft.getMinecraft().thePlayer.getUniqueID())) { +// KillTracking.attackedEntities.add(position.entityHit.getUniqueID()); +// } +// return position; +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java index 083b48588..078bdce8f 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java @@ -1,113 +1,113 @@ -package com.thatgravyboat.skyblockhud.mixins; - -import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.*; - -import at.lorenz.mod.LorenzMod; -import com.thatgravyboat.skyblockhud.overlay.MiningHud; -import com.thatgravyboat.skyblockhud.utils.Utils; -import net.minecraft.client.Minecraft; -import net.minecraftforge.client.GuiIngameForge; -import net.minecraftforge.client.event.RenderGameOverlayEvent; -import net.minecraftforge.common.MinecraftForge; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(GuiIngameForge.class) -public class MixinGuiIngameForge { - - @Shadow(remap = false) - private RenderGameOverlayEvent eventParent; - - @Inject(method = "renderArmor", at = @At("HEAD"), cancellable = true, remap = false) - public void onRenderArmor(int width, int height, CallbackInfo ci) { - if (LorenzMod.config.renderer.hideArmor && LorenzMod.hasSkyblockScoreboard()) { - ci.cancel(); - if (prePost(ARMOR, eventParent)) return; - postPost(ARMOR, eventParent); - } - } - - @Inject(method = "renderHealth", at = @At("HEAD"), cancellable = true, remap = false) - public void onRenderHealth(int width, int height, CallbackInfo ci) { - if (LorenzMod.config.renderer.hideHearts && LorenzMod.hasSkyblockScoreboard()) { - ci.cancel(); - if (prePost(HEALTH, eventParent)) return; - postPost(HEALTH, eventParent); - } - } - - @Inject(method = "renderAir", at = @At("HEAD"), cancellable = true, remap = false) - public void onRenderAir(int width, int height, CallbackInfo ci) { - if (LorenzMod.config.renderer.hideAir && LorenzMod.hasSkyblockScoreboard()) { - ci.cancel(); - if (prePost(AIR, eventParent)) return; - postPost(AIR, eventParent); - } - } - - @Inject(method = "renderHealthMount", at = @At("HEAD"), cancellable = true, remap = false) - public void onRenderHealthMount(int width, int height, CallbackInfo ci) { - if (LorenzMod.config.renderer.hideAnimalHearts && LorenzMod.hasSkyblockScoreboard()) { - ci.cancel(); - if (prePost(HEALTHMOUNT, eventParent)) return; - postPost(HEALTHMOUNT, eventParent); - } - } - - @Inject(method = "renderExperience", at = @At("HEAD"), cancellable = true, remap = false) - public void onRenderExperience(int width, int height, CallbackInfo ci) { - if (LorenzMod.config.renderer.hideXpBar && LorenzMod.hasSkyblockScoreboard()) { - ci.cancel(); - if (prePost(EXPERIENCE, eventParent)) return; - postPost(EXPERIENCE, eventParent); - } else if (LorenzMod.config.mining.barMode == 1) { - if (!LorenzMod.config.renderer.hideXpBar && (LorenzMod.config.mining.showDrillBar || LorenzMod.config.mining.showHeatBar) && LorenzMod.hasSkyblockScoreboard()) { - if (MiningHud.getHeat() > 0 || Utils.isDrill(Minecraft.getMinecraft().thePlayer.getHeldItem())) { - ci.cancel(); - if (prePost(EXPERIENCE, eventParent)) return; - postPost(EXPERIENCE, eventParent); - } - } - } - } - - @Inject(method = "renderJumpBar", at = @At("HEAD"), cancellable = true, remap = false) - public void onRenderJumpBar(int width, int height, CallbackInfo ci) { - if (LorenzMod.config.renderer.hideXpBar && LorenzMod.hasSkyblockScoreboard()) { - ci.cancel(); - if (prePost(JUMPBAR, eventParent)) return; - postPost(JUMPBAR, eventParent); - } else if (LorenzMod.config.mining.barMode == 1) { - if (!LorenzMod.config.renderer.hideXpBar && (LorenzMod.config.mining.showDrillBar || LorenzMod.config.mining.showHeatBar) && LorenzMod.hasSkyblockScoreboard()) { - if (MiningHud.getHeat() > 0 || Utils.isDrill(Minecraft.getMinecraft().thePlayer.getHeldItem())) { - ci.cancel(); - if (prePost(JUMPBAR, eventParent)) return; - postPost(JUMPBAR, eventParent); - } - } - } - } - - @Inject(method = "renderFood", at = @At("HEAD"), cancellable = true, remap = false) - public void onRenderFood(int width, int height, CallbackInfo ci) { - if (LorenzMod.config.renderer.hideFood && LorenzMod.hasSkyblockScoreboard()) { - ci.cancel(); - if (prePost(FOOD, eventParent)) return; - postPost(FOOD, eventParent); - } - } - - @Unique - private static boolean prePost(RenderGameOverlayEvent.ElementType type, RenderGameOverlayEvent eventParent) { - return MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Pre(eventParent, type)); - } - - @Unique - private static void postPost(RenderGameOverlayEvent.ElementType type, RenderGameOverlayEvent eventParent) { - MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(eventParent, type)); - } -} +//package com.thatgravyboat.skyblockhud.mixins; +// +//import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.*; +// +//import at.lorenz.mod.LorenzMod; +//import com.thatgravyboat.skyblockhud.overlay.MiningHud; +//import com.thatgravyboat.skyblockhud.utils.Utils; +//import net.minecraft.client.Minecraft; +//import net.minecraftforge.client.GuiIngameForge; +//import net.minecraftforge.client.event.RenderGameOverlayEvent; +//import net.minecraftforge.common.MinecraftForge; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.Shadow; +//import org.spongepowered.asm.mixin.Unique; +//import org.spongepowered.asm.mixin.injection.At; +//import org.spongepowered.asm.mixin.injection.Inject; +//import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +// +//@Mixin(GuiIngameForge.class) +//public class MixinGuiIngameForge { +// +// @Shadow(remap = false) +// private RenderGameOverlayEvent eventParent; +// +// @Inject(method = "renderArmor", at = @At("HEAD"), cancellable = true, remap = false) +// public void onRenderArmor(int width, int height, CallbackInfo ci) { +// if (LorenzMod.config.renderer.hideArmor && LorenzMod.hasSkyblockScoreboard()) { +// ci.cancel(); +// if (prePost(ARMOR, eventParent)) return; +// postPost(ARMOR, eventParent); +// } +// } +// +// @Inject(method = "renderHealth", at = @At("HEAD"), cancellable = true, remap = false) +// public void onRenderHealth(int width, int height, CallbackInfo ci) { +// if (LorenzMod.config.renderer.hideHearts && LorenzMod.hasSkyblockScoreboard()) { +// ci.cancel(); +// if (prePost(HEALTH, eventParent)) return; +// postPost(HEALTH, eventParent); +// } +// } +// +// @Inject(method = "renderAir", at = @At("HEAD"), cancellable = true, remap = false) +// public void onRenderAir(int width, int height, CallbackInfo ci) { +// if (LorenzMod.config.renderer.hideAir && LorenzMod.hasSkyblockScoreboard()) { +// ci.cancel(); +// if (prePost(AIR, eventParent)) return; +// postPost(AIR, eventParent); +// } +// } +// +// @Inject(method = "renderHealthMount", at = @At("HEAD"), cancellable = true, remap = false) +// public void onRenderHealthMount(int width, int height, CallbackInfo ci) { +// if (LorenzMod.config.renderer.hideAnimalHearts && LorenzMod.hasSkyblockScoreboard()) { +// ci.cancel(); +// if (prePost(HEALTHMOUNT, eventParent)) return; +// postPost(HEALTHMOUNT, eventParent); +// } +// } +// +// @Inject(method = "renderExperience", at = @At("HEAD"), cancellable = true, remap = false) +// public void onRenderExperience(int width, int height, CallbackInfo ci) { +// if (LorenzMod.config.renderer.hideXpBar && LorenzMod.hasSkyblockScoreboard()) { +// ci.cancel(); +// if (prePost(EXPERIENCE, eventParent)) return; +// postPost(EXPERIENCE, eventParent); +// } else if (LorenzMod.config.mining.barMode == 1) { +// if (!LorenzMod.config.renderer.hideXpBar && (LorenzMod.config.mining.showDrillBar || LorenzMod.config.mining.showHeatBar) && LorenzMod.hasSkyblockScoreboard()) { +// if (MiningHud.getHeat() > 0 || Utils.isDrill(Minecraft.getMinecraft().thePlayer.getHeldItem())) { +// ci.cancel(); +// if (prePost(EXPERIENCE, eventParent)) return; +// postPost(EXPERIENCE, eventParent); +// } +// } +// } +// } +// +// @Inject(method = "renderJumpBar", at = @At("HEAD"), cancellable = true, remap = false) +// public void onRenderJumpBar(int width, int height, CallbackInfo ci) { +// if (LorenzMod.config.renderer.hideXpBar && LorenzMod.hasSkyblockScoreboard()) { +// ci.cancel(); +// if (prePost(JUMPBAR, eventParent)) return; +// postPost(JUMPBAR, eventParent); +// } else if (LorenzMod.config.mining.barMode == 1) { +// if (!LorenzMod.config.renderer.hideXpBar && (LorenzMod.config.mining.showDrillBar || LorenzMod.config.mining.showHeatBar) && LorenzMod.hasSkyblockScoreboard()) { +// if (MiningHud.getHeat() > 0 || Utils.isDrill(Minecraft.getMinecraft().thePlayer.getHeldItem())) { +// ci.cancel(); +// if (prePost(JUMPBAR, eventParent)) return; +// postPost(JUMPBAR, eventParent); +// } +// } +// } +// } +// +// @Inject(method = "renderFood", at = @At("HEAD"), cancellable = true, remap = false) +// public void onRenderFood(int width, int height, CallbackInfo ci) { +// if (LorenzMod.config.renderer.hideFood && LorenzMod.hasSkyblockScoreboard()) { +// ci.cancel(); +// if (prePost(FOOD, eventParent)) return; +// postPost(FOOD, eventParent); +// } +// } +// +// @Unique +// private static boolean prePost(RenderGameOverlayEvent.ElementType type, RenderGameOverlayEvent eventParent) { +// return MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Pre(eventParent, type)); +// } +// +// @Unique +// private static void postPost(RenderGameOverlayEvent.ElementType type, RenderGameOverlayEvent eventParent) { +// MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(eventParent, type)); +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinItemStack.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinItemStack.java index 9e2fcc519..eef185561 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinItemStack.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinItemStack.java @@ -1,42 +1,42 @@ -package com.thatgravyboat.skyblockhud.mixins; - -import at.lorenz.mod.LorenzMod; -import com.thatgravyboat.skyblockhud.api.item.IAbility; -import com.thatgravyboat.skyblockhud.handlers.CooldownHandler; -import java.util.regex.Matcher; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(ItemStack.class) -public class MixinItemStack implements IAbility { - - private String ability; - private int abilityTime; - - @Inject(method = "setTagCompound", at = @At("HEAD")) - public void onNbt(NBTTagCompound nbt, CallbackInfo ci) { - if (LorenzMod.config != null && !LorenzMod.config.misc.hideItemCooldowns) { - Matcher abilityMatcher = CooldownHandler.getAbility(nbt); - if (abilityMatcher != null) { - ability = abilityMatcher.group(1); - try { - abilityTime = Integer.parseInt(abilityMatcher.group(2).trim()); - } catch (Exception ignored) {} - } - } - } - - @Override - public String getAbility() { - return ability; - } - - @Override - public int getAbilityTime() { - return abilityTime; - } -} +//package com.thatgravyboat.skyblockhud.mixins; +// +//import at.lorenz.mod.LorenzMod; +//import com.thatgravyboat.skyblockhud.api.item.IAbility; +//import com.thatgravyboat.skyblockhud.handlers.CooldownHandler; +//import java.util.regex.Matcher; +//import net.minecraft.item.ItemStack; +//import net.minecraft.nbt.NBTTagCompound; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.injection.At; +//import org.spongepowered.asm.mixin.injection.Inject; +//import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +// +//@Mixin(ItemStack.class) +//public class MixinItemStack implements IAbility { +// +// private String ability; +// private int abilityTime; +// +// @Inject(method = "setTagCompound", at = @At("HEAD")) +// public void onNbt(NBTTagCompound nbt, CallbackInfo ci) { +// if (LorenzMod.config != null && !LorenzMod.config.misc.hideItemCooldowns) { +// Matcher abilityMatcher = CooldownHandler.getAbility(nbt); +// if (abilityMatcher != null) { +// ability = abilityMatcher.group(1); +// try { +// abilityTime = Integer.parseInt(abilityMatcher.group(2).trim()); +// } catch (Exception ignored) {} +// } +// } +// } +// +// @Override +// public String getAbility() { +// return ability; +// } +// +// @Override +// public int getAbilityTime() { +// return abilityTime; +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinNetHandlerPlayClient.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinNetHandlerPlayClient.java index 6c5f55e24..9d5bf57bc 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinNetHandlerPlayClient.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinNetHandlerPlayClient.java @@ -1,67 +1,67 @@ -package com.thatgravyboat.skyblockhud.mixins; - -import at.lorenz.mod.LorenzMod; -import com.thatgravyboat.skyblockhud.tracker.TrackerHandler; -import net.minecraft.client.Minecraft; -import net.minecraft.client.network.NetHandlerPlayClient; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.PacketThreadUtil; -import net.minecraft.network.play.server.S2FPacketSetSlot; -import net.minecraft.network.play.server.S3EPacketTeams; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.scoreboard.Scoreboard; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; - -@Mixin(NetHandlerPlayClient.class) -public class MixinNetHandlerPlayClient { - - @Inject(method = "handleSetSlot", at = @At("HEAD")) - public void onHandleSetSlot(S2FPacketSetSlot packetIn, CallbackInfo ci) { - if (LorenzMod.hasSkyblockScoreboard()) { - Minecraft mc = Minecraft.getMinecraft(); - PacketThreadUtil.checkThreadAndEnqueue(packetIn, mc.getNetHandler(), mc); - if (packetIn.func_149175_c() == 0) { - ItemStack stack = packetIn.func_149174_e(); - - if (stack != null && stack.hasTagCompound()) { - if (stack.getTagCompound().hasKey("ExtraAttributes")) { - NBTTagCompound extraAttributes = stack.getTagCompound().getCompoundTag("ExtraAttributes"); - String id = extraAttributes.getString("id"); - ItemStack slotStack = Minecraft.getMinecraft().thePlayer.inventoryContainer.getSlot(packetIn.func_149173_d()).getStack(); - int changeAmount = stack.stackSize - (slotStack == null ? 0 : slotStack.stackSize); - String specialId = null; - int number = -1; - if (extraAttributes.hasKey("enchantments")) { - NBTTagCompound enchantments = extraAttributes.getCompoundTag("enchantments"); - if (enchantments.getKeySet().size() == 1) { - for (String e : enchantments.getKeySet()) { - specialId = e; - break; - } - if (specialId != null) number = enchantments.getInteger(specialId); - } - } - TrackerHandler.onItemAdded(id, changeAmount, specialId, number); - } - } - } - } - } - - @Inject(method = "handleTeams", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/network/play/server/S3EPacketTeams;getAction()I", ordinal = 0, shift = At.Shift.BEFORE), cancellable = true) - public void handleTeams(S3EPacketTeams packetIn, CallbackInfo ci, Scoreboard scoreboard) { - //This stops Hypixel from being stupid and spamming our logs because they dont have different ids for things. - if (scoreboard.getTeam(packetIn.getName()) != null && packetIn.getAction() == 0) ci.cancel(); - } - - @Inject(method = "handleTeams", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/network/play/server/S3EPacketTeams;getAction()I", ordinal = 6, shift = At.Shift.BEFORE), cancellable = true) - public void handleTeamRemove(S3EPacketTeams packetIn, CallbackInfo ci, Scoreboard scoreboard, ScorePlayerTeam scoreplayerteam) { - //This stops Hypixel from being stupid and spamming our logs because they dont have different ids for things. - if (scoreplayerteam == null) ci.cancel(); - } -} +//package com.thatgravyboat.skyblockhud.mixins; +// +//import at.lorenz.mod.LorenzMod; +//import com.thatgravyboat.skyblockhud.tracker.TrackerHandler; +//import net.minecraft.client.Minecraft; +//import net.minecraft.client.network.NetHandlerPlayClient; +//import net.minecraft.item.ItemStack; +//import net.minecraft.nbt.NBTTagCompound; +//import net.minecraft.network.PacketThreadUtil; +//import net.minecraft.network.play.server.S2FPacketSetSlot; +//import net.minecraft.network.play.server.S3EPacketTeams; +//import net.minecraft.scoreboard.ScorePlayerTeam; +//import net.minecraft.scoreboard.Scoreboard; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.injection.At; +//import org.spongepowered.asm.mixin.injection.Inject; +//import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +//import org.spongepowered.asm.mixin.injection.callback.LocalCapture; +// +//@Mixin(NetHandlerPlayClient.class) +//public class MixinNetHandlerPlayClient { +// +// @Inject(method = "handleSetSlot", at = @At("HEAD")) +// public void onHandleSetSlot(S2FPacketSetSlot packetIn, CallbackInfo ci) { +// if (LorenzMod.hasSkyblockScoreboard()) { +// Minecraft mc = Minecraft.getMinecraft(); +// PacketThreadUtil.checkThreadAndEnqueue(packetIn, mc.getNetHandler(), mc); +// if (packetIn.func_149175_c() == 0) { +// ItemStack stack = packetIn.func_149174_e(); +// +// if (stack != null && stack.hasTagCompound()) { +// if (stack.getTagCompound().hasKey("ExtraAttributes")) { +// NBTTagCompound extraAttributes = stack.getTagCompound().getCompoundTag("ExtraAttributes"); +// String id = extraAttributes.getString("id"); +// ItemStack slotStack = Minecraft.getMinecraft().thePlayer.inventoryContainer.getSlot(packetIn.func_149173_d()).getStack(); +// int changeAmount = stack.stackSize - (slotStack == null ? 0 : slotStack.stackSize); +// String specialId = null; +// int number = -1; +// if (extraAttributes.hasKey("enchantments")) { +// NBTTagCompound enchantments = extraAttributes.getCompoundTag("enchantments"); +// if (enchantments.getKeySet().size() == 1) { +// for (String e : enchantments.getKeySet()) { +// specialId = e; +// break; +// } +// if (specialId != null) number = enchantments.getInteger(specialId); +// } +// } +// TrackerHandler.onItemAdded(id, changeAmount, specialId, number); +// } +// } +// } +// } +// } +// +// @Inject(method = "handleTeams", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/network/play/server/S3EPacketTeams;getAction()I", ordinal = 0, shift = At.Shift.BEFORE), cancellable = true) +// public void handleTeams(S3EPacketTeams packetIn, CallbackInfo ci, Scoreboard scoreboard) { +// //This stops Hypixel from being stupid and spamming our logs because they dont have different ids for things. +// if (scoreboard.getTeam(packetIn.getName()) != null && packetIn.getAction() == 0) ci.cancel(); +// } +// +// @Inject(method = "handleTeams", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/network/play/server/S3EPacketTeams;getAction()I", ordinal = 6, shift = At.Shift.BEFORE), cancellable = true) +// public void handleTeamRemove(S3EPacketTeams packetIn, CallbackInfo ci, Scoreboard scoreboard, ScorePlayerTeam scoreplayerteam) { +// //This stops Hypixel from being stupid and spamming our logs because they dont have different ids for things. +// if (scoreplayerteam == null) ci.cancel(); +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinRenderItem.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinRenderItem.java index ae7d5bf89..64f9086fb 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinRenderItem.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinRenderItem.java @@ -1,63 +1,63 @@ -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; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.item.ItemStack; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(RenderItem.class) -public abstract class MixinRenderItem { - - @Shadow - protected abstract void draw(WorldRenderer renderer, int x, int y, int width, int height, int red, int green, int blue, int alpha); - - @Inject(method = "renderItemOverlayIntoGUI", at = @At("RETURN")) - public void renderItemOverlayIntoGUI(FontRenderer fr, ItemStack stack, int xPosition, int yPosition, String text, CallbackInfo ci) { - 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(); - 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(cooldown * 13f), 1, 102, 102, 255, 255); - GlStateManager.enableAlpha(); - GlStateManager.enableTexture2D(); - GlStateManager.enableLighting(); - GlStateManager.enableDepth(); - } - } -} +//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; +//import net.minecraft.client.renderer.WorldRenderer; +//import net.minecraft.client.renderer.entity.RenderItem; +//import net.minecraft.item.ItemStack; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.Shadow; +//import org.spongepowered.asm.mixin.injection.At; +//import org.spongepowered.asm.mixin.injection.Inject; +//import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +// +//@Mixin(RenderItem.class) +//public abstract class MixinRenderItem { +// +// @Shadow +// protected abstract void draw(WorldRenderer renderer, int x, int y, int width, int height, int red, int green, int blue, int alpha); +// +// @Inject(method = "renderItemOverlayIntoGUI", at = @At("RETURN")) +// public void renderItemOverlayIntoGUI(FontRenderer fr, ItemStack stack, int xPosition, int yPosition, String text, CallbackInfo ci) { +// 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(); +// 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(cooldown * 13f), 1, 102, 102, 255, 255); +// GlStateManager.enableAlpha(); +// GlStateManager.enableTexture2D(); +// GlStateManager.enableLighting(); +// GlStateManager.enableDepth(); +// } +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/DungeonOverlay.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/DungeonOverlay.java index d50ce1c69..b158b004c 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/DungeonOverlay.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/DungeonOverlay.java @@ -1,149 +1,149 @@ -package com.thatgravyboat.skyblockhud.overlay; - -import at.lorenz.mod.LorenzMod; -import com.thatgravyboat.skyblockhud.config.SBHConfig; -import com.thatgravyboat.skyblockhud.core.config.Position; -import com.thatgravyboat.skyblockhud.dungeons.Classes; -import com.thatgravyboat.skyblockhud.dungeons.DungeonHandler; -import com.thatgravyboat.skyblockhud.dungeons.DungeonPlayer; -import com.thatgravyboat.skyblockhud.handlers.BossbarHandler; -import com.thatgravyboat.skyblockhud.location.LocationHandler; -import com.thatgravyboat.skyblockhud.location.Locations; -import com.thatgravyboat.skyblockhud.textures.Textures; -import com.thatgravyboat.skyblockhud.utils.SpecialColour; -import com.thatgravyboat.skyblockhud.utils.Utils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.boss.BossStatus; -import net.minecraftforge.client.GuiIngameForge; -import net.minecraftforge.client.event.RenderGameOverlayEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class DungeonOverlay extends Gui { - - private static final FontRenderer font = Minecraft.getMinecraft().fontRendererObj; - private static boolean bossBarVisible = false; - - public void drawDungeonPlayer(String name, int health, boolean isDead, Classes dungeonClass, int x, int y) { - if (!LorenzMod.config.dungeon.hideDeadDungeonPlayers || !isDead) { - GlStateManager.enableBlend(); - Minecraft mc = Minecraft.getMinecraft(); - mc.renderEngine.bindTexture(Textures.texture.dungeon); - - String healthString = isDead ? "DEAD" : Integer.toString(health); - GlStateManager.color(1.0F, 1.0F, 1.0F, (float) LorenzMod.config.dungeon.dungeonPlayerOpacity / 100); - drawTexturedModalRect(x, y, 0, dungeonClass.getTextureY(), 120, 32); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - drawString(font, name, x + 50, y + 6, 0xFFFFFF); - drawString(font, healthString, x + 50, y + font.FONT_HEIGHT + 9, 0xFF2B2B); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - } - } - - public void drawDungeonClock(int width, int offset, Minecraft mc) { - GlStateManager.enableBlend(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.texture.stats); - int dungeonTime = DungeonHandler.getDungeonTime(); - int dungeonTimeMin = dungeonTime / 60; - int dungeonTimeSec = dungeonTime - dungeonTimeMin * 60; - drawTexturedModalRect((width / 2) - 17, offset + (bossBarVisible ? 17 : 0), 0, 0, 34, 34); - mc.renderEngine.bindTexture(Textures.texture.dungeon); - drawTexturedModalRect((width / 2) - 7, offset + (bossBarVisible ? 20 : 3), 16, 50, 3, 8); - drawTexturedModalRect((width / 2) - 7, offset + (bossBarVisible ? 30 : 13), 19, 50, 3, 8); - String dungeonTimeElapsed = (dungeonTimeMin > 9 ? String.valueOf(dungeonTimeMin) : "0" + dungeonTimeMin) + ":" + (dungeonTimeSec > 9 ? String.valueOf(dungeonTimeSec) : "0" + dungeonTimeSec); - drawCenteredString(font, dungeonTimeElapsed, (width / 2), offset + (bossBarVisible ? 40 : 23), 0xFFFF55); - //KEYS - drawString(font, (DungeonHandler.hasBloodkey() ? "\u2714" : "x"), (width / 2), offset + (bossBarVisible ? 19 : 2), (DungeonHandler.hasBloodkey() ? 0x55FF55 : 0xAA0000)); - drawString(font, DungeonHandler.getWitherKeys() + "x", (width / 2), offset + (bossBarVisible ? 30 : 13), 0x555555); - //CLEARED PERCENTAGE - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.texture.stats); - int clearPercent = DungeonHandler.getDungeonCleared(); - String clearPercentage = "Dungeon Cleared: \u00A7" + (clearPercent <= 20 ? "4" : clearPercent <= 50 ? "6" : clearPercent <= 80 ? "e" : "a") + clearPercent + "%"; - drawTexturedModalRect((width / 2) + 17, offset + (bossBarVisible ? 20 : 3), 2, 34, font.getStringWidth(clearPercentage) + 3, 14); - drawTexturedModalRect(((width / 2) + 17) + font.getStringWidth(clearPercentage) + 3, offset + (bossBarVisible ? 20 : 3), 252, 34, 4, 14); - drawString(font, clearPercentage, (width / 2) + 18, offset + (bossBarVisible ? 23 : 6), 0xAAAAAA); - - //DEATHS - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.texture.stats); - int deaths = DungeonHandler.getDeaths(); - String deathText = "Deaths: " + deaths; - drawTexturedModalRect((width / 2) + 17, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(deathText) + 3, 14); - drawTexturedModalRect(((width / 2) + 17) + font.getStringWidth(deathText) + 3, offset + (bossBarVisible ? 35 : 18), 252, 34, 4, 14); - drawString(font, deathText, (width / 2) + 18, offset + (bossBarVisible ? 38 : 21), 0xAAAAAA); - - //SECRETS - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.texture.stats); - int maxSecrets = DungeonHandler.getMaxSecrets(); - int secrets = DungeonHandler.getSecrets(); - int totalSecrets = DungeonHandler.getTotalSecrets(); - String secretsText = "Secrets: " + secrets + "/" + maxSecrets + " (" + totalSecrets + ")"; - drawTexturedModalRect((width / 2) - 17 - (font.getStringWidth(secretsText)) - 4, offset + (bossBarVisible ? 20 : 3), 0, 34, 2, 14); - drawTexturedModalRect(((width / 2) - 17 - (font.getStringWidth(secretsText))) - 2, offset + (bossBarVisible ? 20 : 3), 2, 34, font.getStringWidth(secretsText) + 2, 14); - drawString(font, secretsText, (width / 2) - 17 - (font.getStringWidth(secretsText)), offset + (bossBarVisible ? 23 : 6), 0xAAAAAA); - - //CRYPTS - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.texture.stats); - int crypts = DungeonHandler.getCrypts(); - String cryptText = "Crypts: " + crypts; - drawTexturedModalRect((width / 2) - 17 - (font.getStringWidth(cryptText)) - 4, offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); - drawTexturedModalRect(((width / 2) - 17 - (font.getStringWidth(cryptText))) - 2, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(cryptText) + 2, 14); - drawString(font, cryptText, (width / 2) - 17 - (font.getStringWidth(cryptText)), offset + (bossBarVisible ? 38 : 21), 0xAAAAAA); - } - - public void drawUltimateBar(Minecraft mc, ScaledResolution resolution) { - if (!LorenzMod.config.dungeon.hideUltimateBar) { - float percentage = mc.thePlayer.experience; - SBHConfig.DungeonHud dungeonHud = LorenzMod.config.dungeon; - Position position = dungeonHud.barPosition; - - int x = position.getAbsX(resolution, 182); - int y = position.getAbsY(resolution, 5); - - GenericOverlays.drawLargeBar(mc, x - 91, y, percentage, 0.999f, SpecialColour.specialToChromaRGB(dungeonHud.barLoadColor), SpecialColour.specialToChromaRGB(dungeonHud.barFullColor), dungeonHud.barStyle); - } - } - - @SubscribeEvent - public void renderOverlay(RenderGameOverlayEvent.Post event) { - Minecraft mc = Minecraft.getMinecraft(); - if (Utils.overlayShouldRender(event.type, LorenzMod.hasSkyblockScoreboard(), LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS))) { - bossBarVisible = BossStatus.statusBarTime > 0 && GuiIngameForge.renderBossHealth && BossbarHandler.bossBarRendered; - GlStateManager.enableBlend(); - drawUltimateBar(mc, event.resolution); - - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - if (!LorenzMod.config.dungeon.hideDungeonPlayers) { - int[] hardCodedPos = new int[] { 5, 42, 79, 116 }; - Position[] positions = new Position[] { LorenzMod.config.dungeon.dungeonPlayer1, LorenzMod.config.dungeon.dungeonPlayer2, LorenzMod.config.dungeon.dungeonPlayer3, LorenzMod.config.dungeon.dungeonPlayer4 }; - for (int i = 0; i < Math.min(DungeonHandler.getDungeonPlayers().values().size(), 4); i++) { - DungeonPlayer player = (DungeonPlayer) DungeonHandler.getDungeonPlayers().values().toArray()[i]; - int posX; - int posY; - try { - posX = positions[i].getAbsX(event.resolution, 120); - } catch (ArrayIndexOutOfBoundsException ignored) { - posX = hardCodedPos[i]; - } - try { - posY = positions[i].getAbsY(event.resolution, 120); - } catch (ArrayIndexOutOfBoundsException ignored) { - posY = 0; - } - drawDungeonPlayer(player.getName(), player.getHealth(), player.isDead(), player.getDungeonClass(), posX, posY); - } - } - - if (!LorenzMod.config.main.disaleMainHud) { - drawDungeonClock(event.resolution.getScaledWidth(), LorenzMod.config.main.mainHudPos.getAbsY(event.resolution, 34), mc); - } - } - } -} +//package com.thatgravyboat.skyblockhud.overlay; +// +//import at.lorenz.mod.LorenzMod; +//import com.thatgravyboat.skyblockhud.config.SBHConfig; +//import com.thatgravyboat.skyblockhud.core.config.Position; +//import com.thatgravyboat.skyblockhud.dungeons.Classes; +//import com.thatgravyboat.skyblockhud.dungeons.DungeonHandler; +//import com.thatgravyboat.skyblockhud.dungeons.DungeonPlayer; +//import com.thatgravyboat.skyblockhud.handlers.BossbarHandler; +//import com.thatgravyboat.skyblockhud.location.LocationHandler; +//import com.thatgravyboat.skyblockhud.location.Locations; +//import com.thatgravyboat.skyblockhud.textures.Textures; +//import com.thatgravyboat.skyblockhud.utils.SpecialColour; +//import com.thatgravyboat.skyblockhud.utils.Utils; +//import net.minecraft.client.Minecraft; +//import net.minecraft.client.gui.FontRenderer; +//import net.minecraft.client.gui.Gui; +//import net.minecraft.client.gui.ScaledResolution; +//import net.minecraft.client.renderer.GlStateManager; +//import net.minecraft.entity.boss.BossStatus; +//import net.minecraftforge.client.GuiIngameForge; +//import net.minecraftforge.client.event.RenderGameOverlayEvent; +//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +// +//public class DungeonOverlay extends Gui { +// +// private static final FontRenderer font = Minecraft.getMinecraft().fontRendererObj; +// private static boolean bossBarVisible = false; +// +// public void drawDungeonPlayer(String name, int health, boolean isDead, Classes dungeonClass, int x, int y) { +// if (!LorenzMod.config.dungeon.hideDeadDungeonPlayers || !isDead) { +// GlStateManager.enableBlend(); +// Minecraft mc = Minecraft.getMinecraft(); +// mc.renderEngine.bindTexture(Textures.texture.dungeon); +// +// String healthString = isDead ? "DEAD" : Integer.toString(health); +// GlStateManager.color(1.0F, 1.0F, 1.0F, (float) LorenzMod.config.dungeon.dungeonPlayerOpacity / 100); +// drawTexturedModalRect(x, y, 0, dungeonClass.getTextureY(), 120, 32); +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// drawString(font, name, x + 50, y + 6, 0xFFFFFF); +// drawString(font, healthString, x + 50, y + font.FONT_HEIGHT + 9, 0xFF2B2B); +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// } +// } +// +// public void drawDungeonClock(int width, int offset, Minecraft mc) { +// GlStateManager.enableBlend(); +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// mc.renderEngine.bindTexture(Textures.texture.stats); +// int dungeonTime = DungeonHandler.getDungeonTime(); +// int dungeonTimeMin = dungeonTime / 60; +// int dungeonTimeSec = dungeonTime - dungeonTimeMin * 60; +// drawTexturedModalRect((width / 2) - 17, offset + (bossBarVisible ? 17 : 0), 0, 0, 34, 34); +// mc.renderEngine.bindTexture(Textures.texture.dungeon); +// drawTexturedModalRect((width / 2) - 7, offset + (bossBarVisible ? 20 : 3), 16, 50, 3, 8); +// drawTexturedModalRect((width / 2) - 7, offset + (bossBarVisible ? 30 : 13), 19, 50, 3, 8); +// String dungeonTimeElapsed = (dungeonTimeMin > 9 ? String.valueOf(dungeonTimeMin) : "0" + dungeonTimeMin) + ":" + (dungeonTimeSec > 9 ? String.valueOf(dungeonTimeSec) : "0" + dungeonTimeSec); +// drawCenteredString(font, dungeonTimeElapsed, (width / 2), offset + (bossBarVisible ? 40 : 23), 0xFFFF55); +// //KEYS +// drawString(font, (DungeonHandler.hasBloodkey() ? "\u2714" : "x"), (width / 2), offset + (bossBarVisible ? 19 : 2), (DungeonHandler.hasBloodkey() ? 0x55FF55 : 0xAA0000)); +// drawString(font, DungeonHandler.getWitherKeys() + "x", (width / 2), offset + (bossBarVisible ? 30 : 13), 0x555555); +// //CLEARED PERCENTAGE +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// mc.renderEngine.bindTexture(Textures.texture.stats); +// int clearPercent = DungeonHandler.getDungeonCleared(); +// String clearPercentage = "Dungeon Cleared: \u00A7" + (clearPercent <= 20 ? "4" : clearPercent <= 50 ? "6" : clearPercent <= 80 ? "e" : "a") + clearPercent + "%"; +// drawTexturedModalRect((width / 2) + 17, offset + (bossBarVisible ? 20 : 3), 2, 34, font.getStringWidth(clearPercentage) + 3, 14); +// drawTexturedModalRect(((width / 2) + 17) + font.getStringWidth(clearPercentage) + 3, offset + (bossBarVisible ? 20 : 3), 252, 34, 4, 14); +// drawString(font, clearPercentage, (width / 2) + 18, offset + (bossBarVisible ? 23 : 6), 0xAAAAAA); +// +// //DEATHS +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// mc.renderEngine.bindTexture(Textures.texture.stats); +// int deaths = DungeonHandler.getDeaths(); +// String deathText = "Deaths: " + deaths; +// drawTexturedModalRect((width / 2) + 17, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(deathText) + 3, 14); +// drawTexturedModalRect(((width / 2) + 17) + font.getStringWidth(deathText) + 3, offset + (bossBarVisible ? 35 : 18), 252, 34, 4, 14); +// drawString(font, deathText, (width / 2) + 18, offset + (bossBarVisible ? 38 : 21), 0xAAAAAA); +// +// //SECRETS +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// mc.renderEngine.bindTexture(Textures.texture.stats); +// int maxSecrets = DungeonHandler.getMaxSecrets(); +// int secrets = DungeonHandler.getSecrets(); +// int totalSecrets = DungeonHandler.getTotalSecrets(); +// String secretsText = "Secrets: " + secrets + "/" + maxSecrets + " (" + totalSecrets + ")"; +// drawTexturedModalRect((width / 2) - 17 - (font.getStringWidth(secretsText)) - 4, offset + (bossBarVisible ? 20 : 3), 0, 34, 2, 14); +// drawTexturedModalRect(((width / 2) - 17 - (font.getStringWidth(secretsText))) - 2, offset + (bossBarVisible ? 20 : 3), 2, 34, font.getStringWidth(secretsText) + 2, 14); +// drawString(font, secretsText, (width / 2) - 17 - (font.getStringWidth(secretsText)), offset + (bossBarVisible ? 23 : 6), 0xAAAAAA); +// +// //CRYPTS +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// mc.renderEngine.bindTexture(Textures.texture.stats); +// int crypts = DungeonHandler.getCrypts(); +// String cryptText = "Crypts: " + crypts; +// drawTexturedModalRect((width / 2) - 17 - (font.getStringWidth(cryptText)) - 4, offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); +// drawTexturedModalRect(((width / 2) - 17 - (font.getStringWidth(cryptText))) - 2, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(cryptText) + 2, 14); +// drawString(font, cryptText, (width / 2) - 17 - (font.getStringWidth(cryptText)), offset + (bossBarVisible ? 38 : 21), 0xAAAAAA); +// } +// +// public void drawUltimateBar(Minecraft mc, ScaledResolution resolution) { +// if (!LorenzMod.config.dungeon.hideUltimateBar) { +// float percentage = mc.thePlayer.experience; +// SBHConfig.DungeonHud dungeonHud = LorenzMod.config.dungeon; +// Position position = dungeonHud.barPosition; +// +// int x = position.getAbsX(resolution, 182); +// int y = position.getAbsY(resolution, 5); +// +// GenericOverlays.drawLargeBar(mc, x - 91, y, percentage, 0.999f, SpecialColour.specialToChromaRGB(dungeonHud.barLoadColor), SpecialColour.specialToChromaRGB(dungeonHud.barFullColor), dungeonHud.barStyle); +// } +// } +// +// @SubscribeEvent +// public void renderOverlay(RenderGameOverlayEvent.Post event) { +// Minecraft mc = Minecraft.getMinecraft(); +// if (Utils.overlayShouldRender(event.type, LorenzMod.hasSkyblockScoreboard(), LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS))) { +// bossBarVisible = BossStatus.statusBarTime > 0 && GuiIngameForge.renderBossHealth && BossbarHandler.bossBarRendered; +// GlStateManager.enableBlend(); +// drawUltimateBar(mc, event.resolution); +// +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// if (!LorenzMod.config.dungeon.hideDungeonPlayers) { +// int[] hardCodedPos = new int[] { 5, 42, 79, 116 }; +// Position[] positions = new Position[] { LorenzMod.config.dungeon.dungeonPlayer1, LorenzMod.config.dungeon.dungeonPlayer2, LorenzMod.config.dungeon.dungeonPlayer3, LorenzMod.config.dungeon.dungeonPlayer4 }; +// for (int i = 0; i < Math.min(DungeonHandler.getDungeonPlayers().values().size(), 4); i++) { +// DungeonPlayer player = (DungeonPlayer) DungeonHandler.getDungeonPlayers().values().toArray()[i]; +// int posX; +// int posY; +// try { +// posX = positions[i].getAbsX(event.resolution, 120); +// } catch (ArrayIndexOutOfBoundsException ignored) { +// posX = hardCodedPos[i]; +// } +// try { +// posY = positions[i].getAbsY(event.resolution, 120); +// } catch (ArrayIndexOutOfBoundsException ignored) { +// posY = 0; +// } +// drawDungeonPlayer(player.getName(), player.getHealth(), player.isDead(), player.getDungeonClass(), posX, posY); +// } +// } +// +// if (!LorenzMod.config.main.disaleMainHud) { +// drawDungeonClock(event.resolution.getScaledWidth(), LorenzMod.config.main.mainHudPos.getAbsY(event.resolution, 34), mc); +// } +// } +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/GenericOverlays.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/GenericOverlays.java index 4986e2fb0..db773024a 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/GenericOverlays.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/GenericOverlays.java @@ -1,42 +1,42 @@ -package com.thatgravyboat.skyblockhud.overlay; - -import at.lorenz.mod.LorenzMod; -import com.thatgravyboat.skyblockhud.core.util.render.RenderUtils; -import com.thatgravyboat.skyblockhud.textures.Textures; -import java.awt.*; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.GlStateManager; - -public class GenericOverlays extends Gui { - - public static void drawLargeBar(Minecraft mc, int x, int y, float percentage, float max, int fullColor, int loadingColor, int barStyle) { - if (LorenzMod.hasSkyblockScoreboard()) { - mc.renderEngine.bindTexture(Textures.texture.bars); - Color color = new Color(percentage == max ? fullColor : loadingColor); - - RenderUtils.drawTexturedModalRect(x, y, 0, 0, 182, 5); - GlStateManager.color(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f); - RenderUtils.drawTexturedModalRect(x, y, 0, 30, 182, 5); - RenderUtils.drawTexturedModalRect(x, y, 0, 5, (int) (182 * percentage), 5); - if (barStyle != 0) { - RenderUtils.drawTexturedModalRect(x, y, 0, 5 + (barStyle * 5), 182, 5); - } - } - } - - public static void drawSmallBar(Minecraft mc, int x, int y, double percentage, double max, int fullColor, int loadingColor, int barStyle) { - if (LorenzMod.hasSkyblockScoreboard()) { - mc.renderEngine.bindTexture(Textures.texture.bars); - Color color = new Color(percentage == max ? fullColor : loadingColor); - GlStateManager.enableBlend(); - RenderUtils.drawTexturedModalRect(x, y, 0, 35, 62, 5); - GlStateManager.color(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f); - RenderUtils.drawTexturedModalRect(x, y, 0, 65, 62, 5); - RenderUtils.drawTexturedModalRect(x, y, 0, 40, (int) (62 * percentage), 5); - if (barStyle != 0) { - RenderUtils.drawTexturedModalRect(x, y, 0, 45 + (barStyle * 5), 62, 5); - } - } - } -} +//package com.thatgravyboat.skyblockhud.overlay; +// +//import at.lorenz.mod.LorenzMod; +//import com.thatgravyboat.skyblockhud.core.util.render.RenderUtils; +//import com.thatgravyboat.skyblockhud.textures.Textures; +//import java.awt.*; +//import net.minecraft.client.Minecraft; +//import net.minecraft.client.gui.Gui; +//import net.minecraft.client.renderer.GlStateManager; +// +//public class GenericOverlays extends Gui { +// +// public static void drawLargeBar(Minecraft mc, int x, int y, float percentage, float max, int fullColor, int loadingColor, int barStyle) { +// if (LorenzMod.hasSkyblockScoreboard()) { +// mc.renderEngine.bindTexture(Textures.texture.bars); +// Color color = new Color(percentage == max ? fullColor : loadingColor); +// +// RenderUtils.drawTexturedModalRect(x, y, 0, 0, 182, 5); +// GlStateManager.color(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f); +// RenderUtils.drawTexturedModalRect(x, y, 0, 30, 182, 5); +// RenderUtils.drawTexturedModalRect(x, y, 0, 5, (int) (182 * percentage), 5); +// if (barStyle != 0) { +// RenderUtils.drawTexturedModalRect(x, y, 0, 5 + (barStyle * 5), 182, 5); +// } +// } +// } +// +// public static void drawSmallBar(Minecraft mc, int x, int y, double percentage, double max, int fullColor, int loadingColor, int barStyle) { +// if (LorenzMod.hasSkyblockScoreboard()) { +// mc.renderEngine.bindTexture(Textures.texture.bars); +// Color color = new Color(percentage == max ? fullColor : loadingColor); +// GlStateManager.enableBlend(); +// RenderUtils.drawTexturedModalRect(x, y, 0, 35, 62, 5); +// GlStateManager.color(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f); +// RenderUtils.drawTexturedModalRect(x, y, 0, 65, 62, 5); +// RenderUtils.drawTexturedModalRect(x, y, 0, 40, (int) (62 * percentage), 5); +// if (barStyle != 0) { +// RenderUtils.drawTexturedModalRect(x, y, 0, 45 + (barStyle * 5), 62, 5); +// } +// } +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/MiningHud.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/MiningHud.java index 1154f4a25..65e4f7eb1 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/MiningHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/MiningHud.java @@ -1,76 +1,76 @@ -package com.thatgravyboat.skyblockhud.overlay; - -import at.lorenz.mod.LorenzMod; -import com.thatgravyboat.skyblockhud.core.config.Position; -import com.thatgravyboat.skyblockhud.textures.Textures; -import com.thatgravyboat.skyblockhud.utils.Utils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraftforge.client.event.RenderGameOverlayEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class MiningHud extends Gui { - - private static int fuel, maxFuel; - private static int heat; - - public static void setFuel(int fuel, int maxFuel) { - MiningHud.fuel = fuel; - MiningHud.maxFuel = maxFuel; - } - - public static void setHeat(int heat) { - MiningHud.heat = heat; - } - - public static int getHeat() { - return heat; - } - - @SubscribeEvent - public void renderOverlay(RenderGameOverlayEvent.Post event) { - if (Utils.overlayShouldRender(event.type, LorenzMod.hasSkyblockScoreboard(), LorenzMod.config.mining.showDrillBar || LorenzMod.config.mining.showHeatBar)) { - Minecraft mc = Minecraft.getMinecraft(); - - if (LorenzMod.config.mining.barMode == 1) { - if (heat > 0 && Utils.isDrill(mc.thePlayer.getHeldItem()) && LorenzMod.config.mining.showDrillBar && LorenzMod.config.mining.showHeatBar) { - renderFuelBar(mc, (event.resolution.getScaledWidth() / 2) - 91, event.resolution.getScaledHeight() - 31); - renderHeatBar(mc, (event.resolution.getScaledWidth() / 2) + 46, event.resolution.getScaledHeight() - 31); - } else if (Utils.isDrill(mc.thePlayer.getHeldItem()) && LorenzMod.config.mining.showDrillBar) { - renderFuelBar(mc, (event.resolution.getScaledWidth() / 2) - 68, event.resolution.getScaledHeight() - 31); - } else if (heat > 0 && LorenzMod.config.mining.showHeatBar) { - renderHeatBar(mc, (event.resolution.getScaledWidth() / 2) - 22, event.resolution.getScaledHeight() - 31); - } - } else if (LorenzMod.config.mining.barMode == 0) { - if (heat > 0 && LorenzMod.config.mining.showHeatBar) { - Position position = LorenzMod.config.mining.heatBar; - renderHeatBar(mc, position.getAbsX(event.resolution, 45), position.getAbsY(event.resolution, 7)); - } - if (Utils.isDrill(mc.thePlayer.getHeldItem()) && LorenzMod.config.mining.showDrillBar) { - Position position = LorenzMod.config.mining.drillBar; - renderFuelBar(mc, position.getAbsX(event.resolution, 136), position.getAbsY(event.resolution, 7)); - } - } - } - } - - private void renderFuelBar(Minecraft mc, int x, int y) { - if (maxFuel == 0) return; - GlStateManager.enableBlend(); - GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); - mc.renderEngine.bindTexture(Textures.texture.mines); - drawTexturedModalRect(x, y, 0, 0, 136, 7); - drawTexturedModalRect(x, y, 0, 7, Utils.lerp((float) fuel / (float) maxFuel, 0, 136), 7); - String percentageText = Math.round(((float) fuel / (float) maxFuel) * 100) + "%"; - this.drawCenteredString(mc.fontRendererObj, percentageText, x + 68, y - 2, 0xffffff); - } - - private void renderHeatBar(Minecraft mc, int x, int y) { - GlStateManager.enableBlend(); - GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); - mc.renderEngine.bindTexture(Textures.texture.mines); - drawTexturedModalRect(x, y, 137, 0, 45, 7); - drawTexturedModalRect(x, y, 137, 7, Utils.lerp(heat / 100f, 0, 45), 7); - } -} +//package com.thatgravyboat.skyblockhud.overlay; +// +//import at.lorenz.mod.LorenzMod; +//import com.thatgravyboat.skyblockhud.core.config.Position; +//import com.thatgravyboat.skyblockhud.textures.Textures; +//import com.thatgravyboat.skyblockhud.utils.Utils; +//import net.minecraft.client.Minecraft; +//import net.minecraft.client.gui.Gui; +//import net.minecraft.client.renderer.GlStateManager; +//import net.minecraftforge.client.event.RenderGameOverlayEvent; +//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +// +//public class MiningHud extends Gui { +// +// private static int fuel, maxFuel; +// private static int heat; +// +// public static void setFuel(int fuel, int maxFuel) { +// MiningHud.fuel = fuel; +// MiningHud.maxFuel = maxFuel; +// } +// +// public static void setHeat(int heat) { +// MiningHud.heat = heat; +// } +// +// public static int getHeat() { +// return heat; +// } +// +// @SubscribeEvent +// public void renderOverlay(RenderGameOverlayEvent.Post event) { +// if (Utils.overlayShouldRender(event.type, LorenzMod.hasSkyblockScoreboard(), LorenzMod.config.mining.showDrillBar || LorenzMod.config.mining.showHeatBar)) { +// Minecraft mc = Minecraft.getMinecraft(); +// +// if (LorenzMod.config.mining.barMode == 1) { +// if (heat > 0 && Utils.isDrill(mc.thePlayer.getHeldItem()) && LorenzMod.config.mining.showDrillBar && LorenzMod.config.mining.showHeatBar) { +// renderFuelBar(mc, (event.resolution.getScaledWidth() / 2) - 91, event.resolution.getScaledHeight() - 31); +// renderHeatBar(mc, (event.resolution.getScaledWidth() / 2) + 46, event.resolution.getScaledHeight() - 31); +// } else if (Utils.isDrill(mc.thePlayer.getHeldItem()) && LorenzMod.config.mining.showDrillBar) { +// renderFuelBar(mc, (event.resolution.getScaledWidth() / 2) - 68, event.resolution.getScaledHeight() - 31); +// } else if (heat > 0 && LorenzMod.config.mining.showHeatBar) { +// renderHeatBar(mc, (event.resolution.getScaledWidth() / 2) - 22, event.resolution.getScaledHeight() - 31); +// } +// } else if (LorenzMod.config.mining.barMode == 0) { +// if (heat > 0 && LorenzMod.config.mining.showHeatBar) { +// Position position = LorenzMod.config.mining.heatBar; +// renderHeatBar(mc, position.getAbsX(event.resolution, 45), position.getAbsY(event.resolution, 7)); +// } +// if (Utils.isDrill(mc.thePlayer.getHeldItem()) && LorenzMod.config.mining.showDrillBar) { +// Position position = LorenzMod.config.mining.drillBar; +// renderFuelBar(mc, position.getAbsX(event.resolution, 136), position.getAbsY(event.resolution, 7)); +// } +// } +// } +// } +// +// private void renderFuelBar(Minecraft mc, int x, int y) { +// if (maxFuel == 0) return; +// GlStateManager.enableBlend(); +// GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); +// mc.renderEngine.bindTexture(Textures.texture.mines); +// drawTexturedModalRect(x, y, 0, 0, 136, 7); +// drawTexturedModalRect(x, y, 0, 7, Utils.lerp((float) fuel / (float) maxFuel, 0, 136), 7); +// String percentageText = Math.round(((float) fuel / (float) maxFuel) * 100) + "%"; +// this.drawCenteredString(mc.fontRendererObj, percentageText, x + 68, y - 2, 0xffffff); +// } +// +// private void renderHeatBar(Minecraft mc, int x, int y) { +// GlStateManager.enableBlend(); +// GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); +// mc.renderEngine.bindTexture(Textures.texture.mines); +// drawTexturedModalRect(x, y, 137, 0, 45, 7); +// drawTexturedModalRect(x, y, 137, 7, Utils.lerp(heat / 100f, 0, 45), 7); +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java index cd8849cab..f815afaa7 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java @@ -1,331 +1,331 @@ -package com.thatgravyboat.skyblockhud.overlay; - -import at.lorenz.mod.LorenzMod; -import com.thatgravyboat.skyblockhud.handlers.BossbarHandler; -import com.thatgravyboat.skyblockhud.handlers.CurrencyHandler; -import com.thatgravyboat.skyblockhud.handlers.SlayerHandler; -import com.thatgravyboat.skyblockhud.handlers.TimeHandler; -import com.thatgravyboat.skyblockhud.location.*; -import com.thatgravyboat.skyblockhud.seasons.Season; -import com.thatgravyboat.skyblockhud.seasons.SeasonDateHandler; -import com.thatgravyboat.skyblockhud.textures.Textures; -import com.thatgravyboat.skyblockhud.utils.Utils; -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; -import java.util.Locale; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.boss.BossStatus; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.client.GuiIngameForge; -import net.minecraftforge.client.event.RenderGameOverlayEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class OverlayHud extends Gui { - - private static final FontRenderer font = Minecraft.getMinecraft().fontRendererObj; - - //STATS - private static boolean eventToggle; - - public static boolean bossBarVisible = false; - - public void drawClock(int width, int offset, Minecraft mc) { - GlStateManager.enableBlend(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.texture.stats); - //CLOCK - int timeMin = (int) (TimeHandler.time / 60); - int timeHour = timeMin / 60; - timeMin = timeMin - (timeHour * 60); - String militaryTime = timeHour + ":" + (timeMin == 0 ? timeMin + "0" : timeMin); - int time12Hour = timeHour >= 12 ? timeHour - 12 : timeHour; - String normalTime = (time12Hour == 0 ? "12" : String.valueOf(time12Hour)) + ":" + (timeMin == 0 ? "00" : timeMin) + (timeHour >= 12 ? "pm" : "am"); - - drawTexturedModalRect((width / 2) - 17, offset + (bossBarVisible ? 17 : 0), 0, 0, 34, 34); - drawTexturedModalRect((width / 2) - 4, offset + (bossBarVisible ? 24 : 7), (timeHour > 19 || timeHour < 6) ? 43 : 43 + 8, 0, 8, 8); - if (LorenzMod.config.main.twelveHourClock) drawScaledString(0.8f, width / 2, offset + (bossBarVisible ? 38 : 21), normalTime, (timeHour > 19 || timeHour < 6) ? 0xAFB8CC : 0xFFFF55); else drawCenteredString(font, militaryTime, (width / 2), offset + (bossBarVisible ? 38 : 21), (timeHour > 19 || timeHour < 4) ? 0xAFB8CC : 0xFFFF55); - - //PURSE - drawPurseAndBits(width, offset, mc); - - //SEASON/DATE - drawSeasonAndDate(width, offset, mc); - - //REDSTONE PERCENT - drawRedstone(width, offset, mc); - - // LOCATION - drawLocation(width, offset, mc); - - //EXTRA SLOT - if (LocationHandler.getCurrentLocation().equals(Locations.YOURISLAND)) { - if (IslandHandler.flightTime > 0) drawFlightDuration(width, offset, mc); - } else if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.MUSHROOMDESERT)) { - drawTrapperOrPelts(width, offset, mc); - } else if (LocationHandler.getCurrentLocation().getCategory().isMiningCategory()) { - if (MinesHandler.currentEvent.display) { - drawDwarvenEvent(width, offset, mc); - } else { - drawMiningPowders(width, offset, mc); - } - } else if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.PARK) && ParkIslandHandler.isRaining()) { - if (LocationHandler.getCurrentLocation().equals(Locations.HOWLINGCAVE)) { - drawSlayer(width, offset, mc); - } else drawRainDuration(width, offset, mc); - } else if (LocationHandler.getCurrentLocation().equals(Locations.FARMHOUSE)) { - drawFarmHouseMedals(width, offset, mc); - } else if (SlayerHandler.isDoingSlayer) { - drawSlayer(width, offset, mc); - } - } - - public void drawSeasonAndDate(int width, int offset, Minecraft mc) { - if (SeasonDateHandler.getCurrentSeason() != Season.ERROR) { - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - if (mc.thePlayer.ticksExisted % 100 == 0 && eventToggle) eventToggle = false; - if (mc.thePlayer.ticksExisted % 600 == 0) eventToggle = true; - mc.renderEngine.bindTexture(Textures.texture.stats); - String dateText = SeasonDateHandler.getFancySeasonAndDate(); - if (eventToggle && !SeasonDateHandler.getCurrentEvent().isEmpty() && !SeasonDateHandler.getCurrentEventTime().isEmpty()) dateText = SeasonDateHandler.getCurrentEvent().trim() + " " + SeasonDateHandler.getCurrentEventTime().trim(); - drawTexturedModalRect((width / 2) + 17, offset + (bossBarVisible ? 20 : 3), 2, 34, font.getStringWidth(dateText) + 9, 14); - drawTexturedModalRect(((width / 2) + 17) + font.getStringWidth(dateText) + 9, offset + (bossBarVisible ? 20 : 3), 252, 34, 4, 14); - drawTexturedModalRect(((width / 2) + 17) + font.getStringWidth(dateText) + 2, offset + (bossBarVisible ? 23 : 6), SeasonDateHandler.getCurrentSeason().getTextureX(), 16, 8, 8); - drawString(font, dateText, (width / 2) + 18, offset + (bossBarVisible ? 23 : 6), 0xffffff); - } - } - - public void drawLocation(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) - 33 - (font.getStringWidth(LocationHandler.getCurrentLocation().getDisplayName())), offset + (bossBarVisible ? 20 : 3), 0, 34, 2, 14); - drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(LocationHandler.getCurrentLocation().getDisplayName()))) + 2, offset + (bossBarVisible ? 20 : 3), 2, 34, font.getStringWidth(LocationHandler.getCurrentLocation().getDisplayName()) + 14, 14); - drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(LocationHandler.getCurrentLocation().getDisplayName()))) + 4, offset + (bossBarVisible ? 23 : 6), LocationHandler.getCurrentLocation().getCategory().getTexturePos(), 8, 8, 8); - drawString(font, LocationHandler.getCurrentLocation().getDisplayName(), (width / 2) - 19 - (font.getStringWidth(LocationHandler.getCurrentLocation().getDisplayName())), offset + (bossBarVisible ? 23 : 6), 0xFFFFFF); - } - - public void drawRedstone(int width, int offset, Minecraft mc) { - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.texture.stats); - int redstoneColor = IslandHandler.redstone > 90 ? 0xFF0000 : IslandHandler.redstone > 75 ? 0xC45B00 : IslandHandler.redstone > 50 ? 0xFFFF55 : 0x55FF55; - if (IslandHandler.redstone > 0 && Utils.isPlayerHoldingRedstone(mc.thePlayer)) { - drawTexturedModalRect((width / 2) - 15, offset + (bossBarVisible ? 51 : 34), 0, 48, 30, 18); - drawTexturedModalRect((width / 2) - 4, offset + (bossBarVisible ? 51 : 34), 59, 0, 8, 8); - drawCenteredString(mc.fontRendererObj, IslandHandler.redstone + "%", (width / 2), offset + (bossBarVisible ? 58 : 41), redstoneColor); - } - } - - public void drawPurseAndBits(int width, int offset, Minecraft mc) { - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.texture.stats); - int xPos = (width / 2) + 17; - - //COINS - drawTexturedModalRect(xPos, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(CurrencyHandler.getCoinsFormatted()) + 11, 14); - drawTexturedModalRect(xPos + 1, offset + (bossBarVisible ? 37 : 20), 34, 0, 8, 8); - drawString(font, CurrencyHandler.getCoinsFormatted(), xPos + 10, offset + (bossBarVisible ? 38 : 21), 0xFFAA00); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.texture.stats); - xPos += font.getStringWidth(CurrencyHandler.getCoinsFormatted()) + 11; - - //BITS - if (CurrencyHandler.getBits() > 0) { - drawTexturedModalRect(xPos, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(CurrencyHandler.getBitsFormatted()) + 11, 14); - drawTexturedModalRect(xPos + 1, offset + (bossBarVisible ? 37 : 20), 75, 0, 8, 8); - drawString(font, CurrencyHandler.getBitsFormatted(), xPos + 10, offset + (bossBarVisible ? 38 : 21), 0x55FFFF); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.texture.stats); - xPos += font.getStringWidth(CurrencyHandler.getBitsFormatted()) + 11; - } - - drawTexturedModalRect(xPos, offset + (bossBarVisible ? 35 : 18), 252, 34, 4, 14); - } - - public void drawFlightDuration(int width, int offset, Minecraft mc) { - if (LocationHandler.getCurrentLocation().equals(Locations.YOURISLAND)) { - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - DecimalFormat flightFormat = new DecimalFormat("#.#", DecimalFormatSymbols.getInstance(Locale.CANADA)); - String duration; - if (IslandHandler.flightTime < 60) duration = IslandHandler.flightTime + "s"; else if (IslandHandler.flightTime < 3600) duration = flightFormat.format((double) IslandHandler.flightTime / 60) + "m"; else if (IslandHandler.flightTime < 86400) duration = flightFormat.format((double) IslandHandler.flightTime / 3600) + "hr"; else if (IslandHandler.flightTime < 86460) duration = flightFormat.format((double) IslandHandler.flightTime / 86400) + "day"; else duration = flightFormat.format((double) IslandHandler.flightTime / 86400) + "days"; - mc.renderEngine.bindTexture(Textures.texture.stats); - 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), 67, 0, 8, 8); - drawString(font, duration, (width / 2) - 19 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF); - } - } - - public void drawRainDuration(int width, int offset, Minecraft mc) { - if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.PARK)) { - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.texture.stats); - String duration = "Rain: " + ParkIslandHandler.getRainTime(); - 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), 83, 0, 8, 8); - drawString(font, duration, (width / 2) - 19 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF); - } - } - - public void drawSlayer(int width, int offset, Minecraft mc) { - if (SlayerHandler.isDoingSlayer) { - int kills = SlayerHandler.progress; - int maxKills = SlayerHandler.maxKills; - int tier = SlayerHandler.slayerTier; - SlayerHandler.slayerTypes slayerType = SlayerHandler.currentSlayer; - if (slayerType != SlayerHandler.slayerTypes.NONE) { - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.texture.stats); - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(EnumChatFormatting.GREEN); - stringBuilder.append(Utils.intToRomanNumeral(tier)); - stringBuilder.append(" "); - if (SlayerHandler.isKillingBoss) { - stringBuilder.append(EnumChatFormatting.RED); - stringBuilder.append("Slay Boss!"); - } else if (SlayerHandler.bossSlain) { - stringBuilder.append(EnumChatFormatting.RED); - stringBuilder.append("Boss Slain!"); - } else if (kills == 0 && maxKills == 0) { - stringBuilder.append(EnumChatFormatting.RED); - stringBuilder.append("Not Slaying!"); - } else { - stringBuilder.append(EnumChatFormatting.YELLOW); - stringBuilder.append(kills); - stringBuilder.append(EnumChatFormatting.GRAY); - stringBuilder.append("/"); - stringBuilder.append(EnumChatFormatting.RED); - stringBuilder.append(maxKills); - } - String text = stringBuilder.toString(); - 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), slayerType.getX(), 24, 8, 8); - drawString(font, text, (width / 2) - 19 - (font.getStringWidth(text)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF); - } - } - } - - public void drawMiningPowders(int width, int offset, Minecraft mc) { - if (MinesHandler.gemstone == 0) { - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.texture.stats); - String mithril = MinesHandler.getMithrilFormatted(); - drawTexturedModalRect((width / 2) - 33 - (font.getStringWidth(mithril)), offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); - drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(mithril))) + 2, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(mithril) + 14, 14); - drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(mithril))) + 4, offset + (bossBarVisible ? 38 : 21), 91, 0, 8, 8); - drawString(font, mithril, (width / 2) - 19 - (font.getStringWidth(mithril)), offset + (bossBarVisible ? 38 : 21), 0x00C896); - } else { - LocationCategory locationCategory = LocationHandler.getCurrentLocation().getCategory(); - String mithril = locationCategory == LocationCategory.DWARVENMINES ? MinesHandler.getMithrilFormatted() : MinesHandler.getMithrilShortFormatted(); - String gemstone = locationCategory == LocationCategory.CRYSTALHOLLOWS ? MinesHandler.getGemstoneFormatted() : MinesHandler.getGemstoneShortFormatted(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.texture.stats); - - int edge = (width / 2) - 33; - - int barWidth = font.getStringWidth(mithril) + 12 + font.getStringWidth(gemstone); - - int firstText = locationCategory == LocationCategory.DWARVENMINES ? font.getStringWidth(mithril) : font.getStringWidth(gemstone); - - //Bar - drawTexturedModalRect(edge - barWidth, offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); - drawTexturedModalRect(edge - barWidth + 2, offset + (bossBarVisible ? 35 : 18), 2, 34, barWidth + 14, 14); - - //Icons - drawTexturedModalRect(edge - barWidth + 4, offset + (bossBarVisible ? 38 : 21), locationCategory == LocationCategory.DWARVENMINES ? 91 : 131, 0, 8, 8); - drawTexturedModalRect(edge - barWidth + 16 + firstText, offset + (bossBarVisible ? 38 : 21), locationCategory == LocationCategory.DWARVENMINES ? 131 : 91, 0, 8, 8); - - drawString(font, locationCategory == LocationCategory.DWARVENMINES ? mithril : gemstone, edge - barWidth + 14, offset + (bossBarVisible ? 38 : 21), locationCategory == LocationCategory.DWARVENMINES ? 0x00C896 : 0xFF55FF); - drawString(font, locationCategory == LocationCategory.DWARVENMINES ? gemstone : mithril, edge - barWidth + 26 + firstText, offset + (bossBarVisible ? 38 : 21), locationCategory == LocationCategory.DWARVENMINES ? 0xFF55FF : 0x00C896); - } - } - - public void drawTrapperOrPelts(int width, int offset, Minecraft mc) { - if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.MUSHROOMDESERT)) { - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.texture.stats); - String duration = FarmingIslandHandler.location != Locations.NONE ? FarmingIslandHandler.location.getDisplayName() : "" + FarmingIslandHandler.pelts; - 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), FarmingIslandHandler.location != Locations.NONE ? 123 : 115, 0, 8, 8); - drawString(font, duration, (width / 2) - 19 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF); - } - } - - public void drawDwarvenEvent(int width, int offset, Minecraft mc) { - 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)); - int silver = font.getStringWidth(FarmHouseHandler.getFormattedMedals(FarmHouseHandler.Medal.SILVER)); - int gold = font.getStringWidth(FarmHouseHandler.getFormattedMedals(FarmHouseHandler.Medal.GOLD)); - - int end = drawLeftBottomBar(width, offset, 40 + bronze + silver + gold, mc); - drawTexturedModalRect(end + 2, offset + (bossBarVisible ? 38 : 21), 139, 0, 8, 8); - drawTexturedModalRect(end + 14 + gold, offset + (bossBarVisible ? 38 : 21), 147, 0, 8, 8); - drawTexturedModalRect(end + 26 + gold + silver, offset + (bossBarVisible ? 38 : 21), 155, 0, 8, 8); - - drawString(font, FarmHouseHandler.getFormattedMedals(FarmHouseHandler.Medal.GOLD), end + 12, offset + (bossBarVisible ? 38 : 21), 0xffffff); - drawString(font, FarmHouseHandler.getFormattedMedals(FarmHouseHandler.Medal.SILVER), end + gold + 24, offset + (bossBarVisible ? 38 : 21), 0xffffff); - drawString(font, FarmHouseHandler.getFormattedMedals(FarmHouseHandler.Medal.BRONZE), end + gold + silver + 36, offset + (bossBarVisible ? 38 : 21), 0xffffff); - } - } - - @SubscribeEvent - public void renderOverlay(RenderGameOverlayEvent.Post event) { - if (Utils.overlayShouldRender(event.type, LorenzMod.hasSkyblockScoreboard())) { - 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 && !LorenzMod.config.main.disaleMainHud) { - drawClock(event.resolution.getScaledWidth(), LorenzMod.config.main.mainHudPos.getAbsY(event.resolution, 34), mc); - } - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - } - } - - public void drawScaledString(float factor, int x, int y, String text, int color) { - GlStateManager.scale(factor, factor, 1); - drawCenteredString(font, text, (int) (x / factor), (int) (y / factor), color); - GlStateManager.scale(1 / factor, 1 / factor, 1); - } - - public int drawLeftBottomBar(int width, int offset, int barWidth, Minecraft mc) { - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(Textures.texture.stats); - int edge = (width / 2) - 17; - - drawTexturedModalRect(edge - barWidth, offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); - drawTexturedModalRect(edge - barWidth + 2, offset + (bossBarVisible ? 35 : 18), 2, 34, barWidth - 2, 14); - return edge - barWidth + 2; - } -} +//package com.thatgravyboat.skyblockhud.overlay; +// +//import at.lorenz.mod.LorenzMod; +//import com.thatgravyboat.skyblockhud.handlers.BossbarHandler; +//import com.thatgravyboat.skyblockhud.handlers.CurrencyHandler; +//import com.thatgravyboat.skyblockhud.handlers.SlayerHandler; +//import com.thatgravyboat.skyblockhud.handlers.TimeHandler; +//import com.thatgravyboat.skyblockhud.location.*; +//import com.thatgravyboat.skyblockhud.seasons.Season; +//import com.thatgravyboat.skyblockhud.seasons.SeasonDateHandler; +//import com.thatgravyboat.skyblockhud.textures.Textures; +//import com.thatgravyboat.skyblockhud.utils.Utils; +//import java.text.DecimalFormat; +//import java.text.DecimalFormatSymbols; +//import java.util.Locale; +//import net.minecraft.client.Minecraft; +//import net.minecraft.client.gui.FontRenderer; +//import net.minecraft.client.gui.Gui; +//import net.minecraft.client.renderer.GlStateManager; +//import net.minecraft.entity.boss.BossStatus; +//import net.minecraft.util.EnumChatFormatting; +//import net.minecraftforge.client.GuiIngameForge; +//import net.minecraftforge.client.event.RenderGameOverlayEvent; +//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +// +//public class OverlayHud extends Gui { +// +// private static final FontRenderer font = Minecraft.getMinecraft().fontRendererObj; +// +// //STATS +// private static boolean eventToggle; +// +// public static boolean bossBarVisible = false; +// +// public void drawClock(int width, int offset, Minecraft mc) { +// GlStateManager.enableBlend(); +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// mc.renderEngine.bindTexture(Textures.texture.stats); +// //CLOCK +// int timeMin = (int) (TimeHandler.time / 60); +// int timeHour = timeMin / 60; +// timeMin = timeMin - (timeHour * 60); +// String militaryTime = timeHour + ":" + (timeMin == 0 ? timeMin + "0" : timeMin); +// int time12Hour = timeHour >= 12 ? timeHour - 12 : timeHour; +// String normalTime = (time12Hour == 0 ? "12" : String.valueOf(time12Hour)) + ":" + (timeMin == 0 ? "00" : timeMin) + (timeHour >= 12 ? "pm" : "am"); +// +// drawTexturedModalRect((width / 2) - 17, offset + (bossBarVisible ? 17 : 0), 0, 0, 34, 34); +// drawTexturedModalRect((width / 2) - 4, offset + (bossBarVisible ? 24 : 7), (timeHour > 19 || timeHour < 6) ? 43 : 43 + 8, 0, 8, 8); +// if (LorenzMod.config.main.twelveHourClock) drawScaledString(0.8f, width / 2, offset + (bossBarVisible ? 38 : 21), normalTime, (timeHour > 19 || timeHour < 6) ? 0xAFB8CC : 0xFFFF55); else drawCenteredString(font, militaryTime, (width / 2), offset + (bossBarVisible ? 38 : 21), (timeHour > 19 || timeHour < 4) ? 0xAFB8CC : 0xFFFF55); +// +// //PURSE +// drawPurseAndBits(width, offset, mc); +// +// //SEASON/DATE +// drawSeasonAndDate(width, offset, mc); +// +// //REDSTONE PERCENT +// drawRedstone(width, offset, mc); +// +// // LOCATION +// drawLocation(width, offset, mc); +// +// //EXTRA SLOT +// if (LocationHandler.getCurrentLocation().equals(Locations.YOURISLAND)) { +// if (IslandHandler.flightTime > 0) drawFlightDuration(width, offset, mc); +// } else if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.MUSHROOMDESERT)) { +// drawTrapperOrPelts(width, offset, mc); +// } else if (LocationHandler.getCurrentLocation().getCategory().isMiningCategory()) { +// if (MinesHandler.currentEvent.display) { +// drawDwarvenEvent(width, offset, mc); +// } else { +// drawMiningPowders(width, offset, mc); +// } +// } else if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.PARK) && ParkIslandHandler.isRaining()) { +// if (LocationHandler.getCurrentLocation().equals(Locations.HOWLINGCAVE)) { +// drawSlayer(width, offset, mc); +// } else drawRainDuration(width, offset, mc); +// } else if (LocationHandler.getCurrentLocation().equals(Locations.FARMHOUSE)) { +// drawFarmHouseMedals(width, offset, mc); +// } else if (SlayerHandler.isDoingSlayer) { +// drawSlayer(width, offset, mc); +// } +// } +// +// public void drawSeasonAndDate(int width, int offset, Minecraft mc) { +// if (SeasonDateHandler.getCurrentSeason() != Season.ERROR) { +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// if (mc.thePlayer.ticksExisted % 100 == 0 && eventToggle) eventToggle = false; +// if (mc.thePlayer.ticksExisted % 600 == 0) eventToggle = true; +// mc.renderEngine.bindTexture(Textures.texture.stats); +// String dateText = SeasonDateHandler.getFancySeasonAndDate(); +// if (eventToggle && !SeasonDateHandler.getCurrentEvent().isEmpty() && !SeasonDateHandler.getCurrentEventTime().isEmpty()) dateText = SeasonDateHandler.getCurrentEvent().trim() + " " + SeasonDateHandler.getCurrentEventTime().trim(); +// drawTexturedModalRect((width / 2) + 17, offset + (bossBarVisible ? 20 : 3), 2, 34, font.getStringWidth(dateText) + 9, 14); +// drawTexturedModalRect(((width / 2) + 17) + font.getStringWidth(dateText) + 9, offset + (bossBarVisible ? 20 : 3), 252, 34, 4, 14); +// drawTexturedModalRect(((width / 2) + 17) + font.getStringWidth(dateText) + 2, offset + (bossBarVisible ? 23 : 6), SeasonDateHandler.getCurrentSeason().getTextureX(), 16, 8, 8); +// drawString(font, dateText, (width / 2) + 18, offset + (bossBarVisible ? 23 : 6), 0xffffff); +// } +// } +// +// public void drawLocation(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) - 33 - (font.getStringWidth(LocationHandler.getCurrentLocation().getDisplayName())), offset + (bossBarVisible ? 20 : 3), 0, 34, 2, 14); +// drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(LocationHandler.getCurrentLocation().getDisplayName()))) + 2, offset + (bossBarVisible ? 20 : 3), 2, 34, font.getStringWidth(LocationHandler.getCurrentLocation().getDisplayName()) + 14, 14); +// drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(LocationHandler.getCurrentLocation().getDisplayName()))) + 4, offset + (bossBarVisible ? 23 : 6), LocationHandler.getCurrentLocation().getCategory().getTexturePos(), 8, 8, 8); +// drawString(font, LocationHandler.getCurrentLocation().getDisplayName(), (width / 2) - 19 - (font.getStringWidth(LocationHandler.getCurrentLocation().getDisplayName())), offset + (bossBarVisible ? 23 : 6), 0xFFFFFF); +// } +// +// public void drawRedstone(int width, int offset, Minecraft mc) { +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// mc.renderEngine.bindTexture(Textures.texture.stats); +// int redstoneColor = IslandHandler.redstone > 90 ? 0xFF0000 : IslandHandler.redstone > 75 ? 0xC45B00 : IslandHandler.redstone > 50 ? 0xFFFF55 : 0x55FF55; +// if (IslandHandler.redstone > 0 && Utils.isPlayerHoldingRedstone(mc.thePlayer)) { +// drawTexturedModalRect((width / 2) - 15, offset + (bossBarVisible ? 51 : 34), 0, 48, 30, 18); +// drawTexturedModalRect((width / 2) - 4, offset + (bossBarVisible ? 51 : 34), 59, 0, 8, 8); +// drawCenteredString(mc.fontRendererObj, IslandHandler.redstone + "%", (width / 2), offset + (bossBarVisible ? 58 : 41), redstoneColor); +// } +// } +// +// public void drawPurseAndBits(int width, int offset, Minecraft mc) { +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// mc.renderEngine.bindTexture(Textures.texture.stats); +// int xPos = (width / 2) + 17; +// +// //COINS +// drawTexturedModalRect(xPos, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(CurrencyHandler.getCoinsFormatted()) + 11, 14); +// drawTexturedModalRect(xPos + 1, offset + (bossBarVisible ? 37 : 20), 34, 0, 8, 8); +// drawString(font, CurrencyHandler.getCoinsFormatted(), xPos + 10, offset + (bossBarVisible ? 38 : 21), 0xFFAA00); +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// mc.renderEngine.bindTexture(Textures.texture.stats); +// xPos += font.getStringWidth(CurrencyHandler.getCoinsFormatted()) + 11; +// +// //BITS +// if (CurrencyHandler.getBits() > 0) { +// drawTexturedModalRect(xPos, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(CurrencyHandler.getBitsFormatted()) + 11, 14); +// drawTexturedModalRect(xPos + 1, offset + (bossBarVisible ? 37 : 20), 75, 0, 8, 8); +// drawString(font, CurrencyHandler.getBitsFormatted(), xPos + 10, offset + (bossBarVisible ? 38 : 21), 0x55FFFF); +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// mc.renderEngine.bindTexture(Textures.texture.stats); +// xPos += font.getStringWidth(CurrencyHandler.getBitsFormatted()) + 11; +// } +// +// drawTexturedModalRect(xPos, offset + (bossBarVisible ? 35 : 18), 252, 34, 4, 14); +// } +// +// public void drawFlightDuration(int width, int offset, Minecraft mc) { +// if (LocationHandler.getCurrentLocation().equals(Locations.YOURISLAND)) { +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// DecimalFormat flightFormat = new DecimalFormat("#.#", DecimalFormatSymbols.getInstance(Locale.CANADA)); +// String duration; +// if (IslandHandler.flightTime < 60) duration = IslandHandler.flightTime + "s"; else if (IslandHandler.flightTime < 3600) duration = flightFormat.format((double) IslandHandler.flightTime / 60) + "m"; else if (IslandHandler.flightTime < 86400) duration = flightFormat.format((double) IslandHandler.flightTime / 3600) + "hr"; else if (IslandHandler.flightTime < 86460) duration = flightFormat.format((double) IslandHandler.flightTime / 86400) + "day"; else duration = flightFormat.format((double) IslandHandler.flightTime / 86400) + "days"; +// mc.renderEngine.bindTexture(Textures.texture.stats); +// 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), 67, 0, 8, 8); +// drawString(font, duration, (width / 2) - 19 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF); +// } +// } +// +// public void drawRainDuration(int width, int offset, Minecraft mc) { +// if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.PARK)) { +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// mc.renderEngine.bindTexture(Textures.texture.stats); +// String duration = "Rain: " + ParkIslandHandler.getRainTime(); +// 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), 83, 0, 8, 8); +// drawString(font, duration, (width / 2) - 19 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF); +// } +// } +// +// public void drawSlayer(int width, int offset, Minecraft mc) { +// if (SlayerHandler.isDoingSlayer) { +// int kills = SlayerHandler.progress; +// int maxKills = SlayerHandler.maxKills; +// int tier = SlayerHandler.slayerTier; +// SlayerHandler.slayerTypes slayerType = SlayerHandler.currentSlayer; +// if (slayerType != SlayerHandler.slayerTypes.NONE) { +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// mc.renderEngine.bindTexture(Textures.texture.stats); +// StringBuilder stringBuilder = new StringBuilder(); +// stringBuilder.append(EnumChatFormatting.GREEN); +// stringBuilder.append(Utils.intToRomanNumeral(tier)); +// stringBuilder.append(" "); +// if (SlayerHandler.isKillingBoss) { +// stringBuilder.append(EnumChatFormatting.RED); +// stringBuilder.append("Slay Boss!"); +// } else if (SlayerHandler.bossSlain) { +// stringBuilder.append(EnumChatFormatting.RED); +// stringBuilder.append("Boss Slain!"); +// } else if (kills == 0 && maxKills == 0) { +// stringBuilder.append(EnumChatFormatting.RED); +// stringBuilder.append("Not Slaying!"); +// } else { +// stringBuilder.append(EnumChatFormatting.YELLOW); +// stringBuilder.append(kills); +// stringBuilder.append(EnumChatFormatting.GRAY); +// stringBuilder.append("/"); +// stringBuilder.append(EnumChatFormatting.RED); +// stringBuilder.append(maxKills); +// } +// String text = stringBuilder.toString(); +// 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), slayerType.getX(), 24, 8, 8); +// drawString(font, text, (width / 2) - 19 - (font.getStringWidth(text)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF); +// } +// } +// } +// +// public void drawMiningPowders(int width, int offset, Minecraft mc) { +// if (MinesHandler.gemstone == 0) { +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// mc.renderEngine.bindTexture(Textures.texture.stats); +// String mithril = MinesHandler.getMithrilFormatted(); +// drawTexturedModalRect((width / 2) - 33 - (font.getStringWidth(mithril)), offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); +// drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(mithril))) + 2, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(mithril) + 14, 14); +// drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(mithril))) + 4, offset + (bossBarVisible ? 38 : 21), 91, 0, 8, 8); +// drawString(font, mithril, (width / 2) - 19 - (font.getStringWidth(mithril)), offset + (bossBarVisible ? 38 : 21), 0x00C896); +// } else { +// LocationCategory locationCategory = LocationHandler.getCurrentLocation().getCategory(); +// String mithril = locationCategory == LocationCategory.DWARVENMINES ? MinesHandler.getMithrilFormatted() : MinesHandler.getMithrilShortFormatted(); +// String gemstone = locationCategory == LocationCategory.CRYSTALHOLLOWS ? MinesHandler.getGemstoneFormatted() : MinesHandler.getGemstoneShortFormatted(); +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// mc.renderEngine.bindTexture(Textures.texture.stats); +// +// int edge = (width / 2) - 33; +// +// int barWidth = font.getStringWidth(mithril) + 12 + font.getStringWidth(gemstone); +// +// int firstText = locationCategory == LocationCategory.DWARVENMINES ? font.getStringWidth(mithril) : font.getStringWidth(gemstone); +// +// //Bar +// drawTexturedModalRect(edge - barWidth, offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); +// drawTexturedModalRect(edge - barWidth + 2, offset + (bossBarVisible ? 35 : 18), 2, 34, barWidth + 14, 14); +// +// //Icons +// drawTexturedModalRect(edge - barWidth + 4, offset + (bossBarVisible ? 38 : 21), locationCategory == LocationCategory.DWARVENMINES ? 91 : 131, 0, 8, 8); +// drawTexturedModalRect(edge - barWidth + 16 + firstText, offset + (bossBarVisible ? 38 : 21), locationCategory == LocationCategory.DWARVENMINES ? 131 : 91, 0, 8, 8); +// +// drawString(font, locationCategory == LocationCategory.DWARVENMINES ? mithril : gemstone, edge - barWidth + 14, offset + (bossBarVisible ? 38 : 21), locationCategory == LocationCategory.DWARVENMINES ? 0x00C896 : 0xFF55FF); +// drawString(font, locationCategory == LocationCategory.DWARVENMINES ? gemstone : mithril, edge - barWidth + 26 + firstText, offset + (bossBarVisible ? 38 : 21), locationCategory == LocationCategory.DWARVENMINES ? 0xFF55FF : 0x00C896); +// } +// } +// +// public void drawTrapperOrPelts(int width, int offset, Minecraft mc) { +// if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.MUSHROOMDESERT)) { +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// mc.renderEngine.bindTexture(Textures.texture.stats); +// String duration = FarmingIslandHandler.location != Locations.NONE ? FarmingIslandHandler.location.getDisplayName() : "" + FarmingIslandHandler.pelts; +// 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), FarmingIslandHandler.location != Locations.NONE ? 123 : 115, 0, 8, 8); +// drawString(font, duration, (width / 2) - 19 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF); +// } +// } +// +// public void drawDwarvenEvent(int width, int offset, Minecraft mc) { +// 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)); +// int silver = font.getStringWidth(FarmHouseHandler.getFormattedMedals(FarmHouseHandler.Medal.SILVER)); +// int gold = font.getStringWidth(FarmHouseHandler.getFormattedMedals(FarmHouseHandler.Medal.GOLD)); +// +// int end = drawLeftBottomBar(width, offset, 40 + bronze + silver + gold, mc); +// drawTexturedModalRect(end + 2, offset + (bossBarVisible ? 38 : 21), 139, 0, 8, 8); +// drawTexturedModalRect(end + 14 + gold, offset + (bossBarVisible ? 38 : 21), 147, 0, 8, 8); +// drawTexturedModalRect(end + 26 + gold + silver, offset + (bossBarVisible ? 38 : 21), 155, 0, 8, 8); +// +// drawString(font, FarmHouseHandler.getFormattedMedals(FarmHouseHandler.Medal.GOLD), end + 12, offset + (bossBarVisible ? 38 : 21), 0xffffff); +// drawString(font, FarmHouseHandler.getFormattedMedals(FarmHouseHandler.Medal.SILVER), end + gold + 24, offset + (bossBarVisible ? 38 : 21), 0xffffff); +// drawString(font, FarmHouseHandler.getFormattedMedals(FarmHouseHandler.Medal.BRONZE), end + gold + silver + 36, offset + (bossBarVisible ? 38 : 21), 0xffffff); +// } +// } +// +// @SubscribeEvent +// public void renderOverlay(RenderGameOverlayEvent.Post event) { +// if (Utils.overlayShouldRender(event.type, LorenzMod.hasSkyblockScoreboard())) { +// 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 && !LorenzMod.config.main.disaleMainHud) { +// drawClock(event.resolution.getScaledWidth(), LorenzMod.config.main.mainHudPos.getAbsY(event.resolution, 34), mc); +// } +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// } +// } +// +// public void drawScaledString(float factor, int x, int y, String text, int color) { +// GlStateManager.scale(factor, factor, 1); +// drawCenteredString(font, text, (int) (x / factor), (int) (y / factor), color); +// GlStateManager.scale(1 / factor, 1 / factor, 1); +// } +// +// public int drawLeftBottomBar(int width, int offset, int barWidth, Minecraft mc) { +// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +// mc.renderEngine.bindTexture(Textures.texture.stats); +// int edge = (width / 2) - 17; +// +// drawTexturedModalRect(edge - barWidth, offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); +// drawTexturedModalRect(edge - barWidth + 2, offset + (bossBarVisible ? 35 : 18), 2, 34, barWidth - 2, 14); +// return edge - barWidth + 2; +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java index f40e6aa60..69501b89f 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java @@ -1,112 +1,112 @@ -package com.thatgravyboat.skyblockhud.overlay; - -import com.mojang.realmsclient.gui.ChatFormatting; -import at.lorenz.mod.LorenzMod; -import com.thatgravyboat.skyblockhud.core.config.Position; -import com.thatgravyboat.skyblockhud.handlers.HeldItemHandler; -import com.thatgravyboat.skyblockhud.textures.Textures; -import com.thatgravyboat.skyblockhud.utils.Utils; -import java.text.DecimalFormat; -import java.text.NumberFormat; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraftforge.client.event.RenderGameOverlayEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class RPGHud extends Gui { - - private static int mana, maxMana, overflow = 0; - private static int health, maxHealth = 0; - private static int defense = 0; - - public static void updateMana(int current, int max) { - mana = current; - maxMana = max; - } - - public static void updateOverflow(int current) { - overflow = current; - } - - public static void updateHealth(int current, int max) { - health = current; - maxHealth = max; - } - - public static void updateDefense(int input) { - defense = input; - } - - public static void manaPredictionUpdate(boolean isIncrease, int decrease) { - mana = isIncrease ? Math.min(mana + (maxMana / 50), maxMana) : mana - decrease; - } - - private static final DecimalFormat decimalFormat = new DecimalFormat("#.##"); - - static { - decimalFormat.setGroupingUsed(true); - decimalFormat.setGroupingSize(3); - } - - @SubscribeEvent - public void renderOverlay(RenderGameOverlayEvent.Post event) { - if (Utils.overlayShouldRender(event.type, LorenzMod.hasSkyblockScoreboard(), LorenzMod.config.rpg.showRpgHud)) { - Minecraft mc = Minecraft.getMinecraft(); - GlStateManager.enableBlend(); - GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); - FontRenderer font = mc.fontRendererObj; - if (mc.thePlayer.getHealth() < mc.thePlayer.getMaxHealth()) { - health = Math.max((int) (maxHealth * (mc.thePlayer.getHealth() / mc.thePlayer.getMaxHealth())), health); - } - - mc.renderEngine.bindTexture(Textures.texture.playerStats); - Position position = LorenzMod.config.rpg.rpgHudPosition; - - int x = position.getAbsX(event.resolution, 120); - int y = position.getAbsY(event.resolution, 47); - - boolean rightAligned = position.rightAligned(event.resolution, 120) && LorenzMod.config.rpg.flipHud; - - drawTexturedModalRect(x, y, rightAligned ? 131 : 5, 6, 120, 47); - - float manaWidth = Math.min(57 * ((float) mana / (float) maxMana), 57); - int manaX = rightAligned ? x + 16 : 47 + x; - if (HeldItemHandler.hasManaCost(mc.thePlayer.getHeldItem())) { - int manaCost = HeldItemHandler.getManaCost(mc.thePlayer.getHeldItem()); - drawTexturedModalRect(manaX, 17 + y, rightAligned ? 199 : 0, manaCost > mana ? 96 : 64, (int) manaWidth, 4); - if (manaCost <= mana) { - drawTexturedModalRect(manaX, 17 + y, rightAligned ? 199 : 0, 92, Utils.lerp((float) manaCost / (float) maxMana, 0, 57), 4); - } - } else { - drawTexturedModalRect(manaX, 17 + y, rightAligned ? 199 : 0, 64, (int) manaWidth, 4); - } - - float healthWidth = Math.min(70 * ((float) health / (float) maxHealth), 70); - int healthX = rightAligned ? x + 3 : 47 + x; - drawTexturedModalRect(healthX, 22 + y, rightAligned ? 186 : 0, 68, (int) healthWidth, 5); - - if (health > maxHealth) { - float absorptionWidth = Math.min(70 * ((float) (health - maxHealth) / (float) maxHealth), 70); - drawTexturedModalRect(healthX, 22 + y, rightAligned ? 186 : 0, 77, (int) absorptionWidth, 5); - } - - drawTexturedModalRect(rightAligned ? x + 7 : 45 + x, 28 + y, rightAligned ? 189 : 0, 73, Utils.lerp(mc.thePlayer.experience, 0, 67), 4); - //Air in water - NumberFormat myFormat = NumberFormat.getInstance(); - myFormat.setGroupingUsed(true); - if (mc.thePlayer.getAir() < 300) { - drawTexturedModalRect(rightAligned ? x + 17 : 39 + x, 33 + y, rightAligned ? 192 : 0, 82, 64, 6); - drawTexturedModalRect(rightAligned ? x + 19 : 41 + x, 33 + y, rightAligned ? 196 : 0, 88, Utils.lerp(mc.thePlayer.getAir() / 300f, 0, 60), 4); - } - - Utils.drawStringScaled("" + mc.thePlayer.experienceLevel, font, (rightAligned ? 112 : 14) + x - (font.getStringWidth("" + mc.thePlayer.experienceLevel) / 2f), 34 + y, false, 8453920, 0.75f); - - Utils.drawStringScaled(ChatFormatting.RED + " \u2764 " + health + "/" + maxHealth, font, (rightAligned ? 10 : 42) + x, 8 + y, true, 0xffffff, 0.75f); - - GlStateManager.color(255, 255, 255); - GlStateManager.disableBlend(); - } - } -} +//package com.thatgravyboat.skyblockhud.overlay; +// +//import com.mojang.realmsclient.gui.ChatFormatting; +//import at.lorenz.mod.LorenzMod; +//import com.thatgravyboat.skyblockhud.core.config.Position; +//import com.thatgravyboat.skyblockhud.handlers.HeldItemHandler; +//import com.thatgravyboat.skyblockhud.textures.Textures; +//import com.thatgravyboat.skyblockhud.utils.Utils; +//import java.text.DecimalFormat; +//import java.text.NumberFormat; +//import net.minecraft.client.Minecraft; +//import net.minecraft.client.gui.FontRenderer; +//import net.minecraft.client.gui.Gui; +//import net.minecraft.client.renderer.GlStateManager; +//import net.minecraftforge.client.event.RenderGameOverlayEvent; +//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +// +//public class RPGHud extends Gui { +// +// private static int mana, maxMana, overflow = 0; +// private static int health, maxHealth = 0; +// private static int defense = 0; +// +// public static void updateMana(int current, int max) { +// mana = current; +// maxMana = max; +// } +// +// public static void updateOverflow(int current) { +// overflow = current; +// } +// +// public static void updateHealth(int current, int max) { +// health = current; +// maxHealth = max; +// } +// +// public static void updateDefense(int input) { +// defense = input; +// } +// +// public static void manaPredictionUpdate(boolean isIncrease, int decrease) { +// mana = isIncrease ? Math.min(mana + (maxMana / 50), maxMana) : mana - decrease; +// } +// +// private static final DecimalFormat decimalFormat = new DecimalFormat("#.##"); +// +// static { +// decimalFormat.setGroupingUsed(true); +// decimalFormat.setGroupingSize(3); +// } +// +// @SubscribeEvent +// public void renderOverlay(RenderGameOverlayEvent.Post event) { +// if (Utils.overlayShouldRender(event.type, LorenzMod.hasSkyblockScoreboard(), LorenzMod.config.rpg.showRpgHud)) { +// Minecraft mc = Minecraft.getMinecraft(); +// GlStateManager.enableBlend(); +// GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); +// FontRenderer font = mc.fontRendererObj; +// if (mc.thePlayer.getHealth() < mc.thePlayer.getMaxHealth()) { +// health = Math.max((int) (maxHealth * (mc.thePlayer.getHealth() / mc.thePlayer.getMaxHealth())), health); +// } +// +// mc.renderEngine.bindTexture(Textures.texture.playerStats); +// Position position = LorenzMod.config.rpg.rpgHudPosition; +// +// int x = position.getAbsX(event.resolution, 120); +// int y = position.getAbsY(event.resolution, 47); +// +// boolean rightAligned = position.rightAligned(event.resolution, 120) && LorenzMod.config.rpg.flipHud; +// +// drawTexturedModalRect(x, y, rightAligned ? 131 : 5, 6, 120, 47); +// +// float manaWidth = Math.min(57 * ((float) mana / (float) maxMana), 57); +// int manaX = rightAligned ? x + 16 : 47 + x; +// if (HeldItemHandler.hasManaCost(mc.thePlayer.getHeldItem())) { +// int manaCost = HeldItemHandler.getManaCost(mc.thePlayer.getHeldItem()); +// drawTexturedModalRect(manaX, 17 + y, rightAligned ? 199 : 0, manaCost > mana ? 96 : 64, (int) manaWidth, 4); +// if (manaCost <= mana) { +// drawTexturedModalRect(manaX, 17 + y, rightAligned ? 199 : 0, 92, Utils.lerp((float) manaCost / (float) maxMana, 0, 57), 4); +// } +// } else { +// drawTexturedModalRect(manaX, 17 + y, rightAligned ? 199 : 0, 64, (int) manaWidth, 4); +// } +// +// float healthWidth = Math.min(70 * ((float) health / (float) maxHealth), 70); +// int healthX = rightAligned ? x + 3 : 47 + x; +// drawTexturedModalRect(healthX, 22 + y, rightAligned ? 186 : 0, 68, (int) healthWidth, 5); +// +// if (health > maxHealth) { +// float absorptionWidth = Math.min(70 * ((float) (health - maxHealth) / (float) maxHealth), 70); +// drawTexturedModalRect(healthX, 22 + y, rightAligned ? 186 : 0, 77, (int) absorptionWidth, 5); +// } +// +// drawTexturedModalRect(rightAligned ? x + 7 : 45 + x, 28 + y, rightAligned ? 189 : 0, 73, Utils.lerp(mc.thePlayer.experience, 0, 67), 4); +// //Air in water +// NumberFormat myFormat = NumberFormat.getInstance(); +// myFormat.setGroupingUsed(true); +// if (mc.thePlayer.getAir() < 300) { +// drawTexturedModalRect(rightAligned ? x + 17 : 39 + x, 33 + y, rightAligned ? 192 : 0, 82, 64, 6); +// drawTexturedModalRect(rightAligned ? x + 19 : 41 + x, 33 + y, rightAligned ? 196 : 0, 88, Utils.lerp(mc.thePlayer.getAir() / 300f, 0, 60), 4); +// } +// +// Utils.drawStringScaled("" + mc.thePlayer.experienceLevel, font, (rightAligned ? 112 : 14) + x - (font.getStringWidth("" + mc.thePlayer.experienceLevel) / 2f), 34 + y, false, 8453920, 0.75f); +// +// Utils.drawStringScaled(ChatFormatting.RED + " \u2764 " + health + "/" + maxHealth, font, (rightAligned ? 10 : 42) + x, 8 + y, true, 0xffffff, 0.75f); +// +// GlStateManager.color(255, 255, 255); +// GlStateManager.disableBlend(); +// } +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java b/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java index e7b8eb571..8fddaec98 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java @@ -1,152 +1,152 @@ -package com.thatgravyboat.skyblockhud.playerstats; - -import at.lorenz.mod.LorenzMod; -import com.thatgravyboat.skyblockhud.overlay.MiningHud; -import com.thatgravyboat.skyblockhud.overlay.RPGHud; -import com.thatgravyboat.skyblockhud.utils.Utils; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import net.minecraftforge.fml.common.eventhandler.EventPriority; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; - -public class ActionBarParsing { - - private static String lastActionBar = ""; - public static String lastLowActionBar = ""; - private static IChatComponent lastLowEditedActionBar = null; - - private static final Pattern HealthRegex = Pattern.compile("([0-9]+)/([0-9]+)\u2764"); - private static final Pattern HealingRegex = Pattern.compile("\\+([0-9]+)[\u2586\u2585\u2584\u2583\u2582\u2581]"); - private static final Pattern DefenseRegex = Pattern.compile("([0-9]+)\u2748 Defense"); - private static final Pattern ManaRegex = Pattern.compile("([0-9]+)/([0-9]+)\u270E Mana"); - private static final Pattern ManaOverflowRegex = Pattern.compile("([0-9]+)/([0-9]+)\u270E ([0-9]+)\u02AC"); - private static final Pattern ManaDecreaseRegex = Pattern.compile("-([0-9]+) Mana \\("); - private static final Pattern DrillFuelRegex = Pattern.compile("([0-9,]+)/([0-9,]+k) Drill Fuel"); - private static final Pattern XpGainRegex = Pattern.compile("\\+(\\d*\\.?\\d*) (Farming|Mining|Combat|Foraging|Fishing|Enchanting|Alchemy|Carpentry|Runecrafting) \\((\\d*\\.?\\d*)%\\)"); - - private static final Pattern HealthReplaceRegex = Pattern.compile("\u00A7c([0-9]+)/([0-9]+)\u2764"); - private static final Pattern HealingReplaceRegex = Pattern.compile("\\+\u00A7c([0-9]+)[\u2586\u2585\u2584\u2583\u2582\u2581]"); - private static final Pattern HealthAbsorptionReplaceRegex = Pattern.compile("\u00A76([0-9]+)/([0-9]+)\u2764"); - private static final Pattern DefenseReplaceRegex = Pattern.compile("\u00A7a([0-9]+)\u00A7a\u2748 Defense"); - private static final Pattern ManaReplaceRegex = Pattern.compile("\u00A7b([0-9]+)/([0-9]+)\u270E Mana"); - private static final Pattern ManaOverflowReplaceRegex = Pattern.compile("\u00A7b([0-9]+)/([0-9]+)\u270E \u00A73([0-9]+)\u02AC"); - private static final Pattern DrillFuelReplaceRegex = Pattern.compile("\u00A72([0-9,]+)/([0-9,]+k) Drill Fuel"); - - private static int ticksSinceLastPrediction = 0; - private static boolean predict = false; - - @SubscribeEvent - public void tick(TickEvent.ClientTickEvent event) { - if (predict) { - ticksSinceLastPrediction++; - if (ticksSinceLastPrediction == 20 && LorenzMod.config.rpg.showRpgHud) { - ticksSinceLastPrediction = 0; - RPGHud.manaPredictionUpdate(true, 0); - } - } - } - - @SubscribeEvent(priority = EventPriority.HIGHEST) - public void onStatusBarHigh(ClientChatReceivedEvent event) { - if (event.type == 2) { - if (LorenzMod.hasSkyblockScoreboard() && LorenzMod.config.rpg.showRpgHud) { - parseActionBar(event.message.getUnformattedText()); - } - if (LorenzMod.config.mining.showDrillBar) { - String bar = Utils.removeColor(event.message.getUnformattedText()); - Matcher DrillFuelMatcher = DrillFuelRegex.matcher(bar); - if (DrillFuelMatcher.find()) { - try { - MiningHud.setFuel(Integer.parseInt(DrillFuelMatcher.group(1).replace(",", "")), Integer.parseInt(DrillFuelMatcher.group(2).replace("k", "")) * 1000); - } catch (Exception ignored) { - MiningHud.setFuel(0, 0); - } - } - } - } - } - - @SubscribeEvent(priority = EventPriority.LOW) - public void onStatusBarLow(ClientChatReceivedEvent event) { - if (event.type == 2) { - if (LorenzMod.hasSkyblockScoreboard() && LorenzMod.config.rpg.showRpgHud) { - String message = event.message.getUnformattedText(); - if (lastLowEditedActionBar == null || !lastLowActionBar.equals(message)) { - lastLowActionBar = message; - message = HealthReplaceRegex.matcher(message).replaceAll(""); - message = HealthAbsorptionReplaceRegex.matcher(message).replaceAll(""); - message = DefenseReplaceRegex.matcher(message).replaceAll(""); - message = ManaReplaceRegex.matcher(message).replaceAll(""); - Matcher overflowMatcher = ManaOverflowReplaceRegex.matcher(message); - if (overflowMatcher.find() && LorenzMod.config.renderer.addOverflowMana) { - message = overflowMatcher.replaceAll("\u00A73\u02AC " + overflowMatcher.group(3)); - } - - lastLowEditedActionBar = new ChatComponentText(message.trim()); - } - event.message = lastLowEditedActionBar; - } - if (LorenzMod.config.mining.showDrillBar) { - event.message = new ChatComponentText(DrillFuelReplaceRegex.matcher(event.message.getUnformattedText()).replaceAll("").trim()); - } - } - } - - public static void parseActionBar(String input) { - if (!lastActionBar.equals(input)) { - lastActionBar = input; - String bar = Utils.removeColor(input); - - Matcher HealthMatcher = HealthRegex.matcher(bar); - Matcher DefenseMatcher = DefenseRegex.matcher(bar); - Matcher ManaMatcher = ManaRegex.matcher(bar); - Matcher ManaUseMatcher = ManaDecreaseRegex.matcher(bar); - Matcher ManaOverflowMatcher = ManaOverflowRegex.matcher(bar); - Matcher XpGainMatcher = XpGainRegex.matcher(bar); - - boolean healthFound = HealthMatcher.find(); - boolean defenseFound = DefenseMatcher.find(); - boolean manaFound = ManaMatcher.find(); - boolean manaUseFound = ManaUseMatcher.find(); - boolean manaOverflowFound = ManaOverflowMatcher.find(); - boolean xpFound = XpGainMatcher.find(); - - if (healthFound) { - try { - RPGHud.updateHealth(Integer.parseInt(HealthMatcher.group(1)), Integer.parseInt(HealthMatcher.group(2))); - } catch (Exception ignored) {} - } - if (defenseFound) { - try { - RPGHud.updateDefense(Integer.parseInt(DefenseMatcher.group(1))); - } catch (Exception ignored) {} - } else if (!xpFound && !manaUseFound) { - RPGHud.updateDefense(0); - } - if (manaFound) { - try { - RPGHud.updateMana(Integer.parseInt(ManaMatcher.group(1)), Integer.parseInt(ManaMatcher.group(2))); - } catch (Exception ignored) {} - } - if (!manaFound && manaOverflowFound) { - try { - RPGHud.updateMana(Integer.parseInt(ManaOverflowMatcher.group(1)), Integer.parseInt(ManaOverflowMatcher.group(2))); - RPGHud.updateOverflow(Integer.parseInt(ManaOverflowMatcher.group(3))); - } catch (Exception ignored) {} - } - if (!manaFound) { - if (manaUseFound) { - try { - RPGHud.manaPredictionUpdate(false, Integer.parseInt(ManaUseMatcher.group(1))); - } catch (Exception ignored) {} - } - RPGHud.manaPredictionUpdate(true, 0); - } - predict = !manaFound; - } - } -} +//package com.thatgravyboat.skyblockhud.playerstats; +// +//import at.lorenz.mod.LorenzMod; +//import com.thatgravyboat.skyblockhud.overlay.MiningHud; +//import com.thatgravyboat.skyblockhud.overlay.RPGHud; +//import com.thatgravyboat.skyblockhud.utils.Utils; +//import java.util.regex.Matcher; +//import java.util.regex.Pattern; +//import net.minecraft.util.ChatComponentText; +//import net.minecraft.util.IChatComponent; +//import net.minecraftforge.client.event.ClientChatReceivedEvent; +//import net.minecraftforge.fml.common.eventhandler.EventPriority; +//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +//import net.minecraftforge.fml.common.gameevent.TickEvent; +// +//public class ActionBarParsing { +// +// private static String lastActionBar = ""; +// public static String lastLowActionBar = ""; +// private static IChatComponent lastLowEditedActionBar = null; +// +// private static final Pattern HealthRegex = Pattern.compile("([0-9]+)/([0-9]+)\u2764"); +// private static final Pattern HealingRegex = Pattern.compile("\\+([0-9]+)[\u2586\u2585\u2584\u2583\u2582\u2581]"); +// private static final Pattern DefenseRegex = Pattern.compile("([0-9]+)\u2748 Defense"); +// private static final Pattern ManaRegex = Pattern.compile("([0-9]+)/([0-9]+)\u270E Mana"); +// private static final Pattern ManaOverflowRegex = Pattern.compile("([0-9]+)/([0-9]+)\u270E ([0-9]+)\u02AC"); +// private static final Pattern ManaDecreaseRegex = Pattern.compile("-([0-9]+) Mana \\("); +// private static final Pattern DrillFuelRegex = Pattern.compile("([0-9,]+)/([0-9,]+k) Drill Fuel"); +// private static final Pattern XpGainRegex = Pattern.compile("\\+(\\d*\\.?\\d*) (Farming|Mining|Combat|Foraging|Fishing|Enchanting|Alchemy|Carpentry|Runecrafting) \\((\\d*\\.?\\d*)%\\)"); +// +// private static final Pattern HealthReplaceRegex = Pattern.compile("\u00A7c([0-9]+)/([0-9]+)\u2764"); +// private static final Pattern HealingReplaceRegex = Pattern.compile("\\+\u00A7c([0-9]+)[\u2586\u2585\u2584\u2583\u2582\u2581]"); +// private static final Pattern HealthAbsorptionReplaceRegex = Pattern.compile("\u00A76([0-9]+)/([0-9]+)\u2764"); +// private static final Pattern DefenseReplaceRegex = Pattern.compile("\u00A7a([0-9]+)\u00A7a\u2748 Defense"); +// private static final Pattern ManaReplaceRegex = Pattern.compile("\u00A7b([0-9]+)/([0-9]+)\u270E Mana"); +// private static final Pattern ManaOverflowReplaceRegex = Pattern.compile("\u00A7b([0-9]+)/([0-9]+)\u270E \u00A73([0-9]+)\u02AC"); +// private static final Pattern DrillFuelReplaceRegex = Pattern.compile("\u00A72([0-9,]+)/([0-9,]+k) Drill Fuel"); +// +// private static int ticksSinceLastPrediction = 0; +// private static boolean predict = false; +// +// @SubscribeEvent +// public void tick(TickEvent.ClientTickEvent event) { +// if (predict) { +// ticksSinceLastPrediction++; +// if (ticksSinceLastPrediction == 20 && LorenzMod.config.rpg.showRpgHud) { +// ticksSinceLastPrediction = 0; +// RPGHud.manaPredictionUpdate(true, 0); +// } +// } +// } +// +// @SubscribeEvent(priority = EventPriority.HIGHEST) +// public void onStatusBarHigh(ClientChatReceivedEvent event) { +// if (event.type == 2) { +// if (LorenzMod.hasSkyblockScoreboard() && LorenzMod.config.rpg.showRpgHud) { +// parseActionBar(event.message.getUnformattedText()); +// } +// if (LorenzMod.config.mining.showDrillBar) { +// String bar = Utils.removeColor(event.message.getUnformattedText()); +// Matcher DrillFuelMatcher = DrillFuelRegex.matcher(bar); +// if (DrillFuelMatcher.find()) { +// try { +// MiningHud.setFuel(Integer.parseInt(DrillFuelMatcher.group(1).replace(",", "")), Integer.parseInt(DrillFuelMatcher.group(2).replace("k", "")) * 1000); +// } catch (Exception ignored) { +// MiningHud.setFuel(0, 0); +// } +// } +// } +// } +// } +// +// @SubscribeEvent(priority = EventPriority.LOW) +// public void onStatusBarLow(ClientChatReceivedEvent event) { +// if (event.type == 2) { +// if (LorenzMod.hasSkyblockScoreboard() && LorenzMod.config.rpg.showRpgHud) { +// String message = event.message.getUnformattedText(); +// if (lastLowEditedActionBar == null || !lastLowActionBar.equals(message)) { +// lastLowActionBar = message; +// message = HealthReplaceRegex.matcher(message).replaceAll(""); +// message = HealthAbsorptionReplaceRegex.matcher(message).replaceAll(""); +// message = DefenseReplaceRegex.matcher(message).replaceAll(""); +// message = ManaReplaceRegex.matcher(message).replaceAll(""); +// Matcher overflowMatcher = ManaOverflowReplaceRegex.matcher(message); +// if (overflowMatcher.find() && LorenzMod.config.renderer.addOverflowMana) { +// message = overflowMatcher.replaceAll("\u00A73\u02AC " + overflowMatcher.group(3)); +// } +// +// lastLowEditedActionBar = new ChatComponentText(message.trim()); +// } +// event.message = lastLowEditedActionBar; +// } +// if (LorenzMod.config.mining.showDrillBar) { +// event.message = new ChatComponentText(DrillFuelReplaceRegex.matcher(event.message.getUnformattedText()).replaceAll("").trim()); +// } +// } +// } +// +// public static void parseActionBar(String input) { +// if (!lastActionBar.equals(input)) { +// lastActionBar = input; +// String bar = Utils.removeColor(input); +// +// Matcher HealthMatcher = HealthRegex.matcher(bar); +// Matcher DefenseMatcher = DefenseRegex.matcher(bar); +// Matcher ManaMatcher = ManaRegex.matcher(bar); +// Matcher ManaUseMatcher = ManaDecreaseRegex.matcher(bar); +// Matcher ManaOverflowMatcher = ManaOverflowRegex.matcher(bar); +// Matcher XpGainMatcher = XpGainRegex.matcher(bar); +// +// boolean healthFound = HealthMatcher.find(); +// boolean defenseFound = DefenseMatcher.find(); +// boolean manaFound = ManaMatcher.find(); +// boolean manaUseFound = ManaUseMatcher.find(); +// boolean manaOverflowFound = ManaOverflowMatcher.find(); +// boolean xpFound = XpGainMatcher.find(); +// +// if (healthFound) { +// try { +// RPGHud.updateHealth(Integer.parseInt(HealthMatcher.group(1)), Integer.parseInt(HealthMatcher.group(2))); +// } catch (Exception ignored) {} +// } +// if (defenseFound) { +// try { +// RPGHud.updateDefense(Integer.parseInt(DefenseMatcher.group(1))); +// } catch (Exception ignored) {} +// } else if (!xpFound && !manaUseFound) { +// RPGHud.updateDefense(0); +// } +// if (manaFound) { +// try { +// RPGHud.updateMana(Integer.parseInt(ManaMatcher.group(1)), Integer.parseInt(ManaMatcher.group(2))); +// } catch (Exception ignored) {} +// } +// if (!manaFound && manaOverflowFound) { +// try { +// RPGHud.updateMana(Integer.parseInt(ManaOverflowMatcher.group(1)), Integer.parseInt(ManaOverflowMatcher.group(2))); +// RPGHud.updateOverflow(Integer.parseInt(ManaOverflowMatcher.group(3))); +// } catch (Exception ignored) {} +// } +// if (!manaFound) { +// if (manaUseFound) { +// try { +// RPGHud.manaPredictionUpdate(false, Integer.parseInt(ManaUseMatcher.group(1))); +// } catch (Exception ignored) {} +// } +// RPGHud.manaPredictionUpdate(true, 0); +// } +// predict = !manaFound; +// } +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/seasons/SeasonDateHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/seasons/SeasonDateHandler.java index 02cc490ab..cfce37c07 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/seasons/SeasonDateHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/seasons/SeasonDateHandler.java @@ -1,73 +1,73 @@ -package com.thatgravyboat.skyblockhud.seasons; - -import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent; -import com.thatgravyboat.skyblockhud.utils.Utils; -import java.util.regex.Pattern; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class SeasonDateHandler { - - private static Season currentSeason = Season.ERROR; - private static int currentDate = 1; - private static String currentEvent = ""; - private static String eventTime = ""; - - @SubscribeEvent - public void onSidebarLineUpdate(SidebarLineUpdateEvent event) { - if (Season.get(SeasonDateHandler.removeDate(event.formattedLine.toLowerCase()).toUpperCase()) != Season.ERROR) { - SeasonDateHandler.setCurrentDateAndSeason(SeasonDateHandler.removeSeason(Utils.removeColor(event.formattedLine.toLowerCase().trim())), SeasonDateHandler.removeDate(Utils.removeColor(event.formattedLine.toLowerCase().trim())).toUpperCase()); - } - } - - public static void setCurrentDateAndSeason(int date, String season) { - currentDate = date; - currentSeason = Season.get(season); - } - - public static void setCurrentEvent(String event, String time) { - currentEvent = event; - eventTime = time; - } - - public static Season getCurrentSeason() { - return currentSeason; - } - - public static int getCurrentDate() { - return currentDate; - } - - private static String getDataSuffix(int date) { - if (date > 10 && date < 14) return "th"; - switch (date % 10) { - case 1: - return "st"; - case 2: - return "nd"; - case 3: - return "rd"; - default: - return "th"; - } - } - - public static String getFancySeasonAndDate() { - return (currentSeason.getDisplayName() + " " + currentDate + getDataSuffix(currentDate)); - } - - public static String getCurrentEvent() { - return currentEvent; - } - - public static String getCurrentEventTime() { - return eventTime; - } - - public static String removeDate(String seasonDate) { - return Pattern.compile("[^a-zA-Z]").matcher(seasonDate.toLowerCase()).replaceAll("").replaceAll("st|nd|rd|th", "").trim(); - } - - public static int removeSeason(String seasonDate) { - return Integer.parseInt(Pattern.compile("[^0-9]").matcher(seasonDate.toLowerCase()).replaceAll("").trim()); - } -} +//package com.thatgravyboat.skyblockhud.seasons; +// +//import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent; +//import com.thatgravyboat.skyblockhud.utils.Utils; +//import java.util.regex.Pattern; +//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +// +//public class SeasonDateHandler { +// +// private static Season currentSeason = Season.ERROR; +// private static int currentDate = 1; +// private static String currentEvent = ""; +// private static String eventTime = ""; +// +// @SubscribeEvent +// public void onSidebarLineUpdate(SidebarLineUpdateEvent event) { +// if (Season.get(SeasonDateHandler.removeDate(event.formattedLine.toLowerCase()).toUpperCase()) != Season.ERROR) { +// SeasonDateHandler.setCurrentDateAndSeason(SeasonDateHandler.removeSeason(Utils.removeColor(event.formattedLine.toLowerCase().trim())), SeasonDateHandler.removeDate(Utils.removeColor(event.formattedLine.toLowerCase().trim())).toUpperCase()); +// } +// } +// +// public static void setCurrentDateAndSeason(int date, String season) { +// currentDate = date; +// currentSeason = Season.get(season); +// } +// +// public static void setCurrentEvent(String event, String time) { +// currentEvent = event; +// eventTime = time; +// } +// +// public static Season getCurrentSeason() { +// return currentSeason; +// } +// +// public static int getCurrentDate() { +// return currentDate; +// } +// +// private static String getDataSuffix(int date) { +// if (date > 10 && date < 14) return "th"; +// switch (date % 10) { +// case 1: +// return "st"; +// case 2: +// return "nd"; +// case 3: +// return "rd"; +// default: +// return "th"; +// } +// } +// +// public static String getFancySeasonAndDate() { +// return (currentSeason.getDisplayName() + " " + currentDate + getDataSuffix(currentDate)); +// } +// +// public static String getCurrentEvent() { +// return currentEvent; +// } +// +// public static String getCurrentEventTime() { +// return eventTime; +// } +// +// public static String removeDate(String seasonDate) { +// return Pattern.compile("[^a-zA-Z]").matcher(seasonDate.toLowerCase()).replaceAll("").replaceAll("st|nd|rd|th", "").trim(); +// } +// +// public static int removeSeason(String seasonDate) { +// return Integer.parseInt(Pattern.compile("[^0-9]").matcher(seasonDate.toLowerCase()).replaceAll("").trim()); +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/textures/Textures.java b/src/main/java/com/thatgravyboat/skyblockhud/textures/Textures.java index 8a9ae0d8b..bddc76339 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/textures/Textures.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/textures/Textures.java @@ -26,7 +26,7 @@ public class Textures implements IResourceManagerReloadListener { public static void setTexture(int selected) { if (selected >= styles.size() || selected < 0) { texture = DEFAULT_TEXTURE; - LorenzMod.config.misc.style = 0; +// LorenzMod.config.misc.style = 0; } else { texture = styles.get(selected); } @@ -53,6 +53,6 @@ public class Textures implements IResourceManagerReloadListener { } } catch (Exception ignored) {} - if (LorenzMod.config != null) setTexture(LorenzMod.config.misc.style); +// if (LorenzMod.config != null) setTexture(LorenzMod.config.misc.style); } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java index 14e3c2fe6..ef51769ee 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java @@ -1,136 +1,136 @@ -package com.thatgravyboat.skyblockhud.tracker; - -import com.google.gson.*; -import at.lorenz.mod.LorenzMod; -import com.thatgravyboat.skyblockhud.location.Locations; -import java.io.*; -import java.nio.charset.StandardCharsets; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.Locale; -import net.minecraft.client.Minecraft; -import net.minecraft.util.ResourceLocation; - -public class TrackerFileLoader { - - private static final Gson gson = new GsonBuilder().create(); - - private static void loadTrackers(JsonObject object) { - for (JsonElement element : object.get("trackers").getAsJsonArray()) { - JsonObject tracker = element.getAsJsonObject(); - EnumSet<Locations> locations = EnumSet.noneOf(Locations.class); - tracker - .get("location") - .getAsJsonArray() - .forEach(l -> { - Locations location = Locations.get(l.getAsString().toUpperCase(Locale.ENGLISH)); - if (location != Locations.DEFAULT) { - locations.add(location); - } - }); - if (tracker.has("drops")) { - for (JsonElement drop : tracker.get("drops").getAsJsonArray()) { - TrackerHandler.trackerObjects.add(new TrackerObject(drop.getAsJsonObject(), locations)); - } - } - if (tracker.has("mobs")) { - for (JsonElement mob : tracker.get("mobs").getAsJsonArray()) { - TrackerHandler.trackerObjects.add(new TrackerObject(mob.getAsJsonObject(), locations)); - } - } - } - - for (TrackerObject trackerObject : TrackerHandler.trackerObjects) { - for (Locations location : trackerObject.getLocations()) { - if (TrackerHandler.trackers.containsKey(location)) { - TrackerHandler.trackers.get(location).put(trackerObject.getInternalId(), trackerObject); - } else { - HashMap<String, TrackerObject> value = new HashMap<>(); - value.put(trackerObject.getInternalId(), trackerObject); - TrackerHandler.trackers.put(location, value); - } - } - } - } - - public static void loadTrackersFile() { - TrackerHandler.trackers.clear(); - TrackerHandler.trackerObjects.clear(); - try { - ResourceLocation trackers = new ResourceLocation("skyblockhud:data/trackers.json"); - InputStream is = Minecraft.getMinecraft().getResourceManager().getResource(trackers).getInputStream(); - - try (BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) { - loadTrackers(gson.fromJson(reader, JsonObject.class)); - } - } catch (Exception ignored) {} - } - - private static JsonElement getTrackerFile() { - JsonArray stats = new JsonArray(); - TrackerHandler.trackerObjects.forEach(trackerObject -> { - if (trackerObject.getCount() > 0) { - JsonObject jsonObject = new JsonObject(); - JsonArray locations = new JsonArray(); - trackerObject.getLocations().forEach(l -> locations.add(new JsonPrimitive(l.toString().toUpperCase(Locale.ENGLISH)))); - jsonObject.add("id", new JsonPrimitive(trackerObject.getInternalId())); - jsonObject.add("locations", locations); - jsonObject.add("count", new JsonPrimitive(trackerObject.getCount())); - stats.add(jsonObject); - } - }); - return stats; - } - - public static boolean loadTrackerStatsFile() { - File configFile = new File(LorenzMod.configDirectory, "sbh-trackers-stats.json"); - - try { - if (configFile.createNewFile()) { - return true; - } - - try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8))) { - JsonObject json = gson.fromJson(reader, JsonObject.class); - if (json.has("trackerStats")) { - json - .getAsJsonArray("trackerStats") - .forEach(element -> { - if (element.isJsonObject()) { - JsonObject object = element.getAsJsonObject(); - JsonArray locations = object.get("locations").getAsJsonArray(); - Locations firstLocation = null; - for (JsonElement location : locations) { - firstLocation = Locations.get(location.getAsString()); - if (!firstLocation.equals(Locations.DEFAULT)) break; - } - - if (firstLocation != null && !firstLocation.equals(Locations.DEFAULT)) { - TrackerHandler.trackers.get(firstLocation).get(object.get("id").getAsString()).setCount(object.get("count").getAsInt()); - } - } - }); - - TrackerHandler.trackers.forEach((location, map) -> { - TrackerHandler.trackers.put(location, TrackerHandler.sortTrackers(map, (entry1, entry2) -> Integer.compare(entry2.getValue().getCount(), entry1.getValue().getCount()))); - }); - } - } - } catch (Exception ignored) {} - return false; - } - - public static void saveTrackerStatsFile() { - File configFile = new File(LorenzMod.configDirectory, "sbh-trackers-stats.json"); - - try { - configFile.createNewFile(); - - try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8))) { - JsonObject json = new JsonObject(); - json.add("trackerStats", getTrackerFile()); - writer.write(gson.toJson(json)); - } - } catch (IOException ignored) {} - } -} +//package com.thatgravyboat.skyblockhud.tracker; +// +//import com.google.gson.*; +//import at.lorenz.mod.LorenzMod; +//import com.thatgravyboat.skyblockhud.location.Locations; +//import java.io.*; +//import java.nio.charset.StandardCharsets; +//import java.util.EnumSet; +//import java.util.HashMap; +//import java.util.Locale; +//import net.minecraft.client.Minecraft; +//import net.minecraft.util.ResourceLocation; +// +//public class TrackerFileLoader { +// +// private static final Gson gson = new GsonBuilder().create(); +// +// private static void loadTrackers(JsonObject object) { +// for (JsonElement element : object.get("trackers").getAsJsonArray()) { +// JsonObject tracker = element.getAsJsonObject(); +// EnumSet<Locations> locations = EnumSet.noneOf(Locations.class); +// tracker +// .get("location") +// .getAsJsonArray() +// .forEach(l -> { +// Locations location = Locations.get(l.getAsString().toUpperCase(Locale.ENGLISH)); +// if (location != Locations.DEFAULT) { +// locations.add(location); +// } +// }); +// if (tracker.has("drops")) { +// for (JsonElement drop : tracker.get("drops").getAsJsonArray()) { +// TrackerHandler.trackerObjects.add(new TrackerObject(drop.getAsJsonObject(), locations)); +// } +// } +// if (tracker.has("mobs")) { +// for (JsonElement mob : tracker.get("mobs").getAsJsonArray()) { +// TrackerHandler.trackerObjects.add(new TrackerObject(mob.getAsJsonObject(), locations)); +// } +// } +// } +// +// for (TrackerObject trackerObject : TrackerHandler.trackerObjects) { +// for (Locations location : trackerObject.getLocations()) { +// if (TrackerHandler.trackers.containsKey(location)) { +// TrackerHandler.trackers.get(location).put(trackerObject.getInternalId(), trackerObject); +// } else { +// HashMap<String, TrackerObject> value = new HashMap<>(); +// value.put(trackerObject.getInternalId(), trackerObject); +// TrackerHandler.trackers.put(location, value); +// } +// } +// } +// } +// +// public static void loadTrackersFile() { +// TrackerHandler.trackers.clear(); +// TrackerHandler.trackerObjects.clear(); +// try { +// ResourceLocation trackers = new ResourceLocation("skyblockhud:data/trackers.json"); +// InputStream is = Minecraft.getMinecraft().getResourceManager().getResource(trackers).getInputStream(); +// +// try (BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) { +// loadTrackers(gson.fromJson(reader, JsonObject.class)); +// } +// } catch (Exception ignored) {} +// } +// +// private static JsonElement getTrackerFile() { +// JsonArray stats = new JsonArray(); +// TrackerHandler.trackerObjects.forEach(trackerObject -> { +// if (trackerObject.getCount() > 0) { +// JsonObject jsonObject = new JsonObject(); +// JsonArray locations = new JsonArray(); +// trackerObject.getLocations().forEach(l -> locations.add(new JsonPrimitive(l.toString().toUpperCase(Locale.ENGLISH)))); +// jsonObject.add("id", new JsonPrimitive(trackerObject.getInternalId())); +// jsonObject.add("locations", locations); +// jsonObject.add("count", new JsonPrimitive(trackerObject.getCount())); +// stats.add(jsonObject); +// } +// }); +// return stats; +// } +// +// public static boolean loadTrackerStatsFile() { +// File configFile = new File(LorenzMod.configDirectory, "sbh-trackers-stats.json"); +// +// try { +// if (configFile.createNewFile()) { +// return true; +// } +// +// try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8))) { +// JsonObject json = gson.fromJson(reader, JsonObject.class); +// if (json.has("trackerStats")) { +// json +// .getAsJsonArray("trackerStats") +// .forEach(element -> { +// if (element.isJsonObject()) { +// JsonObject object = element.getAsJsonObject(); +// JsonArray locations = object.get("locations").getAsJsonArray(); +// Locations firstLocation = null; +// for (JsonElement location : locations) { +// firstLocation = Locations.get(location.getAsString()); +// if (!firstLocation.equals(Locations.DEFAULT)) break; +// } +// +// if (firstLocation != null && !firstLocation.equals(Locations.DEFAULT)) { +// TrackerHandler.trackers.get(firstLocation).get(object.get("id").getAsString()).setCount(object.get("count").getAsInt()); +// } +// } +// }); +// +// TrackerHandler.trackers.forEach((location, map) -> { +// TrackerHandler.trackers.put(location, TrackerHandler.sortTrackers(map, (entry1, entry2) -> Integer.compare(entry2.getValue().getCount(), entry1.getValue().getCount()))); +// }); +// } +// } +// } catch (Exception ignored) {} +// return false; +// } +// +// public static void saveTrackerStatsFile() { +// File configFile = new File(LorenzMod.configDirectory, "sbh-trackers-stats.json"); +// +// try { +// configFile.createNewFile(); +// +// try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8))) { +// JsonObject json = new JsonObject(); +// json.add("trackerStats", getTrackerFile()); +// writer.write(gson.toJson(json)); +// } +// } catch (IOException ignored) {} +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java index dae2c2d53..7cb059ba5 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java @@ -1,108 +1,108 @@ -package com.thatgravyboat.skyblockhud.tracker; - -import at.lorenz.mod.LorenzMod; -import com.thatgravyboat.skyblockhud.api.events.SkyBlockEntityKilled; -import com.thatgravyboat.skyblockhud.location.LocationHandler; -import com.thatgravyboat.skyblockhud.location.Locations; -import java.util.*; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.item.ItemStack; -import net.minecraftforge.client.event.RenderGameOverlayEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class TrackerHandler extends Gui { - - public static Set<TrackerObject> trackerObjects = new HashSet<>(); - 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()); - list.sort(comparator); - - Map<K, V> result = new LinkedHashMap<>(); - for (Map.Entry<K, V> entry : list) { - result.put(entry.getKey(), entry.getValue()); - } - - return result; - } - - public static void onItemAdded(String id, int amount, String specialId, int number) { - if (LorenzMod.hasSkyblockScoreboard() && trackers.containsKey(LocationHandler.getCurrentLocation())) { - Map<String, TrackerObject> trackerMap = trackers.get(LocationHandler.getCurrentLocation()); - String dropId = id; - if (specialId != null) { - dropId = specialId.toUpperCase() + ";" + number; - } - - if (trackerMap != null && trackerMap.containsKey(dropId)) { - TrackerObject object = trackerMap.get(dropId); - object.increaseCount(amount); - trackers.put(LocationHandler.getCurrentLocation(), sortTrackers(trackerMap, (entry1, entry2) -> Integer.compare(entry2.getValue().getCount(), entry1.getValue().getCount()))); - } - } - } - - public static void drawItemStack(ItemStack stack, int x, int y) { - if (stack == null) return; - RenderItem itemRender = Minecraft.getMinecraft().getRenderItem(); - RenderHelper.enableGUIStandardItemLighting(); - itemRender.zLevel = -145; - itemRender.renderItemAndEffectIntoGUI(stack, x, y); - itemRender.zLevel = 0; - RenderHelper.disableStandardItemLighting(); - } - - @SubscribeEvent - public void onSbEntityDeath(SkyBlockEntityKilled event) { - if (LorenzMod.hasSkyblockScoreboard() && trackers.containsKey(LocationHandler.getCurrentLocation())) { - Map<String, TrackerObject> trackerMap = trackers.get(LocationHandler.getCurrentLocation()); - if (trackerMap.containsKey("ENTITY:" + event.id)) { - TrackerObject object = trackerMap.get("ENTITY:" + event.id); - object.increaseCount(); - trackers.put(LocationHandler.getCurrentLocation(), sortTrackers(trackerMap, (entry1, entry2) -> Integer.compare(entry2.getValue().getCount(), entry1.getValue().getCount()))); - } - } - } - - @SubscribeEvent - public void renderOverlay(RenderGameOverlayEvent.Post event) { - // if (Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard(), trackers.containsKey(LocationHandler.getCurrentLocation()), !SkyblockHud.config.trackers.hideTracker)) { - // Map<String, TrackerObject> tracker = trackers.get(LocationHandler.getCurrentLocation()); - // Minecraft mc = Minecraft.getMinecraft(); - // - // if (tracker != null) { - // Position pos = SkyblockHud.config.trackers.trackerPosition; - // int startPos = pos.getAbsX(event.resolution, (tracker.size() >= 6 ? 130 : tracker.size() * 20)); - // int y = pos.getAbsY(event.resolution, (int) (10 + Math.ceil(tracker.size() / 5d) * 20)); - // - // Gui.drawRect(startPos, y, startPos + 130, y + 10, -1072689136); - // mc.fontRendererObj.drawString("Tracker", startPos + 4, y + 1, 0xffffff, false); - // y += 10; - // Gui.drawRect(startPos, y, startPos + (tracker.size() >= 6 ? 130 : (tracker.size() * 20) + 10), (int) (y + (Math.ceil(tracker.size() / 5d) * 20)), 1610612736); - // int x = startPos + 5; - // for (TrackerObject object : tracker.values()) { - // String s = Utils.formattedNumber(object.getCount(), 1000); - // GlStateManager.disableLighting(); - // GlStateManager.enableDepth(); - // drawItemStack(object.getDisplayStack(), x, y); - // GlStateManager.disableDepth(); - // GlStateManager.disableBlend(); - // mc.fontRendererObj.drawStringWithShadow(s, (float) (x + 19 - 2 - mc.fontRendererObj.getStringWidth(s)), (float) (y + 9), object.getCount() < 1 ? 16733525 : 16777215); - // GlStateManager.enableBlend(); - // GlStateManager.enableDepth(); - // - // if ((x - startPos + 5) / 20 == 5) { - // x = startPos + 5; - // y += 20; - // } else { - // x += 20; - // } - // } - // } - // } - } -} +//package com.thatgravyboat.skyblockhud.tracker; +// +//import at.lorenz.mod.LorenzMod; +//import com.thatgravyboat.skyblockhud.api.events.SkyBlockEntityKilled; +//import com.thatgravyboat.skyblockhud.location.LocationHandler; +//import com.thatgravyboat.skyblockhud.location.Locations; +//import java.util.*; +//import net.minecraft.client.Minecraft; +//import net.minecraft.client.gui.Gui; +//import net.minecraft.client.renderer.RenderHelper; +//import net.minecraft.client.renderer.entity.RenderItem; +//import net.minecraft.item.ItemStack; +//import net.minecraftforge.client.event.RenderGameOverlayEvent; +//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +// +//public class TrackerHandler extends Gui { +// +// public static Set<TrackerObject> trackerObjects = new HashSet<>(); +// 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()); +// list.sort(comparator); +// +// Map<K, V> result = new LinkedHashMap<>(); +// for (Map.Entry<K, V> entry : list) { +// result.put(entry.getKey(), entry.getValue()); +// } +// +// return result; +// } +// +// public static void onItemAdded(String id, int amount, String specialId, int number) { +// if (LorenzMod.hasSkyblockScoreboard() && trackers.containsKey(LocationHandler.getCurrentLocation())) { +// Map<String, TrackerObject> trackerMap = trackers.get(LocationHandler.getCurrentLocation()); +// String dropId = id; +// if (specialId != null) { +// dropId = specialId.toUpperCase() + ";" + number; +// } +// +// if (trackerMap != null && trackerMap.containsKey(dropId)) { +// TrackerObject object = trackerMap.get(dropId); +// object.increaseCount(amount); +// trackers.put(LocationHandler.getCurrentLocation(), sortTrackers(trackerMap, (entry1, entry2) -> Integer.compare(entry2.getValue().getCount(), entry1.getValue().getCount()))); +// } +// } +// } +// +// public static void drawItemStack(ItemStack stack, int x, int y) { +// if (stack == null) return; +// RenderItem itemRender = Minecraft.getMinecraft().getRenderItem(); +// RenderHelper.enableGUIStandardItemLighting(); +// itemRender.zLevel = -145; +// itemRender.renderItemAndEffectIntoGUI(stack, x, y); +// itemRender.zLevel = 0; +// RenderHelper.disableStandardItemLighting(); +// } +// +// @SubscribeEvent +// public void onSbEntityDeath(SkyBlockEntityKilled event) { +// if (LorenzMod.hasSkyblockScoreboard() && trackers.containsKey(LocationHandler.getCurrentLocation())) { +// Map<String, TrackerObject> trackerMap = trackers.get(LocationHandler.getCurrentLocation()); +// if (trackerMap.containsKey("ENTITY:" + event.id)) { +// TrackerObject object = trackerMap.get("ENTITY:" + event.id); +// object.increaseCount(); +// trackers.put(LocationHandler.getCurrentLocation(), sortTrackers(trackerMap, (entry1, entry2) -> Integer.compare(entry2.getValue().getCount(), entry1.getValue().getCount()))); +// } +// } +// } +// +// @SubscribeEvent +// public void renderOverlay(RenderGameOverlayEvent.Post event) { +// // if (Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard(), trackers.containsKey(LocationHandler.getCurrentLocation()), !SkyblockHud.config.trackers.hideTracker)) { +// // Map<String, TrackerObject> tracker = trackers.get(LocationHandler.getCurrentLocation()); +// // Minecraft mc = Minecraft.getMinecraft(); +// // +// // if (tracker != null) { +// // Position pos = SkyblockHud.config.trackers.trackerPosition; +// // int startPos = pos.getAbsX(event.resolution, (tracker.size() >= 6 ? 130 : tracker.size() * 20)); +// // int y = pos.getAbsY(event.resolution, (int) (10 + Math.ceil(tracker.size() / 5d) * 20)); +// // +// // Gui.drawRect(startPos, y, startPos + 130, y + 10, -1072689136); +// // mc.fontRendererObj.drawString("Tracker", startPos + 4, y + 1, 0xffffff, false); +// // y += 10; +// // Gui.drawRect(startPos, y, startPos + (tracker.size() >= 6 ? 130 : (tracker.size() * 20) + 10), (int) (y + (Math.ceil(tracker.size() / 5d) * 20)), 1610612736); +// // int x = startPos + 5; +// // for (TrackerObject object : tracker.values()) { +// // String s = Utils.formattedNumber(object.getCount(), 1000); +// // GlStateManager.disableLighting(); +// // GlStateManager.enableDepth(); +// // drawItemStack(object.getDisplayStack(), x, y); +// // GlStateManager.disableDepth(); +// // GlStateManager.disableBlend(); +// // mc.fontRendererObj.drawStringWithShadow(s, (float) (x + 19 - 2 - mc.fontRendererObj.getStringWidth(s)), (float) (y + 9), object.getCount() < 1 ? 16733525 : 16777215); +// // GlStateManager.enableBlend(); +// // GlStateManager.enableDepth(); +// // +// // if ((x - startPos + 5) / 20 == 5) { +// // x = startPos + 5; +// // y += 20; +// // } else { +// // x += 20; +// // } +// // } +// // } +// // } +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerObject.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerObject.java index 1c6e54d43..0f827c6c3 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerObject.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerObject.java @@ -1,97 +1,97 @@ -package com.thatgravyboat.skyblockhud.tracker; - -import com.google.gson.JsonObject; -import com.thatgravyboat.skyblockhud.location.Locations; -import java.util.EnumSet; -import java.util.Locale; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.ResourceLocation; - -public class TrackerObject { - - private final ItemStack stack; - private final String internalId; - private final EnumSet<Locations> locations; - private final boolean isEntity; - private int count; - - public TrackerObject(JsonObject jsonObject, EnumSet<Locations> locations) { - this.stack = decodeToItemStack(jsonObject); - this.internalId = jsonObject.get("id").getAsString(); - this.isEntity = jsonObject.get("id").getAsString().contains("entity:"); - this.locations = locations; - } - - public static ItemStack decodeToItemStack(JsonObject jsonObject) { - jsonObject = jsonObject.getAsJsonObject("displayItem"); - int meta = jsonObject.get("meta").getAsInt(); - ResourceLocation itemid = new ResourceLocation(jsonObject.get("item").getAsString()); - ItemStack stack = new ItemStack(Item.itemRegistry.getObject(itemid), 0, meta); - if (jsonObject.has("displayName")) stack.setStackDisplayName(jsonObject.get("displayName").getAsString()); - if (jsonObject.has("skullData") && itemid.getResourcePath().equals("skull") && meta == 3) { - stack.setTagInfo("SkullOwner", getSkullTag(jsonObject.getAsJsonObject("skullData"))); - } - 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; - } - - public static NBTBase getSkullTag(JsonObject skullObject) { - NBTTagCompound skullOwner = new NBTTagCompound(); - NBTTagCompound properties = new NBTTagCompound(); - NBTTagList textures = new NBTTagList(); - NBTTagCompound value = new NBTTagCompound(); - - skullOwner.setString("Id", skullObject.get("id").getAsString()); - - value.setString("Value", skullObject.get("texture").getAsString()); - textures.appendTag(value); - - properties.setTag("textures", textures); - - skullOwner.setTag("Properties", properties); - return skullOwner; - } - - public void increaseCount(int amount) { - count += amount; - } - - public void increaseCount() { - count++; - } - - public void setCount(int count) { - this.count = count; - } - - public int getCount() { - return count; - } - - public ItemStack getDisplayStack() { - return stack; - } - - public EnumSet<Locations> getLocations() { - return locations; - } - - public String getInternalId() { - return internalId.toUpperCase(Locale.ENGLISH); - } - - public boolean isEntity() { - return isEntity; - } -} +//package com.thatgravyboat.skyblockhud.tracker; +// +//import com.google.gson.JsonObject; +//import com.thatgravyboat.skyblockhud.location.Locations; +//import java.util.EnumSet; +//import java.util.Locale; +//import net.minecraft.item.Item; +//import net.minecraft.item.ItemStack; +//import net.minecraft.nbt.NBTBase; +//import net.minecraft.nbt.NBTTagCompound; +//import net.minecraft.nbt.NBTTagList; +//import net.minecraft.util.ResourceLocation; +// +//public class TrackerObject { +// +// private final ItemStack stack; +// private final String internalId; +// private final EnumSet<Locations> locations; +// private final boolean isEntity; +// private int count; +// +// public TrackerObject(JsonObject jsonObject, EnumSet<Locations> locations) { +// this.stack = decodeToItemStack(jsonObject); +// this.internalId = jsonObject.get("id").getAsString(); +// this.isEntity = jsonObject.get("id").getAsString().contains("entity:"); +// this.locations = locations; +// } +// +// public static ItemStack decodeToItemStack(JsonObject jsonObject) { +// jsonObject = jsonObject.getAsJsonObject("displayItem"); +// int meta = jsonObject.get("meta").getAsInt(); +// ResourceLocation itemid = new ResourceLocation(jsonObject.get("item").getAsString()); +// ItemStack stack = new ItemStack(Item.itemRegistry.getObject(itemid), 0, meta); +// if (jsonObject.has("displayName")) stack.setStackDisplayName(jsonObject.get("displayName").getAsString()); +// if (jsonObject.has("skullData") && itemid.getResourcePath().equals("skull") && meta == 3) { +// stack.setTagInfo("SkullOwner", getSkullTag(jsonObject.getAsJsonObject("skullData"))); +// } +// 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; +// } +// +// public static NBTBase getSkullTag(JsonObject skullObject) { +// NBTTagCompound skullOwner = new NBTTagCompound(); +// NBTTagCompound properties = new NBTTagCompound(); +// NBTTagList textures = new NBTTagList(); +// NBTTagCompound value = new NBTTagCompound(); +// +// skullOwner.setString("Id", skullObject.get("id").getAsString()); +// +// value.setString("Value", skullObject.get("texture").getAsString()); +// textures.appendTag(value); +// +// properties.setTag("textures", textures); +// +// skullOwner.setTag("Properties", properties); +// return skullOwner; +// } +// +// public void increaseCount(int amount) { +// count += amount; +// } +// +// public void increaseCount() { +// count++; +// } +// +// public void setCount(int count) { +// this.count = count; +// } +// +// public int getCount() { +// return count; +// } +// +// public ItemStack getDisplayStack() { +// return stack; +// } +// +// public EnumSet<Locations> getLocations() { +// return locations; +// } +// +// public String getInternalId() { +// return internalId.toUpperCase(Locale.ENGLISH); +// } +// +// public boolean isEntity() { +// return isEntity; +// } +//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/utils/Utils.java b/src/main/java/com/thatgravyboat/skyblockhud/utils/Utils.java index 6b0a7528f..2dd0d291e 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/utils/Utils.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/utils/Utils.java @@ -46,12 +46,12 @@ public class Utils { return input.toLowerCase().replace(" ", "").replace(replace, ""); } - public static boolean isPlayerHoldingRedstone(EntityPlayerSP player) { - if (!LorenzMod.config.main.requireRedstone) return true; - ArrayList<Item> redstoneItems = new ArrayList<>(Arrays.asList(Items.redstone, Items.repeater, Items.comparator, Item.getByNameOrId("minecraft:redstone_torch"))); - if (player.getHeldItem() != null) return redstoneItems.contains(player.getHeldItem().getItem()); - return false; - } +// public static boolean isPlayerHoldingRedstone(EntityPlayerSP player) { +// if (!LorenzMod.config.main.requireRedstone) return true; +// ArrayList<Item> redstoneItems = new ArrayList<>(Arrays.asList(Items.redstone, Items.repeater, Items.comparator, Item.getByNameOrId("minecraft:redstone_torch"))); +// if (player.getHeldItem() != null) return redstoneItems.contains(player.getHeldItem().getItem()); +// return false; +// } public static boolean inRangeInclusive(int value, int min, int max) { return value <= max && value >= min; |