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()) {