aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java
diff options
context:
space:
mode:
authorBuildTools <james.jenour@protonmail.com>2021-02-05 03:52:39 +0800
committerBuildTools <james.jenour@protonmail.com>2021-02-05 03:52:39 +0800
commitc40f8e737c62c8dadef294f8621716529d354796 (patch)
tree3f0fb8be376d09e4fa1a7d95da0624359d8f67b1 /src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java
parent5ea3130efceca3148334a613471cec7f22acdf8c (diff)
downloadnotenoughupdates-c40f8e737c62c8dadef294f8621716529d354796.tar.gz
notenoughupdates-c40f8e737c62c8dadef294f8621716529d354796.tar.bz2
notenoughupdates-c40f8e737c62c8dadef294f8621716529d354796.zip
PRE15
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java
index e206fdcc..96efe962 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java
@@ -1,7 +1,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.overlays.CommissionOverlay;
+import io.github.moulberry.notenoughupdates.overlays.MiningOverlay;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -29,6 +29,8 @@ import org.lwjgl.util.vector.Vector3f;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
public class DwarvenMinesWaypoints {
@@ -88,16 +90,23 @@ public class DwarvenMinesWaypoints {
}
}
- private long powderGhastMillis = 0;
- private String powderGhastLocation = null;
- private final String ghastString = "\u00A7r\u00A7eFind the \u00A7r\u00A76Powder Ghast\u00A7r\u00A7e near the \u00A7r\u00A7b";
+ private long dynamicMillis = 0;
+ private String dynamicLocation = null;
+ private final Pattern ghastRegex = Pattern.compile("\u00A7r\u00A7eFind the \u00A7r\u00A76Powder Ghast\u00A7r\u00A7e near the \u00A7r\u00A7b(.+)!");
+ private final Pattern fallenStarRegex = Pattern.compile("\u00A7r\u00A75Fallen Star \u00A7r\u00A7ehas crashed at \u00A7r\u00A7b(.+)\u00A7r\u00A7e!");
@SubscribeEvent
public void onChat(ClientChatReceivedEvent event) {
- if(event.message.getFormattedText().startsWith(ghastString)) {
- String sub = event.message.getFormattedText().substring(ghastString.length());
- powderGhastLocation = Utils.cleanColour(sub).replace("!", "").trim();
- powderGhastMillis = System.currentTimeMillis();
+ Matcher matcherGhast = ghastRegex.matcher(event.message.getFormattedText());
+ if(matcherGhast.find()) {
+ dynamicLocation = Utils.cleanColour(matcherGhast.group(1).trim());
+ dynamicMillis = System.currentTimeMillis();
+ } else {
+ Matcher matcherStar = fallenStarRegex.matcher(event.message.getFormattedText());
+ if(matcherStar.find()) {
+ dynamicLocation = Utils.cleanColour(matcherStar.group(1).trim());
+ dynamicMillis = System.currentTimeMillis();
+ }
}
}
@@ -176,10 +185,10 @@ public class DwarvenMinesWaypoints {
int locWaypoint = NotEnoughUpdates.INSTANCE.config.mining.locWaypoints;
- if(powderGhastLocation != null &&
- System.currentTimeMillis() - powderGhastMillis < 30*1000) {
+ if(dynamicLocation != null &&
+ System.currentTimeMillis() - dynamicMillis < 30*1000) {
for(Map.Entry<String, Vector3f> entry : waypointsMap.entrySet()) {
- if(entry.getKey().equals(powderGhastLocation)) {
+ if(entry.getKey().equals(dynamicLocation)) {
renderWayPoint(EnumChatFormatting.GOLD+"Powder Ghast",
new Vector3f(entry.getValue()).translate(0, 15, 0), event.partialTicks);
break;
@@ -192,7 +201,7 @@ public class DwarvenMinesWaypoints {
if(locWaypoint >= 2) {
renderWayPoint(EnumChatFormatting.AQUA+entry.getKey(), entry.getValue(), event.partialTicks);
} else {
- for(String commissionName : CommissionOverlay.commissionProgress.keySet()) {
+ for(String commissionName : MiningOverlay.commissionProgress.keySet()) {
if(commissionName.toLowerCase().contains(entry.getKey().toLowerCase())) {
if(commissionName.contains("Titanium")) {
renderWayPoint(EnumChatFormatting.WHITE+entry.getKey(), entry.getValue(), event.partialTicks);
@@ -210,7 +219,7 @@ public class DwarvenMinesWaypoints {
if(NotEnoughUpdates.INSTANCE.config.mining.emissaryWaypoints == 0) return;
if(!commissionFinished) {
- for(float f : CommissionOverlay.commissionProgress.values()) {
+ for(float f : MiningOverlay.commissionProgress.values()) {
if (f >= 1) {
commissionFinished = true;
break;