The EntityPositionTracker now returns copies of its values to prevent them from being changed
This commit is contained in:
@@ -71,6 +71,10 @@ public class AdvancedPosition extends Position {
|
|||||||
this.roll = toApply.getRoll();
|
this.roll = toApply.getRoll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AdvancedPosition copy() {
|
||||||
|
return new AdvancedPosition(x, y, z, pitch, yaw, roll);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AdvancedPosition newInstance() {
|
public AdvancedPosition newInstance() {
|
||||||
return new AdvancedPosition();
|
return new AdvancedPosition();
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public class EntityPositionTracker {
|
|||||||
for(Pair<Integer, AdvancedPosition> pair : positions) {
|
for(Pair<Integer, AdvancedPosition> pair : positions) {
|
||||||
if(pair.getKey() <= timestamp) exists = true;
|
if(pair.getKey() <= timestamp) exists = true;
|
||||||
if(pair.getKey() >= timestamp) {
|
if(pair.getKey() >= timestamp) {
|
||||||
if(exists) return pair.getValue();
|
if(exists) return pair.getValue().copy();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user