From ec0eee74e4e4e2f862f6b1eb90f40855ee3e9d91 Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Sun, 15 Dec 2024 19:33:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E4=BA=86=E5=BF=AB=E8=89=87?= =?UTF-8?q?=E7=9A=84=E5=BC=B9=E8=8D=AF=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/atsuishio/superbwarfare/entity/SpeedboatEntity.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java index e5cf7c17c..545f12db4 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java @@ -351,7 +351,9 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity, * 机枪塔开火 */ private void gunnerFire() { - if (this.entityData.get(COOL_DOWN) != 0 || cannotFire || !this.getItemStacks().contains(ModItems.HEAVY_AMMO.get())) return; + if (this.entityData.get(COOL_DOWN) != 0 || this.cannotFire) return; + if (this.getItemStacks().stream().noneMatch(stack -> stack.is(ModItems.HEAVY_AMMO.get()))) return; + Entity driver = this.getFirstPassenger(); if (driver == null) return; @@ -392,6 +394,8 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity, this.entityData.set(COOL_DOWN, 3); heat += 4; } + + this.getItemStacks().stream().filter(stack -> stack.is(ModItems.HEAVY_AMMO.get())).findFirst().ifPresent(stack -> stack.shrink(1)); } } }