Skip to content

Commit

Permalink
Added cuttlefish pattern changing
Browse files Browse the repository at this point in the history
  • Loading branch information
MysticKoko committed Nov 16, 2024
1 parent 58e7e2c commit 4ceabde
Show file tree
Hide file tree
Showing 17 changed files with 97 additions and 181 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
package dev.hybridlabs.aquatic.client.model.entity.cephalopod

import dev.hybridlabs.aquatic.entity.cephalopod.HybridAquaticCephalopodEntity
import dev.hybridlabs.aquatic.HybridAquatic
import dev.hybridlabs.aquatic.entity.cephalopod.CuttlefishEntity
import net.minecraft.util.Identifier

class CuttlefishEntityModel : HybridAquaticCephalopodEntityModel<HybridAquaticCephalopodEntity>("cuttlefish")
class CuttlefishEntityModel : HybridAquaticCephalopodEntityModel<CuttlefishEntity>("cuttlefish") {
override fun getTextureResource(animatable: CuttlefishEntity?): Identifier {
val texturePath = when (animatable?.randomValue) {
0 -> "textures/entity/cephalopod/cuttlefish/cuttlefish.png"
1 -> "textures/entity/cephalopod/cuttlefish/cuttlefish_zebra.png"
2 -> "textures/entity/cephalopod/cuttlefish/cuttlefish_disruptive.png"
3 -> "textures/entity/cephalopod/cuttlefish/cuttlefish_white.png"
4 -> "textures/entity/cephalopod/cuttlefish/cuttlefish_black.png"
5 -> "textures/entity/cephalopod/cuttlefish/cuttlefish_black_white.png"
6 -> "textures/entity/cephalopod/cuttlefish/cuttlefish_white_black.png"
7 -> "textures/entity/cephalopod/cuttlefish/cuttlefish_red_white.png"
8 -> "textures/entity/cephalopod/cuttlefish/cuttlefish_white_red.png"
9 -> "textures/entity/cephalopod/cuttlefish/cuttlefish_creeper_black.png"
10 -> "textures/entity/cephalopod/cuttlefish/cuttlefish_creeper_white.png"
11 -> "textures/entity/cephalopod/cuttlefish/cuttlefish_creeper_red.png"
else -> "textures/entity/cephalopod/cuttlefish/cuttlefish.png"
}

return Identifier(HybridAquatic.MOD_ID, texturePath)
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package dev.hybridlabs.aquatic.client.render.entity.cephalopods

import dev.hybridlabs.aquatic.client.model.entity.cephalopod.CuttlefishEntityModel
import dev.hybridlabs.aquatic.entity.cephalopod.HybridAquaticCephalopodEntity
import dev.hybridlabs.aquatic.entity.cephalopod.CuttlefishEntity
import net.minecraft.client.render.entity.EntityRendererFactory.Context

class CuttlefishEntityRenderer(context: Context) : HybridAquaticCephalopodEntityRenderer<HybridAquaticCephalopodEntity>(context, CuttlefishEntityModel(), true, false)
class CuttlefishEntityRenderer(context: Context) : HybridAquaticCephalopodEntityRenderer<CuttlefishEntity>(context, CuttlefishEntityModel(), true, false)

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import net.minecraft.entity.attribute.DefaultAttributeContainer
import net.minecraft.entity.attribute.EntityAttributes
import net.minecraft.entity.mob.WaterCreatureEntity
import net.minecraft.world.World
import kotlin.random.Random

class CuttlefishEntity(entityType: EntityType<out CuttlefishEntity>, world: World) :
HybridAquaticCephalopodEntity(
Expand All @@ -16,6 +17,20 @@ class CuttlefishEntity(entityType: EntityType<out CuttlefishEntity>, world: Worl
HybridAquaticEntityTags.SHARK
) {

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

override fun tick() {
super.tick()

tickCounter++

if (tickCounter >= 3600) {
randomValue = Random.nextInt(0, 12)
tickCounter = 0
}
}

companion object {
fun createMobAttributes(): DefaultAttributeContainer.Builder {
return WaterCreatureEntity.createMobAttributes()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,155 +3,49 @@
"animations": {
"move.swim": {
"loop": true,
"animation_length": 2.5,
"animation_length": 2,
"bones": {
"head": {
"rotation": {
"0.0": {
"vector": [-5, 0, 0]
},
"1.0833": {
"vector": [-2.5, 0, 0]
},
"1.4167": {
"vector": [5, 0, 0]
},
"1.6667": {
"vector": [-2.5, 0, 0]
},
"2.0833": {
"vector": [5, 0, 0]
},
"2.5": {
"vector": [-5, 0, 0]
}
}
},
"mantle": {
"scale": {
"0.0": {
"vector": [1, 1, 1]
},
"0.625": {
"vector": [1.1, 1.1, 1]
},
"1.25": {
"vector": [0.9, 0.9, 1]
},
"1.7917": {
"vector": [1, 1, 1]
}
}
"body": {
"rotation": ["Math.sin(query.anim_time * 180)*-5", 0, 0]
},
"fin": {
"rotation": {
"0.0": {
"vector": [2.5, 0, 0]
},
"0.5833": {
"vector": [-2.5, 0, 0]
},
"1.0833": {
"vector": [-7.5, 0, 0]
},
"1.4167": {
"vector": [5, 0, 0]
},
"1.6667": {
"vector": [-5, 0, 0]
},
"2.0833": {
"vector": [5, 0, 0]
},
"2.5": {
"vector": [2.5, 0, 0]
}
},
"scale": {
"vector": [1, 0.7, 1]
}
"rotation": ["Math.cos(query.anim_time * 360)*2.5", 0, 0]
},
"tentacles": {
"rotation": {
"0.0": {
"vector": [0, 0, 0]
},
"0.625": {
"vector": [10, 0, 0]
},
"0.9583": {
"vector": [-30, 0, 0]
},
"1.25": {
"vector": [-20, 0, 0]
},
"1.5": {
"vector": [-10.83, 0, 0]
},
"1.6667": {
"vector": [-20, 0, 0]
},
"1.9583": {
"vector": [-10.83, 0, 0]
},
"2.2917": {
"vector": [-20, 0, 0]
},
"2.5": {
"vector": [0, 0, 0]
}
},
"tentacles_1": {
"rotation": ["Math.cos(query.anim_time * 180)*15", 0, 0]
},
"tentacles_2": {
"rotation": ["Math.sin(query.anim_time * 180)*10", 0, 0]
}
}
},
"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": {
"loop": true,
"bones": {
"body": {
"position": {
"0.0": {
"vector": [0, 0, 0]
},
"2.5": {
"vector": [0, 0, 0]
}
"vector": [0, -1.75, 0]
},
"scale": {
"vector": [1, 0.8, 1]
}
},
"small": {
"tentacles_1": {
"rotation": {
"0.625": {
"vector": [5, 0, 0]
},
"0.9583": {
"vector": [7.5, 0, 0]
},
"1.25": {
"vector": [-5, 0, 0]
},
"1.5": {
"vector": [7.5, 0, 0]
},
"1.6667": {
"vector": [-5, 0, 0]
},
"1.9583": {
"vector": [7.5, 0, 0]
},
"2.2917": {
"vector": [-5, 0, 0]
},
"2.5": {
"vector": [5, 0, 0]
}
}
},
"siphon": {
"scale": {
"0.0": {
"vector": [1, 1, 1]
},
"0.4583": {
"vector": [1.2, 1.2, 1]
},
"0.9167": {
"vector": [1, 1, 1]
},
"2.5": {
"vector": [1, 1, 1]
}
"vector": [22.5, 0, 0]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,62 +13,47 @@
"bones": [
{
"name": "body",
"pivot": [0, 2, 6],
"rotation": [0, 180, 0]
},
{
"name": "mantle",
"parent": "body",
"pivot": [0, 2, 11.5],
"pivot": [0, 2, -2],
"cubes": [
{"origin": [-3, 0, 7.5], "size": [6, 4, 8], "uv": [0, 10]}
{"origin": [-3, 0, -7], "size": [6, 4, 8], "uv": [0, 10]}
]
},
{
"name": "fin",
"parent": "mantle",
"pivot": [0, 2, 12.5],
"cubes": [
{"origin": [-4.5, 2, 7.5], "size": [9, 0, 10], "uv": [0, 0]}
]
},
{
"name": "siphon",
"parent": "body",
"pivot": [0, 1.78869, 6.42185],
"pivot": [0, 2, -4],
"cubes": [
{"origin": [-0.5, 0.5, 5.5], "size": [1, 1, 2], "pivot": [0, 1, 8.5], "rotation": [25, 0, 0], "uv": [4, 2]}
{"origin": [-5, 2, -9], "size": [10, 0, 10], "uv": [0, 0]}
]
},
{
"name": "face",
"name": "head",
"parent": "body",
"pivot": [0, 0, 10.5],
"pivot": [0, 2.5, 1],
"cubes": [
{"origin": [-2, 0.5, 4.5], "size": [4, 3, 3], "uv": [16, 22]},
{"origin": [-2.5, 1.5, 5.5], "size": [1, 2, 2], "uv": [0, 4]},
{"origin": [1.5, 1.5, 5.5], "size": [1, 2, 2], "uv": [0, 0]}
{"origin": [-2, 0.5, 1], "size": [4, 3, 3], "uv": [16, 22]},
{"origin": [1.5, 1.75, 1], "size": [1, 2, 2], "uv": [16, 28]},
{"origin": [-2.5, 1.75, 1], "size": [1, 2, 2], "uv": [28, 16]},
{"origin": [-0.5, 0.25, 1], "size": [1, 1, 2], "pivot": [0, 1.25, 1], "rotation": [-22.5, 0, 0], "uv": [22, 28]},
{"origin": [-2.51, 2.25, 1], "size": [0, 1, 2], "uv": [28, 28]},
{"origin": [2.51, 2.25, 1], "size": [0, 1, 2], "uv": [28, 28], "mirror": true}
]
},
{
"name": "tentacles",
"parent": "face",
"pivot": [0, 2, 4.5]
},
{
"name": "big",
"parent": "tentacles",
"pivot": [0, 2, 5],
"name": "tentacles_1",
"parent": "head",
"pivot": [0, 3.5, 4],
"rotation": [-22.5, 0, 0],
"cubes": [
{"origin": [-2, 0.5, 1.5], "size": [4, 3, 4], "inflate": -0.1, "pivot": [0, 2, 5], "rotation": [27.5, 0, 0], "uv": [0, 22]}
{"origin": [-2, 0.5, 4], "size": [4, 3, 4], "inflate": -0.01, "uv": [0, 22]}
]
},
{
"name": "small",
"parent": "tentacles",
"pivot": [0, 2, 5],
"name": "tentacles_2",
"parent": "tentacles_1",
"pivot": [0, 3, 4],
"cubes": [
{"origin": [-1.5, 1, 0.5], "size": [3, 2, 5], "inflate": -0.1, "pivot": [0.5, 2, 5], "rotation": [27.5, 0, 0], "uv": [20, 10]}
{"origin": [-1.5, 1, 3.75], "size": [3, 2, 4], "uv": [28, 10]}
]
}
]
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4ceabde

Please sign in to comment.