添加C4保存owner的功能

This commit is contained in:
17146 2025-03-22 00:57:21 +08:00
parent 67680ba809
commit ca8e5899f0

View file

@ -79,6 +79,7 @@ public class C4Entity extends Projectile implements GeoEntity {
@Override @Override
public void addAdditionalSaveData(CompoundTag compound) { public void addAdditionalSaveData(CompoundTag compound) {
super.addAdditionalSaveData(compound);
compound.putString("Target", this.entityData.get(TARGET_UUID)); compound.putString("Target", this.entityData.get(TARGET_UUID));
compound.putString("LastAttacker", this.entityData.get(LAST_ATTACKER_UUID)); compound.putString("LastAttacker", this.entityData.get(LAST_ATTACKER_UUID));
compound.putBoolean("IsControllable", this.entityData.get(IS_CONTROLLABLE)); compound.putBoolean("IsControllable", this.entityData.get(IS_CONTROLLABLE));
@ -90,6 +91,7 @@ public class C4Entity extends Projectile implements GeoEntity {
@Override @Override
public void readAdditionalSaveData(CompoundTag compound) { public void readAdditionalSaveData(CompoundTag compound) {
super.readAdditionalSaveData(compound);
if (compound.contains("LastAttacker")) { if (compound.contains("LastAttacker")) {
this.entityData.set(LAST_ATTACKER_UUID, compound.getString("LastAttacker")); this.entityData.set(LAST_ATTACKER_UUID, compound.getString("LastAttacker"));
} }