From c395abd0dfb2829f7c093bcb8eb7efb9205d69a5 Mon Sep 17 00:00:00 2001 From: Atsuihsio <842960157@qq.com> Date: Wed, 1 Jan 2025 22:12:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BD=BD=E5=85=B7=E5=9C=A8?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AF=E8=A2=AB=E6=94=BB=E5=87=BB=E7=9A=84?= =?UTF-8?q?=E8=99=9A=E5=81=87=E6=89=A3=E8=A1=80=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=9B=B4=E5=8D=87=E6=9C=BA=E5=8A=9F=E7=8E=87=E6=9D=A1=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/overlay/HelicopterHudOverlay.java | 2 +- .../superbwarfare/entity/Ah6Entity.java | 24 ++++++++++--------- .../superbwarfare/entity/VehicleEntity.java | 9 +++++-- 3 files changed, 21 insertions(+), 14 deletions(-) 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() {