diff options
Diffstat (limited to 'src/main/java/com')
93 files changed, 9250 insertions, 0 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/ComponentBuilder.java b/src/main/java/com/thatgravyboat/skyblockhud/ComponentBuilder.java new file mode 100644 index 0000000..e5299d5 --- /dev/null +++ b/src/main/java/com/thatgravyboat/skyblockhud/ComponentBuilder.java @@ -0,0 +1,55 @@ +package com.thatgravyboat.skyblockhud; + +public class ComponentBuilder { + + public StringBuilder builder; + + public ComponentBuilder(){ + this.builder = new StringBuilder(); + } + + public ComponentBuilder apd(String text) { + return apd(text, '7'); + } + + public ComponentBuilder apd(String text, char[] colors) { + for (char color: colors) { + builder.append("\u00A7").append(color); + } + builder.append(text).append("\u00A7").append('r'); + return this; + } + + public ComponentBuilder apd(String text, char color) { + builder.append("\u00A7").append(color).append(text).append("\u00A7").append('r'); + return this; + } + + public ComponentBuilder nl(){ + builder.append("\n"); + return this; + } + + public ComponentBuilder nl(String text, char color){ + apd(text, color); + builder.append("\n"); + return this; + } + + public ComponentBuilder nl(String text, char[] colors){ + apd(text, colors); + builder.append("\n"); + return this; + } + + public ComponentBuilder nl(String text){ + apd(text); + builder.append("\n"); + return this; + } + + public String build() { + return builder.toString(); + } + +} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java new file mode 100644 index 0000000..3c671f0 --- /dev/null +++ b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java @@ -0,0 +1,124 @@ +package com.thatgravyboat.skyblockhud; + +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 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; + +import java.util.Comparator; +import java.util.List; +import java.util.regex.Pattern; + +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 = !SkyblockHud.hasSkyblockScoreboard() || !SkyblockHud.config.misc.hideScoreboard; + if (players != null && SkyblockHud.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().equals(LocationCategory.DWARVENMINES)){ + if (formattedTabListPlayer.toLowerCase().contains("mithril powder:")){ + DwarvenMineHandler.parseMithril(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(""); + 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) { + |
