From 86d415cee324193ab6f0a28a26920bbec17fc784 Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Sun, 10 Nov 2024 02:30:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0cannon=E7=9A=84=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E8=A1=80=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/net/mcreator/superbwarfare/entity/Mk42Entity.java | 6 +++++- .../net/mcreator/superbwarfare/entity/Mle1934Entity.java | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/mcreator/superbwarfare/entity/Mk42Entity.java b/src/main/java/net/mcreator/superbwarfare/entity/Mk42Entity.java index 1fd6a56e9..9259e03f3 100644 --- a/src/main/java/net/mcreator/superbwarfare/entity/Mk42Entity.java +++ b/src/main/java/net/mcreator/superbwarfare/entity/Mk42Entity.java @@ -79,7 +79,11 @@ public class Mk42Entity extends Entity implements GeoEntity, ICannonEntity { public void readAdditionalSaveData(CompoundTag compound) { this.entityData.set(COOL_DOWN, compound.getInt("CoolDown")); this.entityData.set(TYPE, compound.getInt("Type")); - this.entityData.set(HEALTH, compound.getFloat("Health")); + if (compound.contains("Health")) { + this.entityData.set(HEALTH, compound.getFloat("Health")); + } else { + this.entityData.set(HEALTH, MAX_HEALTH); + } } @Override diff --git a/src/main/java/net/mcreator/superbwarfare/entity/Mle1934Entity.java b/src/main/java/net/mcreator/superbwarfare/entity/Mle1934Entity.java index 85e97512e..f315b6716 100644 --- a/src/main/java/net/mcreator/superbwarfare/entity/Mle1934Entity.java +++ b/src/main/java/net/mcreator/superbwarfare/entity/Mle1934Entity.java @@ -85,7 +85,11 @@ public class Mle1934Entity extends Entity implements GeoEntity, ICannonEntity { public void readAdditionalSaveData(CompoundTag compound) { this.entityData.set(COOL_DOWN, compound.getInt("CoolDown")); this.entityData.set(TYPE, compound.getInt("Type")); - this.entityData.set(HEALTH, compound.getFloat("Health")); + if (compound.contains("Health")) { + this.entityData.set(HEALTH, compound.getFloat("Health")); + } else { + this.entityData.set(HEALTH, MAX_HEALTH); + } } @Override