From 6b568fb006c093c4dd4b95b4b089c36191cb5090 Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Fri, 6 Jun 2025 21:32:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=81=E8=AE=B8=E5=85=B3=E9=97=AD=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E9=98=B2=E5=BE=A1=E5=A1=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../superbwarfare/entity/vehicle/Hpj11Entity.java | 10 +++++++--- .../superbwarfare/entity/vehicle/LaserTowerEntity.java | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Hpj11Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Hpj11Entity.java index 4344872d1..477720558 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Hpj11Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Hpj11Entity.java @@ -165,9 +165,13 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti this.remove(RemovalReason.DISCARDED); this.discard(); return InteractionResult.SUCCESS; - } else if (!entityData.get(ACTIVE)) { - entityData.set(ACTIVE, true); - this.setOwnerUUID(player.getUUID()); + } else { + if (this.getOwnerUUID() == null) { + this.setOwnerUUID(player.getUUID()); + } + + entityData.set(ACTIVE, !entityData.get(ACTIVE)); + if (player instanceof ServerPlayer serverPlayer) { serverPlayer.level().playSound(null, serverPlayer.getOnPos(), SoundEvents.ARROW_HIT_PLAYER, SoundSource.PLAYERS, 0.5F, 1); } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/LaserTowerEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/LaserTowerEntity.java index 1131cfb23..b483004e7 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/LaserTowerEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/LaserTowerEntity.java @@ -142,9 +142,13 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity, this.remove(RemovalReason.DISCARDED); this.discard(); return InteractionResult.SUCCESS; - } else if (!entityData.get(ACTIVE)) { - entityData.set(ACTIVE, true); - this.setOwnerUUID(player.getUUID()); + } else { + if (this.getOwnerUUID() == null) { + this.setOwnerUUID(player.getUUID()); + } + + entityData.set(ACTIVE, !entityData.get(ACTIVE)); + if (player instanceof ServerPlayer serverPlayer) { serverPlayer.level().playSound(null, serverPlayer.getOnPos(), SoundEvents.ARROW_HIT_PLAYER, SoundSource.PLAYERS, 0.5F, 1); }