aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky/skyblocker
diff options
context:
space:
mode:
authorolim <bobq4582@gmail.com>2024-07-01 15:31:27 +0100
committerolim <bobq4582@gmail.com>2024-07-15 12:38:00 +0100
commitf486e1171a41e22d041f2c10c42d2831fd7b7311 (patch)
tree9319737f26a7fa186b67184f676e43efa8ffb671 /src/main/java/de/hysky/skyblocker
parent8c14a57681e0fabb113b51e4c066c2b4ddf8ab03 (diff)
downloadSkyblocker-f486e1171a41e22d041f2c10c42d2831fd7b7311.tar.gz
Skyblocker-f486e1171a41e22d041f2c10c42d2831fd7b7311.tar.bz2
Skyblocker-f486e1171a41e22d041f2c10c42d2831fd7b7311.zip
look for failed message in chat and reset with it
Diffstat (limited to 'src/main/java/de/hysky/skyblocker')
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/dwarven/WishingCompassSolver.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/WishingCompassSolver.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/WishingCompassSolver.java
index f028e3e7..84cd4803 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/WishingCompassSolver.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/WishingCompassSolver.java
@@ -4,6 +4,7 @@ import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.skyblock.tabhud.util.PlayerListMgr;
import de.hysky.skyblocker.utils.Constants;
import de.hysky.skyblocker.utils.Utils;
+import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
import net.fabricmc.fabric.api.event.player.UseBlockCallback;
import net.fabricmc.fabric.api.event.player.UseItemCallback;
@@ -87,9 +88,21 @@ public class WishingCompassSolver {
public static void init() {
UseItemCallback.EVENT.register(WishingCompassSolver::onItemInteract);
UseBlockCallback.EVENT.register(WishingCompassSolver::onBlockInteract);
+ ClientReceiveMessageEvents.GAME.register(WishingCompassSolver::failMessageListener);
ClientPlayConnectionEvents.JOIN.register((_handler, _sender, _client) -> reset());
}
+ /**
+ * When a filed message is sent in chat reset the wishing compass solver to start
+ * @param text message
+ * @param b overlay
+ */
+ private static void failMessageListener(Text text, boolean b) {
+ if (Formatting.strip(text.getString()).equals("The Wishing Compass can't seem to locate anything!")) {
+ currentState = SolverStates.NOT_STARTED;
+ }
+ }
+
private static void reset() {
currentState = SolverStates.NOT_STARTED;
startPosOne = Vec3d.ZERO;