diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ContainerMobileEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ContainerMobileEntity.java index 744704a11..615cee12d 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ContainerMobileEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ContainerMobileEntity.java @@ -82,6 +82,12 @@ public class ContainerMobileEntity extends MobileVehicleEntity implements HasCus }) ); +// Player player = (Player) this.getFirstPassenger(); + +// if (player != null) { +// player.displayClientMessage(Component.literal( new DecimalFormat("##.#").format(this.getEnergy())), true); +// } + this.refreshDimensions(); } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java index adcaf2267..d1ef088c2 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java @@ -79,9 +79,11 @@ public class MobileVehicleEntity extends EnergyVehicleEntity { if (this instanceof IHelicopterEntity) { this.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), this, this.getFirstPassenger() == null ? this : this.getFirstPassenger()), (float) (100 * ((lastTickSpeed - 0.3) * (lastTickSpeed - 0.3)))); this.bounceVertical(Direction.getNearest(this.getDeltaMovement().x(), this.getDeltaMovement().y(), this.getDeltaMovement().z()).getOpposite()); - crash = true; } else if (Mth.abs((float) lastTickVerticalSpeed) > 0.6) { this.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), this, this.getFirstPassenger() == null ? this : this.getFirstPassenger()), (float) (240 * ((Mth.abs((float) lastTickVerticalSpeed) - 0.6) * (lastTickSpeed - 0.4) * (lastTickSpeed - 0.4)))); + if (!this.level().isClientSide) { + this.level().playSound(null, this, ModSounds.VEHICLE_STRIKE.get(), this.getSoundSource(), 1, 1); + } this.bounceVertical(Direction.getNearest(this.getDeltaMovement().x(), this.getDeltaMovement().y(), this.getDeltaMovement().z()).getOpposite()); } } @@ -109,11 +111,12 @@ public class MobileVehicleEntity extends EnergyVehicleEntity { } public void bounceVertical(Direction direction) { + if (!this.level().isClientSide) { + this.level().playSound(null, this, ModSounds.VEHICLE_STRIKE.get(), this.getSoundSource(), 1, 1); + } + collisionCoolDown = 4; + crash = true; if (direction.getAxis() == Direction.Axis.Y) { - if (!this.level().isClientSide) { - this.level().playSound(null, this, ModSounds.VEHICLE_STRIKE.get(), this.getSoundSource(), 1, 1); - } - collisionCoolDown = 4; this.setDeltaMovement(this.getDeltaMovement().multiply(0.9, -0.8, 0.9)); } }