51 lines
1.8 KiB
Java
51 lines
1.8 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package net.minecraft.client.model;
|
|
|
|
import net.minecraft.client.model.SkullModelBase;
|
|
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.PartDefinition;
|
|
|
|
public class SkullModel
|
|
extends SkullModelBase {
|
|
protected final ModelPart head;
|
|
|
|
public SkullModel(ModelPart root) {
|
|
super(root);
|
|
this.head = root.getChild("head");
|
|
}
|
|
|
|
public static MeshDefinition createHeadModel() {
|
|
MeshDefinition mesh = new MeshDefinition();
|
|
PartDefinition root = mesh.getRoot();
|
|
root.addOrReplaceChild("head", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0f, -8.0f, -4.0f, 8.0f, 8.0f, 8.0f), PartPose.ZERO);
|
|
return mesh;
|
|
}
|
|
|
|
public static LayerDefinition createHumanoidHeadLayer() {
|
|
MeshDefinition mesh = SkullModel.createHeadModel();
|
|
PartDefinition root = mesh.getRoot();
|
|
root.getChild("head").addOrReplaceChild("hat", CubeListBuilder.create().texOffs(32, 0).addBox(-4.0f, -8.0f, -4.0f, 8.0f, 8.0f, 8.0f, new CubeDeformation(0.25f)), PartPose.ZERO);
|
|
return LayerDefinition.create(mesh, 64, 64);
|
|
}
|
|
|
|
public static LayerDefinition createMobHeadLayer() {
|
|
MeshDefinition mesh = SkullModel.createHeadModel();
|
|
return LayerDefinition.create(mesh, 64, 32);
|
|
}
|
|
|
|
@Override
|
|
public void setupAnim(SkullModelBase.State state) {
|
|
super.setupAnim(state);
|
|
this.head.yRot = state.yRot * ((float)Math.PI / 180);
|
|
this.head.xRot = state.xRot * ((float)Math.PI / 180);
|
|
}
|
|
}
|
|
|