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); }