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 8f1f403e9..4f3e9bac0 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 @@ -9,12 +9,11 @@ import software.bernie.geckolib.core.animatable.model.CoreGeoBone; import software.bernie.geckolib.core.animation.AnimationState; import software.bernie.geckolib.model.GeoModel; -import static com.atsuishio.superbwarfare.entity.SpeedboatEntity.DELTA_ROT; -import static com.atsuishio.superbwarfare.entity.SpeedboatEntity.POWER; +import static com.atsuishio.superbwarfare.entity.SpeedboatEntity.*; public class SpeedboatModel extends GeoModel { public static float lerpRotY = 0f; - public static float rotorSpeed = 0f; + public float rotorSpeed = 0f; @Override public ResourceLocation getAnimationResource(SpeedboatEntity entity) { @@ -39,8 +38,7 @@ public class SpeedboatModel extends GeoModel { CoreGeoBone rotor = getAnimationProcessor().getBone("Rotor"); CoreGeoBone duo = getAnimationProcessor().getBone("duo"); - rotorSpeed = Mth.lerp(0.1f * times, rotorSpeed, 10 * animatable.getEntityData().get(POWER)); - rotor.setRotZ(rotor.getRotZ() + rotorSpeed); + 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)); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java index 175fe870e..c84cd57b4 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java @@ -52,6 +52,7 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity, public static final EntityDataAccessor ROT_Y = SynchedEntityData.defineId(SpeedboatEntity.class, EntityDataSerializers.FLOAT); public static final EntityDataAccessor DELTA_ROT = SynchedEntityData.defineId(SpeedboatEntity.class, EntityDataSerializers.FLOAT); public static final EntityDataAccessor POWER = SynchedEntityData.defineId(SpeedboatEntity.class, EntityDataSerializers.FLOAT); + public static final EntityDataAccessor ROTOR = SynchedEntityData.defineId(SpeedboatEntity.class, EntityDataSerializers.FLOAT); public static final float MAX_HEALTH = CannonConfig.MK42_HP.get(); @@ -82,6 +83,7 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity, this.entityData.define(ROT_Y, 0f); this.entityData.define(DELTA_ROT, 0f); this.entityData.define(POWER, 0f); + this.entityData.define(ROTOR, 0f); } @Override @@ -90,6 +92,7 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity, 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 @@ -97,6 +100,7 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity, 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")); } else { @@ -217,7 +221,7 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity, if (this.isInWater()) { fluidFloat = -0.025 + 0.05 * getSubmergedHeight(this); - float f = 0.87f + 0.09f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90; + float f = 0.7f + 0.09f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90; this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).normalize().scale(0.04 * this.getDeltaMovement().length()))); this.setDeltaMovement(this.getDeltaMovement().multiply(f, 0.85, f)); } else if (this.onGround()) { @@ -298,11 +302,11 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity, diffY = (float) Mth.lerp(0.1 * diffY, diffY, 0); if (this.getPersistentData().getBoolean("forward")) { - this.entityData.set(POWER, this.entityData.get(POWER) + 0.08f); + this.entityData.set(POWER, this.entityData.get(POWER) + 0.02f); } if (this.getPersistentData().getBoolean("backward")) { - this.entityData.set(POWER, this.entityData.get(POWER) - 0.12f); + this.entityData.set(POWER, this.entityData.get(POWER) - 0.02f); if (this.getPersistentData().getBoolean("left")) { diffY = Mth.clamp(diffY + 1f, 0, 5); handleSetDiffY(diffY); @@ -324,10 +328,8 @@ public class SpeedboatEntity extends Entity implements GeoEntity, IChargeEntity, 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); } - this.entityData.set(POWER, this.entityData.get(POWER) * 0.3f); - - this.flyDist = this.entityData.get(POWER); - + this.entityData.set(POWER, this.entityData.get(POWER) * 0.9f); + this.entityData.set(ROTOR, this.entityData.get(ROTOR) + this.entityData.get(POWER)); this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * 0.8f); if (this.isInWater() || this.isUnderWater()) { diff --git a/src/main/resources/assets/superbwarfare/animations/speedboat.animation.json b/src/main/resources/assets/superbwarfare/animations/speedboat.animation.json index 934dbe5df..1a0b6b53e 100644 --- a/src/main/resources/assets/superbwarfare/animations/speedboat.animation.json +++ b/src/main/resources/assets/superbwarfare/animations/speedboat.animation.json @@ -2,11 +2,16 @@ "format_version": "1.8.0", "animations": { "animation.speedboat.idle": { - "loop": true + "loop": true, + "animation_length": 1, + "blend_weight": "10", + "start_delay": "10" }, "animation.speedboat.forward": { "loop": true, "animation_length": 0.5, + "blend_weight": "10", + "start_delay": "10", "bones": { "Rotor": { "rotation": { @@ -19,6 +24,8 @@ "animation.speedboat.backward": { "loop": true, "animation_length": 0.5, + "blend_weight": "10", + "start_delay": "10", "bones": { "Rotor": { "rotation": {