Skip to content

Commit

Permalink
Merge branch '1.20.1' into 1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rfresh2 committed Sep 6, 2024
2 parents 877439c + f3a1c74 commit ad2db76
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions common/src/main/java/xaeroplus/module/impl/BaritoneGoalSync.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public void onClientTickEvent(final ClientTickEvent.Post event) {
if (minimapSession == null) return;
MinimapWorld currentWorld = minimapSession.getWorldManager().getCurrentWorld();
if (currentWorld == null) return;
WaypointSet currentWpSet = currentWorld.getCurrentWaypointSet();
if (currentWpSet == null) return;
try {
final Goal goal = BaritoneGoalHelper.getBaritoneGoal();
if (goal == null) {
Expand All @@ -62,10 +64,11 @@ public void onClientTickEvent(final ClientTickEvent.Post event) {
baritoneGoalPos = new WeakReference<>(baritoneGoalBlockPos);
}

if (baritoneWpMinimapWorldRef.get() == null || currentWorld != baritoneWpMinimapWorldRef.get()) {
Waypoint baritoneWp = this.baritoneWpRef.get();
WaypointSet waypointSet = baritoneWpSetRef.get();
if (waypointSet != null && baritoneWp != null) waypointSet.remove(baritoneWp);
if (baritoneWpMinimapWorldRef.get() == null || currentWorld != baritoneWpMinimapWorldRef.get()
|| baritoneWpSetRef.get() == null || baritoneWpSetRef.get() != currentWpSet) {
if (baritoneWpSetRef.get() != null && baritoneWpRef.get() != null) {
baritoneWpSetRef.get().remove(baritoneWpRef.get());
}
baritoneWpRef = nullRef;
initBaritoneWpWorld(currentWorld);
}
Expand Down Expand Up @@ -116,7 +119,7 @@ private double getBaritoneWpDimDiv() {

private void initBaritoneWpWorld(final MinimapWorld currentWorld) {
baritoneWpMinimapWorldRef = new WeakReference<>(currentWorld);
WaypointSet waypointSet = baritoneWpMinimapWorldRef.get().getWaypointSet("gui.xaero_default");
WaypointSet waypointSet = baritoneWpMinimapWorldRef.get().getCurrentWaypointSet();
baritoneWpSetRef = new WeakReference<>(waypointSet);
}

Expand Down

0 comments on commit ad2db76

Please sign in to comment.