diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/HelicopterHudOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/HelicopterHudOverlay.java index e876ccfd3..9c0b592aa 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/HelicopterHudOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/HelicopterHudOverlay.java @@ -79,7 +79,7 @@ public class HelicopterHudOverlay { float power = iHelicopterEntity.getPower(); lerpPower = Mth.lerp(0.001f * event.getPartialTick(), lerpPower, power); - preciseBlit(event.getGuiGraphics(), ModUtils.loc("textures/screens/helicopter/heli_power.png"), (float) w / 2 + 130f, ((float) h / 2 - 64 + 124 - power * 900), 0, 0, 4, power * 900, 4, power * 900); + preciseBlit(event.getGuiGraphics(), ModUtils.loc("textures/screens/helicopter/heli_power.png"), (float) w / 2 + 130f, ((float) h / 2 - 64 + 124 - power * 970), 0, 0, 4, power * 970, 4, power * 970); lerpVy = (float) Mth.lerp(0.021f * event.getPartialTick(), lerpVy, mobileVehicle.getDeltaMovement().y() + 0.06f); preciseBlit(event.getGuiGraphics(), ModUtils.loc("textures/screens/helicopter/heli_vy_move.png"), (float) w / 2 + 100, ((float) h / 2 - 64 - Math.max(lerpVy, 0) * 100f), 0, 0, 64, 128, 64, 128); event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(mobileVehicle.getY())), diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/Ah6Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/Ah6Entity.java index 9e9a92c8e..a3a1ffa2c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/Ah6Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/Ah6Entity.java @@ -131,21 +131,23 @@ public class Ah6Entity extends MobileVehicleEntity implements GeoEntity, IHelico this.setXRot(Mth.clamp(this.getXRot() + (this.onGround() ? 0 : 1.2f) * diffX * this.entityData.get(POWER), -80, 80)); this.setZRot(Mth.clamp(this.getRoll() - this.entityData.get(DELTA_ROT) + (this.onGround() ? 0 : 0.75f) * diffY * this.entityData.get(POWER), -50, 50)); - if (this.upInputDown || this.forwardInputDown) { - this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.002f, 0.12f)); - } + if (this.level() instanceof ServerLevel) { + if (this.upInputDown || this.forwardInputDown) { + this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.002f, 0.12f)); + } - if (this.downInputDown || this.backInputDown) { - this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.0015f, 0)); - } + if (this.downInputDown || this.backInputDown) { + this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.0015f, 0)); + } // player.displayClientMessage(Component.literal("Angle:" + new java.text.DecimalFormat("##.##").format(this.getDeltaMovement().y())), true); - if(!(this.upInputDown || this.forwardInputDown || this.downInputDown || this.backInputDown)) { - if (this.getDeltaMovement().y() + 0.06 < 0) { - this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.0002f, 0.12f)); - } else { - this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.0006f, 0)); + if(!(this.upInputDown || this.forwardInputDown || this.downInputDown || this.backInputDown)) { + if (this.getDeltaMovement().y() + 0.06 < 0) { + this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.0002f, 0.12f)); + } else { + this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.0006f, 0)); + } } } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/VehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/VehicleEntity.java index 38d5101a9..fd840c84e 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/VehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/VehicleEntity.java @@ -161,11 +161,16 @@ public class VehicleEntity extends Entity { } public void heal(float pHealAmount) { - this.setHealth(this.getHealth() + pHealAmount); + if (this.level() instanceof ServerLevel) { + this.setHealth(this.getHealth() + pHealAmount); + } + } public void hurt(float pHealAmount) { - this.setHealth(this.getHealth() - pHealAmount); + if (this.level() instanceof ServerLevel) { + this.setHealth(this.getHealth() - pHealAmount); + } } public float getHealth() {