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
19678b2f83
commit
27a5297e0e
1 file changed
+17
-13
@@ -129,20 +129,24 @@ 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())) {
|
||||||
existingEntity.restoreFrom(pendingEntity);
|
try {
|
||||||
existingEntity.setPos(pendingEntity.getX(), pendingEntity.getY(), pendingEntity.getZ());
|
existingEntity.restoreFrom(pendingEntity);
|
||||||
existingEntity.setXRot(pendingEntity.getXRot());
|
existingEntity.setPos(pendingEntity.getX(), pendingEntity.getY(), pendingEntity.getZ());
|
||||||
existingEntity.setYRot(pendingEntity.getYRot());
|
existingEntity.setXRot(pendingEntity.getXRot());
|
||||||
existingEntity.setYHeadRot(pendingEntity.getYHeadRot());
|
existingEntity.setYRot(pendingEntity.getYRot());
|
||||||
existingEntity.setDeltaMovement(pendingEntity.getDeltaMovement());
|
existingEntity.setYHeadRot(pendingEntity.getYHeadRot());
|
||||||
existingEntity.hasImpulse = pendingEntity.hasImpulse;
|
existingEntity.setDeltaMovement(pendingEntity.getDeltaMovement());
|
||||||
if (pendingEntity instanceof LivingEntity pendingLiving) {
|
existingEntity.hasImpulse = pendingEntity.hasImpulse;
|
||||||
existingEntity.setYBodyRot(pendingLiving.yBodyRot);
|
if (pendingEntity instanceof LivingEntity pendingLiving) {
|
||||||
|
existingEntity.setYBodyRot(pendingLiving.yBodyRot);
|
||||||
|
}
|
||||||
|
for (SynchedEntityData.DataItem<?> dataItem : pendingEntity.getEntityData().itemsById) {
|
||||||
|
existingEntity.getEntityData().set((EntityDataAccessor) dataItem.getAccessor(), dataItem.getValue());
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
existingEntity.discard();
|
||||||
}
|
}
|
||||||
for (SynchedEntityData.DataItem<?> dataItem : pendingEntity.getEntityData().itemsById) {
|
|
||||||
existingEntity.getEntityData().set((EntityDataAccessor) dataItem.getAccessor(), dataItem.getValue());
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
} else {
|
} else {
|
||||||
existingEntity.discard();
|
existingEntity.discard();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user