From 0c5fe01ea4dfcf1059a3e86f53d65e337a87c1d0 Mon Sep 17 00:00:00 2001 From: Atsuihsio <842960157@qq.com> Date: Thu, 12 Dec 2024 20:57:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=B9=E5=90=91=E8=88=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/model/entity/SpeedboatModel.java | 10 +--------- .../superbwarfare/entity/SpeedboatEntity.java | 15 +-------------- .../assets/superbwarfare/lang/en_us.json | 1 + .../assets/superbwarfare/lang/zh_cn.json | 1 + 4 files changed, 4 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/client/model/entity/SpeedboatModel.java b/src/main/java/com/atsuishio/superbwarfare/client/model/entity/SpeedboatModel.java index 4f3e9bac0..63f41ee9c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/model/entity/SpeedboatModel.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/model/entity/SpeedboatModel.java @@ -2,9 +2,7 @@ package com.atsuishio.superbwarfare.client.model.entity; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.entity.SpeedboatEntity; -import net.minecraft.client.Minecraft; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; import software.bernie.geckolib.core.animatable.model.CoreGeoBone; import software.bernie.geckolib.core.animation.AnimationState; import software.bernie.geckolib.model.GeoModel; @@ -12,8 +10,6 @@ import software.bernie.geckolib.model.GeoModel; import static com.atsuishio.superbwarfare.entity.SpeedboatEntity.*; public class SpeedboatModel extends GeoModel { - public static float lerpRotY = 0f; - public float rotorSpeed = 0f; @Override public ResourceLocation getAnimationResource(SpeedboatEntity entity) { @@ -33,15 +29,11 @@ public class SpeedboatModel extends GeoModel { @Override public void setCustomAnimations(SpeedboatEntity animatable, long instanceId, AnimationState animationState) { - float times = Minecraft.getInstance().getDeltaFrameTime(); CoreGeoBone rotor = getAnimationProcessor().getBone("Rotor"); CoreGeoBone duo = getAnimationProcessor().getBone("duo"); rotor.setRotZ(5 * animatable.getEntityData().get(ROTOR)); - - lerpRotY = Mth.lerp(0.5f * times, lerpRotY, animatable.getEntityData().get(POWER) > 0 ? animatable.getEntityData().get(DELTA_ROT) : -animatable.getEntityData().get(DELTA_ROT)); - - duo.setRotY(0.5f * lerpRotY); + duo.setRotY((animatable.getEntityData().get(POWER) > 0 ? 0.5f : -0.5f) * animatable.getEntityData().get(DELTA_ROT)); } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java index c84cd57b4..42c991547 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java @@ -57,10 +57,6 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity, public static final float MAX_HEALTH = CannonConfig.MK42_HP.get(); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - private boolean inputLeft; - private boolean inputRight; - private boolean inputUp; - private boolean inputDown; private int lerpSteps; private double lerpX; private double lerpY; @@ -90,16 +86,10 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity, public void addAdditionalSaveData(CompoundTag compound) { compound.putFloat("Health", this.entityData.get(HEALTH)); compound.putFloat("Energy", this.entityData.get(ENERGY)); - compound.putFloat("Power", this.entityData.get(POWER)); - compound.putFloat("DeltaRot", this.entityData.get(DELTA_ROT)); - compound.putFloat("Rotor", this.entityData.get(ROTOR)); } @Override public void readAdditionalSaveData(CompoundTag compound) { - this.entityData.set(ENERGY, compound.getFloat("Energy")); - this.entityData.set(POWER, compound.getFloat("Power")); - this.entityData.set(DELTA_ROT, compound.getFloat("DeltaRot")); this.entityData.set(ROTOR, compound.getFloat("Rotor")); if (compound.contains("Health")) { this.entityData.set(HEALTH, compound.getFloat("Health")); @@ -298,9 +288,6 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity, Entity passenger0 = this.getPassengers().isEmpty() ? null : this.getPassengers().get(0); float diffY = 0; - - diffY = (float) Mth.lerp(0.1 * diffY, diffY, 0); - if (this.getPersistentData().getBoolean("forward")) { this.entityData.set(POWER, this.entityData.get(POWER) + 0.02f); } @@ -325,7 +312,7 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity, } if (level().isClientSide) { - level().playLocalSound(this.getX(), this.getY() + this.getBbHeight() * 0.5, this.getZ(), this.getEngineSound(), this.getSoundSource(), Math.min((this.inputUp || this.inputDown ? 7.5f : 5f) * 2 * Mth.abs(this.entityData.get(POWER)), 0.25f), (random.nextFloat() * 0.1f + 1f), false); + level().playLocalSound(this.getX(), this.getY() + this.getBbHeight() * 0.5, this.getZ(), this.getEngineSound(), this.getSoundSource(), Math.min((this.getPersistentData().getBoolean("forward") || this.getPersistentData().getBoolean("backward") ? 7.5f : 5f) * 2 * Mth.abs(this.entityData.get(POWER)), 0.25f), (random.nextFloat() * 0.1f + 1f), false); } this.entityData.set(POWER, this.entityData.get(POWER) * 0.9f); diff --git a/src/main/resources/assets/superbwarfare/lang/en_us.json b/src/main/resources/assets/superbwarfare/lang/en_us.json index 96a96bafd..281253e3c 100644 --- a/src/main/resources/assets/superbwarfare/lang/en_us.json +++ b/src/main/resources/assets/superbwarfare/lang/en_us.json @@ -356,6 +356,7 @@ "entity.superbwarfare.mle_1934": "138.6mm50 Mle1934 R1938", "entity.superbwarfare.drone": "Drone", "entity.superbwarfare.annihilator": "Annihilator Energy Gun", + "entity.superbwarfare.speedboat": "Speedboat", "key.categories.superbwarfare": "Superb Warfare", "key.superbwarfare.hold_zoom": "Zoom(Hold)", diff --git a/src/main/resources/assets/superbwarfare/lang/zh_cn.json b/src/main/resources/assets/superbwarfare/lang/zh_cn.json index 4e83da58d..0acf429b2 100644 --- a/src/main/resources/assets/superbwarfare/lang/zh_cn.json +++ b/src/main/resources/assets/superbwarfare/lang/zh_cn.json @@ -356,6 +356,7 @@ "entity.superbwarfare.mle_1934": "138.6mm50 Mle1934 R1938", "entity.superbwarfare.drone": "无人机", "entity.superbwarfare.annihilator": "歼灭者能量炮", + "entity.superbwarfare.speedboat": "快艇", "key.categories.superbwarfare": "卓越前线", "key.superbwarfare.hold_zoom": "瞄准(按住)",