Merge branch 'master' of github.com:cabaletta/baritone
This commit is contained in:
commit
e9308d7e70
@ -32,7 +32,7 @@ import java.util.Map;
|
||||
public class Waypoint {
|
||||
public final String name;
|
||||
public final Tag tag;
|
||||
public final long creationTimestamp;
|
||||
private final long creationTimestamp;
|
||||
public final BlockPos location;
|
||||
|
||||
public Waypoint(String name, Tag tag, BlockPos location) {
|
||||
|
@ -79,11 +79,11 @@ public class Waypoints {
|
||||
try (
|
||||
FileOutputStream fileOut = new FileOutputStream(fileName.toFile());
|
||||
BufferedOutputStream bufOut = new BufferedOutputStream(fileOut);
|
||||
DataOutputStream out = new DataOutputStream(bufOut);
|
||||
DataOutputStream out = new DataOutputStream(bufOut)
|
||||
) {
|
||||
for (Waypoint waypoint : waypoints.get(tag)) {
|
||||
out.writeUTF(waypoint.name);
|
||||
out.writeLong(waypoint.creationTimestamp);
|
||||
out.writeLong(waypoint.creationTimestamp());
|
||||
out.writeInt(waypoint.location.getX());
|
||||
out.writeInt(waypoint.location.getY());
|
||||
out.writeInt(waypoint.location.getZ());
|
||||
@ -98,14 +98,8 @@ public class Waypoints {
|
||||
}
|
||||
|
||||
public Waypoint getMostRecentByTag(Waypoint.Tag tag) {
|
||||
Set<Waypoint> pts = waypoints.get(tag);
|
||||
Waypoint best = null;
|
||||
for (Waypoint waypoint : pts) {
|
||||
if (best == null || waypoint.creationTimestamp > best.creationTimestamp) {
|
||||
best = waypoint;
|
||||
}
|
||||
}
|
||||
return best;
|
||||
// Find a waypoint of the given tag which has the greatest timestamp value, indicating the most recent
|
||||
return this.waypoints.get(tag).stream().min(Comparator.comparingLong(w -> -w.creationTimestamp())).orElse(null);
|
||||
}
|
||||
|
||||
public void addWaypoint(Waypoint waypoint) {
|
||||
|
Loading…
Reference in New Issue
Block a user