| 1 | package net.minecraft.client.model.monster.skeleton;
|
| 2 |
|
| 3 | import net.fabricmc.api.EnvType;
|
| 4 | import net.fabricmc.api.Environment;
|
| 5 | import net.minecraft.client.model.HumanoidModel;
|
| 6 | import net.minecraft.client.model.geom.ModelPart;
|
| 7 | import net.minecraft.client.model.geom.PartPose;
|
| 8 | import net.minecraft.client.model.geom.builders.CubeDeformation;
|
| 9 | import net.minecraft.client.model.geom.builders.CubeListBuilder;
|
| 10 | import net.minecraft.client.model.geom.builders.LayerDefinition;
|
| 11 | import net.minecraft.client.model.geom.builders.MeshDefinition;
|
| 12 | import net.minecraft.client.model.geom.builders.PartDefinition;
|
| 13 | import net.minecraft.client.renderer.entity.state.BoggedRenderState;
|
| 14 |
|
| 15 | @Environment(EnvType.CLIENT)
|
| 16 | public class BoggedModel extends SkeletonModel<BoggedRenderState> {
|
| 17 | private final ModelPart mushrooms;
|
| 18 |
|
| 19 | public BoggedModel(final ModelPart root) {
|
| 20 | super(root);
|
| 21 | this.mushrooms = root.getChild("head").getChild("mushrooms");
|
| 22 | }
|
| 23 |
|
| 24 | public static LayerDefinition createBodyLayer() {
|
| 25 | MeshDefinition mesh = HumanoidModel.createMesh(CubeDeformation.NONE, 0.0F);
|
| 26 | PartDefinition root = mesh.getRoot();
|
| 27 | SkeletonModel.createDefaultSkeletonMesh(root);
|
| 28 | PartDefinition mushrooms = root.getChild("head").addOrReplaceChild("mushrooms", CubeListBuilder.create(), PartPose.ZERO);
|
| 29 | mushrooms.addOrReplaceChild(
|
| 30 | "red_mushroom_1",
|
| 31 | CubeListBuilder.create().texOffs(50, 16).addBox(-3.0F, -3.0F, 0.0F, 6.0F, 4.0F, 0.0F),
|
| 32 | PartPose.offsetAndRotation(3.0F, -8.0F, 3.0F, 0.0F, (float) (Math.PI / 4), 0.0F)
|
| 33 | );
|
| 34 | mushrooms.addOrReplaceChild(
|
| 35 | "red_mushroom_2",
|
| 36 | CubeListBuilder.create().texOffs(50, 16).addBox(-3.0F, -3.0F, 0.0F, 6.0F, 4.0F, 0.0F),
|
| 37 | PartPose.offsetAndRotation(3.0F, -8.0F, 3.0F, 0.0F, (float) (Math.PI * 3.0 / 4.0), 0.0F)
|
| 38 | );
|
| 39 | mushrooms.addOrReplaceChild(
|
| 40 | "brown_mushroom_1",
|
| 41 | CubeListBuilder.create().texOffs(50, 22).addBox(-3.0F, -3.0F, 0.0F, 6.0F, 4.0F, 0.0F),
|
| 42 | PartPose.offsetAndRotation(-3.0F, -8.0F, -3.0F, 0.0F, (float) (Math.PI / 4), 0.0F)
|
| 43 | );
|
| 44 | mushrooms.addOrReplaceChild(
|
| 45 | "brown_mushroom_2",
|
| 46 | CubeListBuilder.create().texOffs(50, 22).addBox(-3.0F, -3.0F, 0.0F, 6.0F, 4.0F, 0.0F),
|
| 47 | PartPose.offsetAndRotation(-3.0F, -8.0F, -3.0F, 0.0F, (float) (Math.PI * 3.0 / 4.0), 0.0F)
|
| 48 | );
|
| 49 | mushrooms.addOrReplaceChild(
|
| 50 | "brown_mushroom_3",
|
| 51 | CubeListBuilder.create().texOffs(50, 28).addBox(-3.0F, -4.0F, 0.0F, 6.0F, 4.0F, 0.0F),
|
| 52 | PartPose.offsetAndRotation(-2.0F, -1.0F, 4.0F, (float) (-Math.PI / 2), 0.0F, (float) (Math.PI / 4))
|
| 53 | );
|
| 54 | mushrooms.addOrReplaceChild(
|
| 55 | "brown_mushroom_4",
|
| 56 | CubeListBuilder.create().texOffs(50, 28).addBox(-3.0F, -4.0F, 0.0F, 6.0F, 4.0F, 0.0F),
|
| 57 | PartPose.offsetAndRotation(-2.0F, -1.0F, 4.0F, (float) (-Math.PI / 2), 0.0F, (float) (Math.PI * 3.0 / 4.0))
|
| 58 | );
|
| 59 | return LayerDefinition.create(mesh, 64, 32);
|
| 60 | }
|
| 61 |
|
| 62 | public void setupAnim(final BoggedRenderState state) {
|
| 63 | super.setupAnim(state);
|
| 64 | this.mushrooms.visible = !state.isSheared;
|
| 65 | }
|
| 66 | }
|
| 67 |
|