1
+ package dev.sterner.client.model
2
+
3
+ import com.mojang.blaze3d.vertex.PoseStack
4
+ import com.mojang.blaze3d.vertex.VertexConsumer
5
+ import dev.sterner.VoidBound
6
+ import net.minecraft.client.model.EntityModel
7
+ import net.minecraft.client.model.HumanoidModel
8
+ import net.minecraft.client.model.Model
9
+ import net.minecraft.client.model.geom.ModelLayerLocation
10
+ import net.minecraft.client.model.geom.ModelPart
11
+ import net.minecraft.client.model.geom.PartNames
12
+ import net.minecraft.client.model.geom.PartPose
13
+ import net.minecraft.client.model.geom.builders.CubeDeformation
14
+ import net.minecraft.client.model.geom.builders.CubeListBuilder
15
+ import net.minecraft.client.model.geom.builders.LayerDefinition
16
+ import net.minecraft.client.model.geom.builders.MeshDefinition
17
+ import net.minecraft.client.renderer.RenderType
18
+ import net.minecraft.resources.ResourceLocation
19
+ import net.minecraft.world.entity.LivingEntity
20
+ import java.util.function.Function
21
+
22
+ class IchoriumCircletModel <T : LivingEntity >(root : ModelPart ) :
23
+ HumanoidModel <T >(root, RenderType ::entityTranslucent) {
24
+
25
+ private val base: ModelPart = root.getChild(" head" ).getChild(" base" )
26
+
27
+ override fun renderToBuffer (
28
+ poseStack : PoseStack ,
29
+ vertexConsumer : VertexConsumer ,
30
+ packedLight : Int ,
31
+ packedOverlay : Int ,
32
+ red : Float ,
33
+ green : Float ,
34
+ blue : Float ,
35
+ alpha : Float
36
+ ) {
37
+ base.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha)
38
+ }
39
+
40
+ companion object {
41
+ // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor
42
+ val LAYER_LOCATION : ModelLayerLocation =
43
+ ModelLayerLocation (VoidBound .id(" ichorium_circlet" ), " main" )
44
+
45
+ fun createBodyLayer (): LayerDefinition {
46
+ val data = createMesh(CubeDeformation .NONE , 0f )
47
+ val root = data.root
48
+ val head = root.getChild(PartNames .HEAD )
49
+
50
+ val base = head.addOrReplaceChild(
51
+ " base" ,
52
+ CubeListBuilder .create().texOffs(27 , 9 )
53
+ .addBox(- 4.5f , - 1.0f , - 4.5f , 9.0f , 9.0f , 9.0f , CubeDeformation (0.25f ))
54
+ .texOffs(0 , 18 ).addBox(- 4.5f , - 1.0f , - 4.5f , 9.0f , 9.0f , 9.0f , CubeDeformation (0.0f ))
55
+ .texOffs(0 , 0 ).addBox(- 4.5f , - 1.0f , - 4.5f , 9.0f , 9.0f , 9.0f , CubeDeformation (0.5f )),
56
+ PartPose .offset(0.0f , 16.0f , 0.0f )
57
+ )
58
+
59
+ return LayerDefinition .create(data, 64 , 64 )
60
+ }
61
+ }
62
+ }
0 commit comments