From f876137e17d534b64368c40934221e04945a3994 Mon Sep 17 00:00:00 2001 From: Atsuishio <842960157@qq.com> Date: Wed, 9 Jul 2025 22:01:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=81=AB=E7=82=AE=E6=97=A0=E4=BA=BA=E6=97=B6?= =?UTF-8?q?=E4=B8=8D=E5=88=A4=E6=96=AD=E7=8E=A9=E5=AE=B6=E8=83=8C=E5=8C=85?= =?UTF-8?q?=E5=BC=B9=E8=8D=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/vehicle/Mk42Entity.java | 2 +- .../entity/vehicle/Mle1934Entity.java | 20 +++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java index 57545297b..107fdc2c7 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java @@ -395,7 +395,7 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity Level level = player.level(); if (level instanceof ServerLevel server) { - if (!InventoryTool.hasCreativeAmmoBox(player)) { + if (!InventoryTool.hasCreativeAmmoBox(player) && player == getFirstPassenger()) { var ammo = getWeaponIndex(0) == 0 ? ModItems.AP_5_INCHES.get() : ModItems.HE_5_INCHES.get(); var ammoCount = InventoryTool.countItem(player.getInventory().items, ammo); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java index 1cee6a1de..1925605cc 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java @@ -407,15 +407,19 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt Level level = player.level(); if (level instanceof ServerLevel server) { int consumed; - if (InventoryTool.hasCreativeAmmoBox(player)) { - consumed = 2; - } else { - var ammo = getWeaponIndex(0) == 0 ? ModItems.AP_5_INCHES.get() : ModItems.HE_5_INCHES.get(); - var ammoCount = InventoryTool.countItem(player.getInventory().items, ammo); + if (player == getFirstPassenger()) { + if (InventoryTool.hasCreativeAmmoBox(player)) { + consumed = 2; + } else { + var ammo = getWeaponIndex(0) == 0 ? ModItems.AP_5_INCHES.get() : ModItems.HE_5_INCHES.get(); + var ammoCount = InventoryTool.countItem(player.getInventory().items, ammo); - // 尝试消耗两发弹药 - if (ammoCount <= 0) return; - consumed = InventoryTool.consumeItem(player.getInventory().items, ammo, 2); + // 尝试消耗两发弹药 + if (ammoCount <= 0) return; + consumed = InventoryTool.consumeItem(player.getInventory().items, ammo, 2); + } + } else { + consumed = stack.getCount(); } if (getFirstPassenger() != getOwner()) {