/* * Decompiled with CFR 0.152. */ package net.minecraft.client.model; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.MeshTransformer; import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.client.renderer.entity.state.StriderRenderState; import net.minecraft.util.Mth; public class StriderModel extends EntityModel { public static final MeshTransformer BABY_TRANSFORMER = MeshTransformer.scaling(0.5f); private static final String RIGHT_BOTTOM_BRISTLE = "right_bottom_bristle"; private static final String RIGHT_MIDDLE_BRISTLE = "right_middle_bristle"; private static final String RIGHT_TOP_BRISTLE = "right_top_bristle"; private static final String LEFT_TOP_BRISTLE = "left_top_bristle"; private static final String LEFT_MIDDLE_BRISTLE = "left_middle_bristle"; private static final String LEFT_BOTTOM_BRISTLE = "left_bottom_bristle"; private final ModelPart rightLeg; private final ModelPart leftLeg; private final ModelPart body; private final ModelPart rightBottomBristle; private final ModelPart rightMiddleBristle; private final ModelPart rightTopBristle; private final ModelPart leftTopBristle; private final ModelPart leftMiddleBristle; private final ModelPart leftBottomBristle; public StriderModel(ModelPart root) { super(root); this.rightLeg = root.getChild("right_leg"); this.leftLeg = root.getChild("left_leg"); this.body = root.getChild("body"); this.rightBottomBristle = this.body.getChild(RIGHT_BOTTOM_BRISTLE); this.rightMiddleBristle = this.body.getChild(RIGHT_MIDDLE_BRISTLE); this.rightTopBristle = this.body.getChild(RIGHT_TOP_BRISTLE); this.leftTopBristle = this.body.getChild(LEFT_TOP_BRISTLE); this.leftMiddleBristle = this.body.getChild(LEFT_MIDDLE_BRISTLE); this.leftBottomBristle = this.body.getChild(LEFT_BOTTOM_BRISTLE); } public static LayerDefinition createBodyLayer() { MeshDefinition mesh = new MeshDefinition(); PartDefinition root = mesh.getRoot(); root.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(0, 32).addBox(-2.0f, 0.0f, -2.0f, 4.0f, 16.0f, 4.0f), PartPose.offset(-4.0f, 8.0f, 0.0f)); root.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(0, 55).addBox(-2.0f, 0.0f, -2.0f, 4.0f, 16.0f, 4.0f), PartPose.offset(4.0f, 8.0f, 0.0f)); PartDefinition body = root.addOrReplaceChild("body", CubeListBuilder.create().texOffs(0, 0).addBox(-8.0f, -6.0f, -8.0f, 16.0f, 14.0f, 16.0f), PartPose.offset(0.0f, 1.0f, 0.0f)); body.addOrReplaceChild(RIGHT_BOTTOM_BRISTLE, CubeListBuilder.create().texOffs(16, 65).addBox(-12.0f, 0.0f, 0.0f, 12.0f, 0.0f, 16.0f, true), PartPose.offsetAndRotation(-8.0f, 4.0f, -8.0f, 0.0f, 0.0f, -1.2217305f)); body.addOrReplaceChild(RIGHT_MIDDLE_BRISTLE, CubeListBuilder.create().texOffs(16, 49).addBox(-12.0f, 0.0f, 0.0f, 12.0f, 0.0f, 16.0f, true), PartPose.offsetAndRotation(-8.0f, -1.0f, -8.0f, 0.0f, 0.0f, -1.134464f)); body.addOrReplaceChild(RIGHT_TOP_BRISTLE, CubeListBuilder.create().texOffs(16, 33).addBox(-12.0f, 0.0f, 0.0f, 12.0f, 0.0f, 16.0f, true), PartPose.offsetAndRotation(-8.0f, -5.0f, -8.0f, 0.0f, 0.0f, -0.87266463f)); body.addOrReplaceChild(LEFT_TOP_BRISTLE, CubeListBuilder.create().texOffs(16, 33).addBox(0.0f, 0.0f, 0.0f, 12.0f, 0.0f, 16.0f), PartPose.offsetAndRotation(8.0f, -6.0f, -8.0f, 0.0f, 0.0f, 0.87266463f)); body.addOrReplaceChild(LEFT_MIDDLE_BRISTLE, CubeListBuilder.create().texOffs(16, 49).addBox(0.0f, 0.0f, 0.0f, 12.0f, 0.0f, 16.0f), PartPose.offsetAndRotation(8.0f, -2.0f, -8.0f, 0.0f, 0.0f, 1.134464f)); body.addOrReplaceChild(LEFT_BOTTOM_BRISTLE, CubeListBuilder.create().texOffs(16, 65).addBox(0.0f, 0.0f, 0.0f, 12.0f, 0.0f, 16.0f), PartPose.offsetAndRotation(8.0f, 3.0f, -8.0f, 0.0f, 0.0f, 1.2217305f)); return LayerDefinition.create(mesh, 64, 128); } @Override public void setupAnim(StriderRenderState state) { super.setupAnim(state); float animationPos = state.walkAnimationPos; float animationSpeed = Math.min(state.walkAnimationSpeed, 0.25f); if (!state.isRidden) { this.body.xRot = state.xRot * ((float)Math.PI / 180); this.body.yRot = state.yRot * ((float)Math.PI / 180); } else { this.body.xRot = 0.0f; this.body.yRot = 0.0f; } float speed = 1.5f; this.body.zRot = 0.1f * Mth.sin(animationPos * 1.5f) * 4.0f * animationSpeed; this.body.y = 2.0f; this.body.y -= 2.0f * Mth.cos(animationPos * 1.5f) * 2.0f * animationSpeed; this.leftLeg.xRot = Mth.sin(animationPos * 1.5f * 0.5f) * 2.0f * animationSpeed; this.rightLeg.xRot = Mth.sin(animationPos * 1.5f * 0.5f + (float)Math.PI) * 2.0f * animationSpeed; this.leftLeg.zRot = 0.17453292f * Mth.cos(animationPos * 1.5f * 0.5f) * animationSpeed; this.rightLeg.zRot = 0.17453292f * Mth.cos(animationPos * 1.5f * 0.5f + (float)Math.PI) * animationSpeed; this.leftLeg.y = 8.0f + 2.0f * Mth.sin(animationPos * 1.5f * 0.5f + (float)Math.PI) * 2.0f * animationSpeed; this.rightLeg.y = 8.0f + 2.0f * Mth.sin(animationPos * 1.5f * 0.5f) * 2.0f * animationSpeed; this.rightBottomBristle.zRot = -1.2217305f; this.rightMiddleBristle.zRot = -1.134464f; this.rightTopBristle.zRot = -0.87266463f; this.leftTopBristle.zRot = 0.87266463f; this.leftMiddleBristle.zRot = 1.134464f; this.leftBottomBristle.zRot = 1.2217305f; float bristleFlow = Mth.cos(animationPos * 1.5f + (float)Math.PI) * animationSpeed; this.rightBottomBristle.zRot += bristleFlow * 1.3f; this.rightMiddleBristle.zRot += bristleFlow * 1.2f; this.rightTopBristle.zRot += bristleFlow * 0.6f; this.leftTopBristle.zRot += bristleFlow * 0.6f; this.leftMiddleBristle.zRot += bristleFlow * 1.2f; this.leftBottomBristle.zRot += bristleFlow * 1.3f; float bristleRangeMod = 1.0f; float bristleSpeedMod = 1.0f; this.rightBottomBristle.zRot += 0.05f * Mth.sin(state.ageInTicks * 1.0f * -0.4f); this.rightMiddleBristle.zRot += 0.1f * Mth.sin(state.ageInTicks * 1.0f * 0.2f); this.rightTopBristle.zRot += 0.1f * Mth.sin(state.ageInTicks * 1.0f * 0.4f); this.leftTopBristle.zRot += 0.1f * Mth.sin(state.ageInTicks * 1.0f * 0.4f); this.leftMiddleBristle.zRot += 0.1f * Mth.sin(state.ageInTicks * 1.0f * 0.2f); this.leftBottomBristle.zRot += 0.05f * Mth.sin(state.ageInTicks * 1.0f * -0.4f); } }