Skip to content

Commit

Permalink
reset on new lobby (#664)
Browse files Browse the repository at this point in the history
reset saved locations when the lobby changes so it dose not break
  • Loading branch information
olim88 authored Apr 22, 2024
1 parent abf64d3 commit e5b5c50
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import de.hysky.skyblocker.utils.Utils;
import de.hysky.skyblocker.utils.render.RenderHelper;
import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
import net.minecraft.client.MinecraftClient;
Expand Down Expand Up @@ -90,6 +91,7 @@ public class MetalDetector {
public static void init() {
ClientReceiveMessageEvents.GAME.register(MetalDetector::getDistanceMessage);
WorldRenderEvents.AFTER_TRANSLUCENT.register(MetalDetector::render);
ClientPlayConnectionEvents.JOIN.register((_handler, _sender, _client) -> reset());
}

/**
Expand Down Expand Up @@ -223,6 +225,11 @@ private static void findCenterOfMines() {
}
}

private static void reset() {
minesCenter = null;
possibleBlocks = new ArrayList<>();
}

/**
* Renders waypoints for the location of treasure or possible treasure.
* @param context world render context
Expand Down

0 comments on commit e5b5c50

Please sign in to comment.