2025-11-24 22:52:51 +03:00

63 lines
3.6 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package net.minecraft.client.model;
import net.minecraft.client.model.AbstractEquineModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.CubeDeformation;
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.EquineRenderState;
public class EquineSaddleModel
extends AbstractEquineModel<EquineRenderState> {
private static final String SADDLE = "saddle";
private static final String LEFT_SADDLE_MOUTH = "left_saddle_mouth";
private static final String LEFT_SADDLE_LINE = "left_saddle_line";
private static final String RIGHT_SADDLE_MOUTH = "right_saddle_mouth";
private static final String RIGHT_SADDLE_LINE = "right_saddle_line";
private static final String HEAD_SADDLE = "head_saddle";
private static final String MOUTH_SADDLE_WRAP = "mouth_saddle_wrap";
private final ModelPart[] ridingParts;
public EquineSaddleModel(ModelPart root) {
super(root);
ModelPart leftSaddleLine = this.headParts.getChild(LEFT_SADDLE_LINE);
ModelPart rightSaddleLine = this.headParts.getChild(RIGHT_SADDLE_LINE);
this.ridingParts = new ModelPart[]{leftSaddleLine, rightSaddleLine};
}
public static LayerDefinition createSaddleLayer(boolean baby) {
return EquineSaddleModel.createFullScaleSaddleLayer(baby).apply(baby ? BABY_TRANSFORMER : MeshTransformer.IDENTITY);
}
public static LayerDefinition createFullScaleSaddleLayer(boolean baby) {
MeshDefinition mesh = baby ? EquineSaddleModel.createFullScaleBabyMesh(CubeDeformation.NONE) : EquineSaddleModel.createBodyMesh(CubeDeformation.NONE);
PartDefinition root = mesh.getRoot();
PartDefinition body = root.getChild("body");
PartDefinition headParts = root.getChild("head_parts");
body.addOrReplaceChild(SADDLE, CubeListBuilder.create().texOffs(26, 0).addBox(-5.0f, -8.0f, -9.0f, 10.0f, 9.0f, 9.0f, new CubeDeformation(0.5f)), PartPose.ZERO);
headParts.addOrReplaceChild(LEFT_SADDLE_MOUTH, CubeListBuilder.create().texOffs(29, 5).addBox(2.0f, -9.0f, -6.0f, 1.0f, 2.0f, 2.0f), PartPose.ZERO);
headParts.addOrReplaceChild(RIGHT_SADDLE_MOUTH, CubeListBuilder.create().texOffs(29, 5).addBox(-3.0f, -9.0f, -6.0f, 1.0f, 2.0f, 2.0f), PartPose.ZERO);
headParts.addOrReplaceChild(LEFT_SADDLE_LINE, CubeListBuilder.create().texOffs(32, 2).addBox(3.1f, -6.0f, -8.0f, 0.0f, 3.0f, 16.0f), PartPose.rotation(-0.5235988f, 0.0f, 0.0f));
headParts.addOrReplaceChild(RIGHT_SADDLE_LINE, CubeListBuilder.create().texOffs(32, 2).addBox(-3.1f, -6.0f, -8.0f, 0.0f, 3.0f, 16.0f), PartPose.rotation(-0.5235988f, 0.0f, 0.0f));
headParts.addOrReplaceChild(HEAD_SADDLE, CubeListBuilder.create().texOffs(1, 1).addBox(-3.0f, -11.0f, -1.9f, 6.0f, 5.0f, 6.0f, new CubeDeformation(0.22f)), PartPose.ZERO);
headParts.addOrReplaceChild(MOUTH_SADDLE_WRAP, CubeListBuilder.create().texOffs(19, 0).addBox(-2.0f, -11.0f, -4.0f, 4.0f, 5.0f, 2.0f, new CubeDeformation(0.2f)), PartPose.ZERO);
return LayerDefinition.create(mesh, 64, 64);
}
@Override
public void setupAnim(EquineRenderState state) {
super.setupAnim(state);
for (ModelPart part : this.ridingParts) {
part.visible = state.isRidden;
}
}
}