Skip to content

Commit

Permalink
Added cuttlefish hypnotism when hunting
Browse files Browse the repository at this point in the history
  • Loading branch information
MysticKoko committed Nov 16, 2024
1 parent 4ceabde commit 0431f7f
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,25 @@ class CuttlefishEntity(entityType: EntityType<out CuttlefishEntity>, world: Worl
) {

private var tickCounter = 0
private var sprintCounter = 0
var randomValue = Random.nextInt(0, 9)

override fun tick() {
super.tick()

tickCounter++

if (tickCounter >= 3600) {
randomValue = Random.nextInt(0, 12)
tickCounter = 0
if (this.isSprinting) {
sprintCounter++
if (sprintCounter >= 5) {
randomValue = if (randomValue == 3) 4 else 3
sprintCounter = 0
}
} else {
if (tickCounter >= 3600) {
randomValue = Random.nextInt(0, 12)
tickCounter = 0
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ open class HybridAquaticCephalopodEntity(
this.headYaw = this.prevHeadYaw
}
}

isSprinting = isAttacking
}

private fun getHungerValue(entityType: EntityType<*>): Int {
Expand Down Expand Up @@ -254,16 +256,16 @@ open class HybridAquaticCephalopodEntity(
controllerRegistrar.add(
AnimationController(
this,
"Swim/Idle",
"Swim/Run",
20
) { state: AnimationState<HybridAquaticCephalopodEntity> ->
if (!this.isSubmergedInWater) {
if (!this.isSubmergedInWater && isOnGround) {
state.setAndContinue(DefaultAnimations.SIT)
} else {
if (state.isMoving) {
state.setAndContinue(DefaultAnimations.SWIM)
state.setAndContinue(if (this.isSprinting) DefaultAnimations.RUN else DefaultAnimations.SWIM)
} else {
state.setAndContinue(DefaultAnimations.IDLE)
state.setAndContinue(DefaultAnimations.SWIM)
}
}
}.setOverrideEasingType(EasingType.EASE_IN_OUT_SINE)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,43 @@
{
"format_version": "1.8.0",
"animations": {
"misc.idle": {
"loop": true,
"animation_length": 4,
"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]
}
},
"tentacles_1": {
"rotation": {
"vector": [-22.5, 0, 0]
}
}
}
},
"misc.sit": {
"loop": true,
"bones": {
"body": {
"position": {
"vector": [0, -1.75, 0]
},
"scale": {
"vector": [1, 0.8, 1]
}
},
"tentacles_1": {
"rotation": {
"vector": [22.5, 0, 0]
}
}
}
},
"move.swim": {
"loop": true,
"animation_length": 2,
Expand All @@ -19,33 +56,31 @@
}
}
},
"misc.idle": {
"loop": true,
"animation_length": 4,
"bones": {
"body": {
"rotation": ["Math.cos(query.anim_time * 90)*2.5", 0, 0],
"position": [0, "Math.sin(query.anim_time * 90)*-0.25", 0]
},
"tentacles_1": {
"rotation": [-22.5, 0, 0]
}
}
},
"misc.sit": {
"move.run": {
"loop": true,
"animation_length": 2,
"bones": {
"body": {
"position": {
"vector": [0, -1.75, 0]
"rotation": {
"vector": ["Math.sin(query.anim_time * 180)*-5", 180, 0]
},
"scale": {
"vector": [1, 0.8, 1]
"position": {
"vector": [0, 0, 3]
}
},
"fin": {
"rotation": {
"vector": ["Math.cos(query.anim_time * 360)*2.5", 0, 0]
}
},
"tentacles_1": {
"rotation": {
"vector": [22.5, 0, 0]
"vector": ["Math.cos(query.anim_time * 180)*15", 0, 0]
}
},
"tentacles_2": {
"rotation": {
"vector": ["Math.sin(query.anim_time * 180)*10", 0, 0]
}
}
}
Expand Down

0 comments on commit 0431f7f

Please sign in to comment.