From 682b7c3bc5efada590be2ef0c2fcfd10b53438dd Mon Sep 17 00:00:00 2001 From: Atsuishio <842960157@qq.com> Date: Thu, 3 Apr 2025 01:31:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DXY100=E5=90=83=E7=82=AE?= =?UTF-8?q?=E5=BC=B9=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?BMP2=E6=B2=89=E5=BA=95=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E6=94=B9=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- .../entity/vehicle/Bmp2Entity.java | 4 +++ .../entity/vehicle/Yx100Entity.java | 29 ++++++++++++++----- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/gradle.properties b/gradle.properties index 39d2400a4..0aa53e4f0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,7 +16,7 @@ mod_id=superbwarfare mod_name=Superb Warfare mod_license=GNU General Public License v3.0 mod_description=A Warfare Mod -mod_version=0.7.0 +mod_version=0.7.1 mod_authors=Atsuishio, Roki27, Light_Quanta # dependencies jei_version=19.21.0.247 diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java index 43778a9d1..a227c2cbd 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java @@ -199,6 +199,10 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit this.handleAmmo(); } + double fluidFloat; + fluidFloat = 0.052 * getSubmergedHeight(this); + this.setDeltaMovement(this.getDeltaMovement().add(0.0, fluidFloat, 0.0)); + if (this.onGround()) { float f0 = 0.54f + 0.25f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90; this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).normalize().scale(0.05 * this.getDeltaMovement().horizontalDistance()))); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java index 78f2cc500..0d9caa153 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java @@ -244,7 +244,16 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti } if (this.level() instanceof ServerLevel) { - if (reloadCoolDown > 0 && this.entityData.get(AMMO) > 0) { + boolean hasCreativeAmmo = false; + + if (this.getFirstPassenger() instanceof Player player) { + hasCreativeAmmo = InventoryTool.hasCreativeAmmoBox(player); + } + + if (reloadCoolDown > 0 && ( + (entityData.get(LOADED_AMMO_TYPE) == 0 && (hasCreativeAmmo || countItem(ModItems.AP_5_INCHES.get()) > 0)) || + (entityData.get(LOADED_AMMO_TYPE) == 1 && (hasCreativeAmmo || countItem(ModItems.HE_5_INCHES.get()) > 0)) + )) { reloadCoolDown--; } this.handleAmmo(); @@ -308,14 +317,18 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti && (hasCreativeAmmo || hasItem(getWeapon(0).ammo)) ) { - if (entityData.get(LOADED_AMMO_TYPE) == 0) { + if (entityData.get(LOADED_AMMO_TYPE) == 0 && entityData.get(LOADED_AP) == 0) { this.entityData.set(LOADED_AP, 1); - } else if (entityData.get(LOADED_AMMO_TYPE) == 1) { - this.entityData.set(LOADED_HE, 1); + if (!hasCreativeAmmo) { + consumeItem(ModItems.AP_5_INCHES.get(), 1); + } } - if (!hasCreativeAmmo) { - consumeItem(getWeapon(0).ammo, 1); + if (entityData.get(LOADED_AMMO_TYPE) == 1 && entityData.get(LOADED_HE) == 0) { + this.entityData.set(LOADED_HE, 1); + if (!hasCreativeAmmo) { + consumeItem(ModItems.HE_5_INCHES.get(), 1); + } } } } @@ -966,14 +979,14 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti if (typeIndex != 2) { if (entityData.get(LOADED_AP) > 0 && typeIndex == 1) { if (this.getFirstPassenger() instanceof Player player && !InventoryTool.hasCreativeAmmoBox(player)) { - this.insertItem(getWeapon(0).ammo, 1); + this.insertItem(ModItems.AP_5_INCHES.get(), 1); } entityData.set(LOADED_AP, 0); } if (entityData.get(LOADED_HE) > 0 && typeIndex == 0) { if (this.getFirstPassenger() instanceof Player player && !InventoryTool.hasCreativeAmmoBox(player)) { - this.insertItem(getWeapon(0).ammo, 1); + this.insertItem(ModItems.HE_5_INCHES.get(), 1); } entityData.set(LOADED_HE, 0); }