diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/fish/HybridAquaticFishEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/fish/HybridAquaticFishEntity.kt index d8ed3a0c..1317d790 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/fish/HybridAquaticFishEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/fish/HybridAquaticFishEntity.kt @@ -39,7 +39,6 @@ import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache import software.bernie.geckolib.core.animation.AnimatableManager import software.bernie.geckolib.core.animation.AnimationController import software.bernie.geckolib.core.animation.AnimationState -import software.bernie.geckolib.core.animation.EasingType import software.bernie.geckolib.util.GeckoLibUtil @Suppress("LeakingThis", "UNUSED_PARAMETER") @@ -131,7 +130,7 @@ open class HybridAquaticFishEntity( return } - if (isWet) { + if (isSubmergedInWater) { moistness = getMaxMoistness() } else { moistness -= 1 @@ -310,17 +309,14 @@ open class HybridAquaticFishEntity( //#region Animations override fun registerControllers(controllerRegistrar: AnimatableManager.ControllerRegistrar) { controllerRegistrar.add( - AnimationController( - this, - "Swim/Idle", - 20 - ) { state: AnimationState -> - if (state.isMoving) { - state.setAndContinue(DefaultAnimations.SWIM) - } else { - state.setAndContinue(DefaultAnimations.IDLE) - } - }.setOverrideEasingType(EasingType.EASE_IN_OUT_SINE) + AnimationController(this, "Swim/Idle", 5, + AnimationController.AnimationStateHandler { state: AnimationState -> + if (state.isMoving) { + return@AnimationStateHandler state.setAndContinue(DefaultAnimations.SWIM) + } else { + return@AnimationStateHandler state.setAndContinue(DefaultAnimations.IDLE) + } + }) ) } diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/miniboss/ManglerfishEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/miniboss/ManglerfishEntity.kt index f9b37b39..1114ff18 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/miniboss/ManglerfishEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/miniboss/ManglerfishEntity.kt @@ -28,7 +28,6 @@ import software.bernie.geckolib.constant.DefaultAnimations import software.bernie.geckolib.core.animation.AnimatableManager import software.bernie.geckolib.core.animation.AnimationController import software.bernie.geckolib.core.animation.AnimationState -import software.bernie.geckolib.core.`object`.PlayState class ManglerfishEntity(entityType: EntityType, world: World) : HybridAquaticMinibossEntity(entityType, world) { @@ -126,13 +125,7 @@ class ManglerfishEntity(entityType: EntityType, }) ) controllerRegistrar.add( - AnimationController(this, "Attack", 0, - AnimationController.AnimationStateHandler { state: AnimationState -> - if (this.handSwinging) return@AnimationStateHandler state.setAndContinue(DefaultAnimations.ATTACK_BITE) - state.controller.forceAnimationReset() - PlayState.STOP - }) - ) + DefaultAnimations.genericAttackAnimation(this, DefaultAnimations.ATTACK_BITE)) } //#endregion diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/shark/HybridAquaticSharkEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/shark/HybridAquaticSharkEntity.kt index 5432fd8f..5bb2e5aa 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/shark/HybridAquaticSharkEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/shark/HybridAquaticSharkEntity.kt @@ -37,7 +37,6 @@ import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache import software.bernie.geckolib.core.animation.AnimatableManager import software.bernie.geckolib.core.animation.AnimationController import software.bernie.geckolib.core.animation.AnimationState -import software.bernie.geckolib.core.animation.EasingType import software.bernie.geckolib.util.GeckoLibUtil import java.util.* @@ -234,23 +233,17 @@ open class HybridAquaticSharkEntity( //#region Animations override fun registerControllers(controllerRegistrar: AnimatableManager.ControllerRegistrar) { controllerRegistrar.add( - AnimationController( - this, - "Swim/Run", - 20 - ) { state: AnimationState -> - if (!this.isSubmergedInWater && isOnGround) { - state.setAndContinue(DefaultAnimations.SIT) - } else { + AnimationController(this, "Walk/Run/Idle", 0, + AnimationController.AnimationStateHandler { state: AnimationState -> if (state.isMoving) { - state.setAndContinue(if (this.isSprinting) DefaultAnimations.RUN else DefaultAnimations.SWIM) + return@AnimationStateHandler state.setAndContinue(if (this.isSprinting) DefaultAnimations.RUN else DefaultAnimations.SWIM) } else { - state.setAndContinue(DefaultAnimations.SWIM) + return@AnimationStateHandler state.setAndContinue(DefaultAnimations.SWIM) } - } - }.setOverrideEasingType(EasingType.EASE_IN_OUT_SINE) + }) ) - controllerRegistrar.add(DefaultAnimations.genericAttackAnimation(this, DefaultAnimations.ATTACK_BITE)) + controllerRegistrar.add( + DefaultAnimations.genericAttackAnimation(this, DefaultAnimations.ATTACK_BITE)) } override fun getAnimatableInstanceCache(): AnimatableInstanceCache { diff --git a/src/main/resources/assets/hybrid-aquatic/animations/mahi.animation.json b/src/main/resources/assets/hybrid-aquatic/animations/mahi.animation.json index ed22d3cd..5ac3ad58 100644 --- a/src/main/resources/assets/hybrid-aquatic/animations/mahi.animation.json +++ b/src/main/resources/assets/hybrid-aquatic/animations/mahi.animation.json @@ -47,25 +47,49 @@ }, "move.swim": { "loop": true, - "animation_length": 1, + "animation_length": 2, "bones": { "body": { - "rotation": [0, "Math.sin(query.anim_time * 360)*-5", 0] + "rotation": [0, "Math.sin(query.anim_time * 180)*-5", 0] }, "body_2": { - "rotation": [0, "Math.cos(query.anim_time * 360)*10", 0] + "rotation": [0, "Math.cos(query.anim_time * 180)*10", 0] }, "tail": { - "rotation": [0, "Math.cos(query.anim_time * 360)*22.5", 0] + "rotation": [0, "Math.cos(query.anim_time * 180)*10", 0] + }, + "tail_fin": { + "rotation": [0, "Math.sin(query.anim_time * 180)*15", 0] }, "right_fin": { - "rotation": [0, "Math.cos(query.anim_time * 360)*10", 0] + "rotation": [0, "Math.cos(query.anim_time * 180)*10", 0] }, "left_fin": { + "rotation": [0, "Math.cos(query.anim_time * 180)*10", 0] + } + } + }, + "move.run": { + "loop": true, + "animation_length": 1, + "bones": { + "body": { + "rotation": [0, "Math.sin(query.anim_time * 360)*-10", 0] + }, + "body_2": { + "rotation": [0, "Math.cos(query.anim_time * 360)*10", 0] + }, + "tail": { "rotation": [0, "Math.cos(query.anim_time * 360)*10", 0] }, "tail_fin": { "rotation": [0, "Math.sin(query.anim_time * 360)*15", 0] + }, + "right_fin": { + "rotation": [0, "Math.cos(query.anim_time * 360)*10", 0] + }, + "left_fin": { + "rotation": [0, "Math.cos(query.anim_time * 360)*10", 0] } } }, diff --git a/src/main/resources/assets/hybrid-aquatic/animations/tuna.animation.json b/src/main/resources/assets/hybrid-aquatic/animations/tuna.animation.json index 919b8c60..7d5cebdb 100644 --- a/src/main/resources/assets/hybrid-aquatic/animations/tuna.animation.json +++ b/src/main/resources/assets/hybrid-aquatic/animations/tuna.animation.json @@ -5,79 +5,72 @@ "loop": true, "animation_length": 4, "bones": { - "pelvic_fin": { - "rotation": { - "vector": [0, 0, "Math.sin(query.anim_time * 90)*10"] - } + "body": { + "rotation": ["Math.cos(query.anim_time * 90)*2.5", 0, 0], + "position": [0, "Math.sin(query.anim_time * 90)*-0.25", 0] }, - "dorsal_fin": { - "rotation": { - "vector": [0, 0, "Math.sin(query.anim_time * 90)*10"] - } + "right_fin": { + "rotation": [0, 0, "Math.cos(query.anim_time * 90)*10"] + }, + "left_fin": { + "rotation": [0, 0, "Math.cos(query.anim_time * 90)*-10"] + }, + "tail": { + "rotation": [0, "Math.cos(query.anim_time * 90)*5", 0] + }, + "tail_fin": { + "rotation": [0, "Math.sin(query.anim_time * 90)*5", 0] }, + "body_2": { + "rotation": [0, "Math.cos(query.anim_time * 90)*5", 0] + } + } + }, + "move.swim": { + "loop": true, + "animation_length": 2, + "bones": { "body": { - "rotation": { - "vector": ["Math.cos(query.anim_time * 90)*2.5", 0, 0] - }, - "position": { - "vector": [0, "Math.sin(query.anim_time * 90)*-0.25", 0] - } + "rotation": [0, "Math.sin(query.anim_time * 180)*-5", 0] }, "right_fin": { - "rotation": { - "vector": [0, 0, "Math.cos(query.anim_time * 90)*5"] - } + "rotation": [0, "Math.cos(query.anim_time * 180)*10", 0] }, "left_fin": { - "rotation": { - "vector": [0, 0, "Math.cos(query.anim_time * 90)*-5"] - } + "rotation": [0, "Math.cos(query.anim_time * 180)*10", 0] }, "tail": { - "rotation": { - "vector": [0, "Math.cos(query.anim_time * 90)*10", 0] - } + "rotation": [0, "Math.cos(query.anim_time * 180)*10", 0] }, "tail_fin": { - "rotation": { - "vector": [0, "Math.sin(query.anim_time * 90)*10", 0] - } + "rotation": [0, "Math.sin(query.anim_time * 180)*15", 0] + }, + "body_2": { + "rotation": [0, "Math.cos(query.anim_time * 180)*10", 0] } } }, - "move.swim": { + "move.run": { "loop": true, "animation_length": 1, "bones": { "body": { - "rotation": { - "vector": [0, "Math.sin(query.anim_time * 360)*-5", 0] - } + "rotation": [0, "Math.sin(query.anim_time * 360)*-10", 0] }, "right_fin": { - "rotation": { - "vector": [0, "Math.sin(query.anim_time * 360)*10", 0] - } + "rotation": [0, "Math.cos(query.anim_time * 360)*10", 0] }, "left_fin": { - "rotation": { - "vector": [0, "Math.cos(query.anim_time * 360)*-10", 0] - } - }, - "body2": { - "rotation": { - "vector": [0, "Math.cos(query.anim_time * 360)*5", 0] - } + "rotation": [0, "Math.cos(query.anim_time * 360)*10", 0] }, "tail": { - "rotation": { - "vector": [0, "Math.cos(query.anim_time * 360)*10", 0] - } + "rotation": [0, "Math.cos(query.anim_time * 360)*10", 0] }, "tail_fin": { - "rotation": { - "vector": [0, "Math.cos(query.anim_time * 360)*15", 0] - } + "rotation": [0, "Math.sin(query.anim_time * 360)*15", 0] + }, + "body_2": { + "rotation": [0, "Math.cos(query.anim_time * 360)*10", 0] } } },