允许关闭自动防御塔
This commit is contained in:
parent
66b4c77089
commit
6b568fb006
2 changed files with 14 additions and 6 deletions
|
@ -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);
|
||||
} 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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
} 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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue