调整防御塔关闭逻辑
This commit is contained in:
parent
8b89474214
commit
bfbbfd718b
2 changed files with 16 additions and 10 deletions
|
@ -169,13 +169,16 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
if (this.getOwnerUUID() == null) {
|
if (this.getOwnerUUID() == null) {
|
||||||
this.setOwnerUUID(player.getUUID());
|
this.setOwnerUUID(player.getUUID());
|
||||||
}
|
}
|
||||||
|
if (this.getOwner() == player) {
|
||||||
entityData.set(ACTIVE, !entityData.get(ACTIVE));
|
entityData.set(ACTIVE, !entityData.get(ACTIVE));
|
||||||
|
|
||||||
if (player instanceof ServerPlayer serverPlayer) {
|
if (player instanceof ServerPlayer serverPlayer) {
|
||||||
serverPlayer.level().playSound(null, serverPlayer.getOnPos(), SoundEvents.ARROW_HIT_PLAYER, SoundSource.PLAYERS, 0.5F, 1);
|
serverPlayer.level().playSound(null, serverPlayer.getOnPos(), SoundEvents.ARROW_HIT_PLAYER, SoundSource.PLAYERS, 0.5F, 1);
|
||||||
}
|
}
|
||||||
return InteractionResult.sidedSuccess(this.level().isClientSide());
|
return InteractionResult.sidedSuccess(this.level().isClientSide());
|
||||||
|
} else {
|
||||||
|
return InteractionResult.PASS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
entityData.set(TARGET_UUID, "none");
|
entityData.set(TARGET_UUID, "none");
|
||||||
|
|
|
@ -146,13 +146,16 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
if (this.getOwnerUUID() == null) {
|
if (this.getOwnerUUID() == null) {
|
||||||
this.setOwnerUUID(player.getUUID());
|
this.setOwnerUUID(player.getUUID());
|
||||||
}
|
}
|
||||||
|
if (this.getOwner() == player) {
|
||||||
entityData.set(ACTIVE, !entityData.get(ACTIVE));
|
entityData.set(ACTIVE, !entityData.get(ACTIVE));
|
||||||
|
|
||||||
if (player instanceof ServerPlayer serverPlayer) {
|
if (player instanceof ServerPlayer serverPlayer) {
|
||||||
serverPlayer.level().playSound(null, serverPlayer.getOnPos(), SoundEvents.ARROW_HIT_PLAYER, SoundSource.PLAYERS, 0.5F, 1);
|
serverPlayer.level().playSound(null, serverPlayer.getOnPos(), SoundEvents.ARROW_HIT_PLAYER, SoundSource.PLAYERS, 0.5F, 1);
|
||||||
}
|
}
|
||||||
return InteractionResult.sidedSuccess(this.level().isClientSide());
|
return InteractionResult.sidedSuccess(this.level().isClientSide());
|
||||||
|
} else {
|
||||||
|
return InteractionResult.PASS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return InteractionResult.sidedSuccess(this.level().isClientSide());
|
return InteractionResult.sidedSuccess(this.level().isClientSide());
|
||||||
|
|
Loading…
Add table
Reference in a new issue