aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java1
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java13
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/api/events/SidebarLineUpdateEvent.java6
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/location/LocationCategory.java13
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java9
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/location/Locations.java40
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/location/RiftHandler.java13
7 files changed, 78 insertions, 17 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java b/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java
index 6ddfe15..e1f5adb 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java
@@ -77,6 +77,7 @@ public class SkyblockHud {
MinecraftForge.EVENT_BUS.register(new SlayerHandler());
MinecraftForge.EVENT_BUS.register(new DungeonHandler());
MinecraftForge.EVENT_BUS.register(new MinesHandler());
+ MinecraftForge.EVENT_BUS.register(new RiftHandler());
MinecraftForge.EVENT_BUS.register(new FarmingIslandHandler());
MinecraftForge.EVENT_BUS.register(new TrackerHandler());
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java b/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java
index 3c59360..5023e83 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java
@@ -1,14 +1,10 @@
package com.thatgravyboat.skyblockhud.api;
-import static com.thatgravyboat.skyblockhud.ComponentHandler.SCOREBOARD_CHARACTERS;
-
import com.thatgravyboat.skyblockhud.SkyblockHud;
import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent;
import com.thatgravyboat.skyblockhud.api.events.SidebarPostEvent;
import com.thatgravyboat.skyblockhud.api.events.SidebarPreGetEvent;
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;
@@ -18,6 +14,11 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import static com.thatgravyboat.skyblockhud.ComponentHandler.SCOREBOARD_CHARACTERS;
+
public class LeaderboardGetter {
private static Map<Integer, String> cachedScores = new HashMap<>();
@@ -43,11 +44,11 @@ public class LeaderboardGetter {
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)) {
+ Map<Integer, String> allFormattedLines = scores.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, (entry) -> SCOREBOARD_CHARACTERS.matcher(entry.getValue()).replaceAll("").trim()));
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));
+ MinecraftForge.EVENT_BUS.post(new SidebarLineUpdateEvent(name, SCOREBOARD_CHARACTERS.matcher(name).replaceAll("").trim(), score, scores.size(), scoreboard, sidebarObjective, allFormattedLines));
}
});
cachedScores = scores;
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/events/SidebarLineUpdateEvent.java b/src/main/java/com/thatgravyboat/skyblockhud/api/events/SidebarLineUpdateEvent.java
index 2737ee9..931843c 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/api/events/SidebarLineUpdateEvent.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/api/events/SidebarLineUpdateEvent.java
@@ -4,17 +4,21 @@ import net.minecraft.scoreboard.ScoreObjective;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraftforge.fml.common.eventhandler.Event;
+import java.util.Map;
+
public class SidebarLineUpdateEvent extends Event {
public String rawLine;
public String formattedLine;
public int position;
public Scoreboard scoreboard;
+ public Map<Integer, String> allFormattedLines;
public ScoreObjective objective;
- public SidebarLineUpdateEvent(String rawLine, String formattedLine, int score, int max, Scoreboard scoreboard, ScoreObjective objective) {
+ public SidebarLineUpdateEvent(String rawLine, String formattedLine, int score, int max, Scoreboard scoreboard, ScoreObjective objective, Map<Integer, String> allFormattedLines) {
this.rawLine = rawLine;
this.formattedLine = formattedLine;
+ this.allFormattedLines = allFormattedLines;
this.position = max - score;
this.scoreboard = scoreboard;
this.objective = objective;
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/LocationCategory.java b/src/main/java/com/thatgravyboat/skyblockhud/location/LocationCategory.java
index 10a98b0..7d63ed0 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/location/LocationCategory.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/location/LocationCategory.java
@@ -1,26 +1,27 @@
package com.thatgravyboat.skyblockhud.location;
-import static com.thatgravyboat.skyblockhud.handlers.MapHandler.Maps;
-
import com.thatgravyboat.skyblockhud.SkyblockHud;
import com.thatgravyboat.skyblockhud.handlers.MapHandler;
+import static com.thatgravyboat.skyblockhud.handlers.MapHandler.Maps;
+
public enum LocationCategory {
ERROR("error", 34),
- ISLAND("island", 43),
HUB("hub", 34, Maps.HUB),
+ ISLAND("island", 43),
+ PARK("park", 51, Maps.PARK),
+ JERRY("jerry", 59, Maps.JERRY),
BARN("barn", 67, Maps.BARN),
MUSHROOMDESERT("mushroomdesert", 75, Maps.MUSHROOM),
GOLDMINE("gold_mine", 83, Maps.GOLDMINE),
DEEPCAVERNS("deepcaverns", 91),
SPIDERSDEN("spiders_den", 99, Maps.SPIDERS),
- PARK("park", 51, Maps.PARK),
CRIMSON("crimson_isle", 107, Maps.CRIMSON),
DN("dungeonhub", 115, Maps.DN),
- JERRY("jerry", 59, Maps.JERRY),
THEEND("the_end", 123, Maps.THEEND),
DWARVENMINES("dwarven_mines", 131, Maps.DWARVEN),
- CRYSTALHOLLOWS("crystal_hollows", 139, Maps.CRYSTAL);
+ CRYSTALHOLLOWS("crystal_hollows", 139, Maps.CRYSTAL),
+ RIFT("rift", 147/*, TODO */);
private final String name;
private final int texturePos;
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java
index b4e63ec..299779f 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/location/LocationHandler.java
@@ -11,7 +11,7 @@ public class LocationHandler {
private static Locations currentLocation = Locations.NONE;
- public static void handleLocation(String locationLine, boolean isGuesting) {
+ public static void handleLocation(String locationLine, boolean isGuesting, boolean isRift) {
String location = locationLine.replace(" ", "")
.toUpperCase(Locale.ENGLISH).trim()
.replaceAll("[^A-Za-z0-9]", "");
@@ -27,6 +27,8 @@ public class LocationHandler {
locations = Locations.GUESTISLAND;
} else if (isPlot) {
locations = Locations.THEGARDEN;
+ } else if (isRift) {
+ locations = Locations.get("RIFT_" + location);
} else {
locations = Locations.get(location);
}
@@ -45,10 +47,11 @@ public class LocationHandler {
@SubscribeEvent
public void onSidebarLineUpdate(SidebarLineUpdateEvent event) {
- if (event.rawLine.contains("\u23E3")) {
+ boolean isRift = event.rawLine.contains("ф");
+ if (event.rawLine.contains("⏣") || isRift) {
String objectiveName = event.objective.getDisplayName().replaceAll("(?i)\\u00A7.", "");
boolean isGuesting = objectiveName.toLowerCase(Locale.ENGLISH).endsWith("guest");
- LocationHandler.handleLocation(event.formattedLine, isGuesting);
+ LocationHandler.handleLocation(event.formattedLine, isGuesting, isRift);
}
}
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/Locations.java b/src/main/java/com/thatgravyboat/skyblockhud/location/Locations.java
index ebe03bf..21370a4 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/location/Locations.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/location/Locations.java
@@ -194,7 +194,45 @@ public enum Locations {
THEDUKEDOM("dukedom", "The Dukedom", LocationCategory.CRIMSON),
THRONEROOM("throneroom", "Throne Room", LocationCategory.CRIMSON),
CHIEFSHUT("chiefshut", "Chief's Hut", LocationCategory.CRIMSON),
- IGRUPANSCHICKENCOOP("igrupancoop", "Igrupan's Chicken Coop", LocationCategory.CRIMSON);
+ IGRUPANSCHICKENCOOP("igrupancoop", "Igrupan's Chicken Coop", LocationCategory.CRIMSON),
+
+ // RIFT
+ RIFT_WIZARDTOWER("wizardtower", "Wizard Tower", LocationCategory.RIFT),
+ RIFT_RIFTGALLERYENTRANCE("riftgalleryentrance", "Rift Gallery Entrance", LocationCategory.RIFT),
+ RIFT_RIFTGALLERY("riftgallery", "Rift Gallery", LocationCategory.RIFT),
+ RIFT_WYLDWOODS("wyldwoods", "Wyld Woods", LocationCategory.RIFT),
+ RIFT_THEBASTION("thebastion", "The Bastion", LocationCategory.RIFT),
+ RIFT_OTHERSIDE("otherside", "Otherside", LocationCategory.RIFT),
+ RIFT_SHIFTEDTAVERN("shiftedtavern", "Shifted Tavern", LocationCategory.RIFT),
+ RIFT_BROKENCAGE("brokencage", "Broken Cage", LocationCategory.RIFT),
+ RIFT_COLOSSEUM("colosseum", "Colosseum", LocationCategory.RIFT),
+ RIFT_AROUNDCOLOSSEUM("aroundcolosseum", "Around Colosseum", LocationCategory.RIFT),
+ RIFT_BLACKLAGOON("blacklagoon", "Black Lagoon", LocationCategory.RIFT),
+ RIFT_LAGOONCAVE("lagooncave", "Lagoon Cave", LocationCategory.RIFT),
+ RIFT_LAGOONHUT("lagoonhut", "Lagoon Hut", LocationCategory.RIFT),
+ RIFT_DREADFARM("dreadfarm", "Dreadfarm", LocationCategory.RIFT),
+ RIFT_WESTVILLAGE("westvillage", "West Village", LocationCategory.RIFT),
+ RIFT_LONELYTERRACE("lonelyterrace", "Lonely Terrace", LocationCategory.RIFT),
+ RIFT_VILLAGEPLAZA("villageplaza", "Village Plaza", LocationCategory.RIFT),
+ RIFT_TAYLORS("taylors", "Taylor's", LocationCategory.RIFT),
+ RIFT_BARRYCENTER("barrycenter", "Barry Center", LocationCategory.RIFT),
+ RIFT_INFESTEDHOUSE("infestedhouse", "Infested House", LocationCategory.RIFT),
+ RIFT_BOOKINABOOK("bookinabook","Book in a Book", LocationCategory.RIFT),
+ RIFT_HALFEATENCAVE("halfeatencave","Half-Eaten Cave", LocationCategory.RIFT),
+ RIFT_BARRYHQ("barryhq","Barry HQ", LocationCategory.RIFT),
+ RIFT_BARRIERSTREET("barrierstreet","Barrier Street", LocationCategory.RIFT),
+ RIFT_EMPTYBANK("emptybank","Empty Bank", LocationCategory.RIFT),
+ RIFT_YOURISLAND("yourisland","\"Your\" Island", LocationCategory.RIFT),
+ RIFT_MIRRORVERSE("mirrorverse","Mirrorverse", LocationCategory.RIFT),
+ RIFT_STILLGORECHTEAU("stillgorechateau","Stillgore Château", LocationCategory.RIFT),
+ RIFT_OUBLIETTE("oubliette","Oubliette", LocationCategory.RIFT),
+ RIFT_DJVUALLEY("dejavualley","Déjà Vu Alley", LocationCategory.RIFT),
+ RIFT_LIVINGCAVE("livingcave","Living Cave", LocationCategory.RIFT),
+ RIFT_LIVINGSTILLNESS("livingstillness","Living Stillness", LocationCategory.RIFT),
+ RIFT_PHOTONPATHWAY("photonpathway","Photon Pathway", LocationCategory.RIFT),
+ RIFT_MURDERHOUSE("murderhouse","Murder House", LocationCategory.RIFT),
+ ;
+
private final String name;
private final String displayName;
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/RiftHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/RiftHandler.java
new file mode 100644
index 0000000..dfd225e
--- /dev/null
+++ b/src/main/java/com/thatgravyboat/skyblockhud/location/RiftHandler.java
@@ -0,0 +1,13 @@
+package com.thatgravyboat.skyblockhud.location;
+
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+
+public class RiftHandler {
+ @SubscribeEvent
+ public void onActionBar(ClientChatReceivedEvent event) {
+ if (event.type != 2) return;
+ // §741m30sф Left §b160/160✎ Mana
+ }
+
+}