43 lines
1.6 KiB
Java
43 lines
1.6 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.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.PartDefinition;
|
|
import net.minecraft.client.renderer.RenderType;
|
|
|
|
@Environment(EnvType.CLIENT)
|
|
public class ShieldModel extends Model {
|
|
private static final String PLATE = "plate";
|
|
private static final String HANDLE = "handle";
|
|
private static final int SHIELD_WIDTH = 10;
|
|
private static final int SHIELD_HEIGHT = 20;
|
|
private final ModelPart plate;
|
|
private final ModelPart handle;
|
|
|
|
public ShieldModel(ModelPart root) {
|
|
super(root, RenderType::entitySolid);
|
|
this.plate = root.getChild("plate");
|
|
this.handle = root.getChild("handle");
|
|
}
|
|
|
|
public static LayerDefinition createLayer() {
|
|
MeshDefinition meshDefinition = new MeshDefinition();
|
|
PartDefinition partDefinition = meshDefinition.getRoot();
|
|
partDefinition.addOrReplaceChild("plate", CubeListBuilder.create().texOffs(0, 0).addBox(-6.0F, -11.0F, -2.0F, 12.0F, 22.0F, 1.0F), PartPose.ZERO);
|
|
partDefinition.addOrReplaceChild("handle", CubeListBuilder.create().texOffs(26, 0).addBox(-1.0F, -3.0F, -1.0F, 2.0F, 6.0F, 6.0F), PartPose.ZERO);
|
|
return LayerDefinition.create(meshDefinition, 64, 64);
|
|
}
|
|
|
|
public ModelPart plate() {
|
|
return this.plate;
|
|
}
|
|
|
|
public ModelPart handle() {
|
|
return this.handle;
|
|
}
|
|
}
|