Fix duplicate waypoint issues and bad bed positions
This commit is contained in:
parent
18a9206058
commit
00b0266c43
@ -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()));
|
||||
}
|
||||
}
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user