From 00b0266c436b5ee4e2a466db246d9b31d89cee47 Mon Sep 17 00:00:00 2001 From: Brady Date: Thu, 23 Aug 2018 19:39:04 -0500 Subject: [PATCH] Fix duplicate waypoint issues and bad bed positions --- .../baritone/behavior/impl/LocationTrackingBehavior.java | 8 ++------ src/main/java/baritone/chunk/Waypoint.java | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main/java/baritone/behavior/impl/LocationTrackingBehavior.java b/src/main/java/baritone/behavior/impl/LocationTrackingBehavior.java index a6128ce9..b4caa766 100644 --- a/src/main/java/baritone/behavior/impl/LocationTrackingBehavior.java +++ b/src/main/java/baritone/behavior/impl/LocationTrackingBehavior.java @@ -42,16 +42,12 @@ public final class LocationTrackingBehavior extends Behavior { @Override public void onBlockInteract(BlockInteractEvent event) { if (event.getType() == BlockInteractEvent.Type.USE && BlockStateInterface.getBlock(event.getPos()) instanceof BlockBed) { - createWaypointAtPlayer("bed", Waypoint.Tag.BED); + WorldProvider.INSTANCE.getCurrentWorld().waypoints.addWaypoint(new Waypoint("bed", Waypoint.Tag.BED, event.getPos())); } } @Override public void onPlayerDeath() { - createWaypointAtPlayer("death", Waypoint.Tag.DEATH); - } - - private void createWaypointAtPlayer(String name, Waypoint.Tag tag) { - WorldProvider.INSTANCE.getCurrentWorld().waypoints.addWaypoint(new Waypoint(name, tag, playerFeet())); + WorldProvider.INSTANCE.getCurrentWorld().waypoints.addWaypoint(new Waypoint("death", Waypoint.Tag.DEATH, playerFeet())); } } diff --git a/src/main/java/baritone/chunk/Waypoint.java b/src/main/java/baritone/chunk/Waypoint.java index aa800907..091c958c 100644 --- a/src/main/java/baritone/chunk/Waypoint.java +++ b/src/main/java/baritone/chunk/Waypoint.java @@ -55,12 +55,12 @@ public class Waypoint { return false; } Waypoint w = (Waypoint) o; - return name.equals(w.name) && tag == w.tag && creationTimestamp == w.creationTimestamp && location.equals(w.location); + return name.equals(w.name) && tag == w.tag && location.equals(w.location); } @Override public int hashCode() { - return name.hashCode() + tag.hashCode() + (int) creationTimestamp + location.hashCode(); //lol + return name.hashCode() + tag.hashCode() + location.hashCode(); //lol } public long creationTimestamp() {