mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-30 04:09:09 +00:00
Fix tracked merge history npe
This commit is contained in:
@@ -55,9 +55,13 @@ public final class TrackedMergeHistory {
|
||||
@Contract("_, false -> _; _, true -> !null")
|
||||
private @Nullable PositionHistory getHistory(final Entity entity, final boolean create) {
|
||||
final long position = entity.getPackedOriginPosition();
|
||||
return this.historyMap.computeIfAbsent(position, p -> {
|
||||
return create ? new PositionHistory(entity.level().getGameTime()) : null;
|
||||
});
|
||||
PositionHistory history = this.historyMap.get(position);
|
||||
//noinspection ConstantValue
|
||||
if (create && history == null) {
|
||||
history = new PositionHistory(entity.level().getGameTime());
|
||||
this.historyMap.put(position, history);
|
||||
}
|
||||
return history;
|
||||
}
|
||||
|
||||
private static final class PositionHistory {
|
||||
|
||||
Reference in New Issue
Block a user