minecraft-src/net/minecraft/client/model/PiglinHeadModel.java
2025-07-04 02:00:41 +03:00

36 lines
1.2 KiB
Java

package net.minecraft.client.model;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.builders.CubeDeformation;
import net.minecraft.client.model.geom.builders.MeshDefinition;
@Environment(EnvType.CLIENT)
public class PiglinHeadModel extends SkullModelBase {
private final ModelPart head;
private final ModelPart leftEar;
private final ModelPart rightEar;
public PiglinHeadModel(ModelPart root) {
super(root);
this.head = root.getChild("head");
this.leftEar = this.head.getChild("left_ear");
this.rightEar = this.head.getChild("right_ear");
}
public static MeshDefinition createHeadModel() {
MeshDefinition meshDefinition = new MeshDefinition();
PiglinModel.addHead(CubeDeformation.NONE, meshDefinition);
return meshDefinition;
}
@Override
public void setupAnim(float mouthAnimation, float yRot, float xRot) {
this.head.yRot = yRot * (float) (Math.PI / 180.0);
this.head.xRot = xRot * (float) (Math.PI / 180.0);
float f = 1.2F;
this.leftEar.zRot = (float)(-(Math.cos(mouthAnimation * (float) Math.PI * 0.2F * 1.2F) + 2.5)) * 0.2F;
this.rightEar.zRot = (float)(Math.cos(mouthAnimation * (float) Math.PI * 0.2F) + 2.5) * 0.2F;
}
}