mirror of
https://github.com/darksaid98/Flashback.git
synced 2026-12-03 14:38:50 +00:00
Add try catch around existingEntity restoration, fallback to discarding and respawning
This commit is contained in:
1 parent
d192fbd88d
commit
892726b0b7
1 file changed
+4
@@ -146,6 +146,7 @@ public class ReplayGamePacketHandler implements ClientGamePacketListener {
|
|||||||
if (existingEntity instanceof ServerPlayer existingPlayer) {
|
if (existingEntity instanceof ServerPlayer existingPlayer) {
|
||||||
existingPlayer.discard();
|
existingPlayer.discard();
|
||||||
} else if (existingEntity.getType().equals(pendingEntity.getType())) {
|
} else if (existingEntity.getType().equals(pendingEntity.getType())) {
|
||||||
|
try {
|
||||||
existingEntity.restoreFrom(pendingEntity);
|
existingEntity.restoreFrom(pendingEntity);
|
||||||
existingEntity.setPos(pendingEntity.getX(), pendingEntity.getY(), pendingEntity.getZ());
|
existingEntity.setPos(pendingEntity.getX(), pendingEntity.getY(), pendingEntity.getZ());
|
||||||
existingEntity.setXRot(pendingEntity.getXRot());
|
existingEntity.setXRot(pendingEntity.getXRot());
|
||||||
@@ -160,6 +161,9 @@ public class ReplayGamePacketHandler implements ClientGamePacketListener {
|
|||||||
existingEntity.getEntityData().set((EntityDataAccessor) dataItem.getAccessor(), dataItem.getValue());
|
existingEntity.getEntityData().set((EntityDataAccessor) dataItem.getAccessor(), dataItem.getValue());
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
existingEntity.discard();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
existingEntity.discard();
|
existingEntity.discard();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user