ZombieVillagerModel.java

net.minecraft.client.model.monster.zombie.ZombieVillagerModel

信息

  • 全限定名:net.minecraft.client.model.monster.zombie.ZombieVillagerModel
  • 类型:public class
  • 包:net.minecraft.client.model.monster.zombie
  • 源码路径:src/main/java/net/minecraft/client/model/monster/zombie/ZombieVillagerModel.java
  • 起始行号:L21
  • 继承:HumanoidModel
  • 实现:VillagerLikeModel
  • 职责:

    TODO

字段/常量

内部类/嵌套类型

构造器

public ZombieVillagerModel(ModelPart root) @ L22

  • 构造器名:ZombieVillagerModel
  • 源码定位:L22
  • 修饰符:public

参数:

  • root: ModelPart

说明:

TODO

方法

下面的方法块按源码顺序生成。

public static LayerDefinition createBodyLayer() @ L26

  • 方法名:createBodyLayer
  • 源码定位:L26
  • 返回类型:LayerDefinition
  • 修饰符:public static

参数:

说明:

TODO

public static LayerDefinition createNoHatLayer() @ L66

  • 方法名:createNoHatLayer
  • 源码定位:L66
  • 返回类型:LayerDefinition
  • 修饰符:public static

参数:

说明:

TODO

public static ArmorModelSet<LayerDefinition> createArmorLayerSet(CubeDeformation innerDeformation, CubeDeformation outerDeformation) @ L73

  • 方法名:createArmorLayerSet
  • 源码定位:L73
  • 返回类型:ArmorModelSet
  • 修饰符:public static

参数:

  • innerDeformation: CubeDeformation
  • outerDeformation: CubeDeformation

说明:

TODO

private static MeshDefinition createBaseArmorMesh(CubeDeformation g) @ L78

  • 方法名:createBaseArmorMesh
  • 源码定位:L78
  • 返回类型:MeshDefinition
  • 修饰符:private static

参数:

  • g: CubeDeformation

说明:

TODO

public void setupAnim(S state) @ L99

  • 方法名:setupAnim
  • 源码定位:L99
  • 返回类型:void
  • 修饰符:public

参数:

  • state: S

说明:

TODO

public void translateToArms(ZombieVillagerRenderState state, PoseStack outputPoseStack) @ L104

  • 方法名:translateToArms
  • 源码定位:L104
  • 返回类型:void
  • 修饰符:public

参数:

  • state: ZombieVillagerRenderState
  • outputPoseStack: PoseStack

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class ZombieVillagerModel<S extends ZombieVillagerRenderState> extends HumanoidModel<S> implements VillagerLikeModel<S> {
    public ZombieVillagerModel(ModelPart root) {
        super(root);
    }
 
    public static LayerDefinition createBodyLayer() {
        MeshDefinition mesh = HumanoidModel.createMesh(CubeDeformation.NONE, 0.0F);
        PartDefinition root = mesh.getRoot();
        PartDefinition head = root.addOrReplaceChild(
            "head",
            new CubeListBuilder().texOffs(0, 0).addBox(-4.0F, -10.0F, -4.0F, 8.0F, 10.0F, 8.0F).texOffs(24, 0).addBox(-1.0F, -3.0F, -6.0F, 2.0F, 4.0F, 2.0F),
            PartPose.ZERO
        );
        PartDefinition hat = head.addOrReplaceChild(
            "hat", CubeListBuilder.create().texOffs(32, 0).addBox(-4.0F, -10.0F, -4.0F, 8.0F, 10.0F, 8.0F, new CubeDeformation(0.5F)), PartPose.ZERO
        );
        hat.addOrReplaceChild(
            "hat_rim",
            CubeListBuilder.create().texOffs(30, 47).addBox(-8.0F, -8.0F, -6.0F, 16.0F, 16.0F, 1.0F),
            PartPose.rotation((float) (-Math.PI / 2), 0.0F, 0.0F)
        );
        root.addOrReplaceChild(
            "body",
            CubeListBuilder.create()
                .texOffs(16, 20)
                .addBox(-4.0F, 0.0F, -3.0F, 8.0F, 12.0F, 6.0F)
                .texOffs(0, 38)
                .addBox(-4.0F, 0.0F, -3.0F, 8.0F, 20.0F, 6.0F, new CubeDeformation(0.05F)),
            PartPose.ZERO
        );
        root.addOrReplaceChild(
            "right_arm", CubeListBuilder.create().texOffs(44, 22).addBox(-3.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F), PartPose.offset(-5.0F, 2.0F, 0.0F)
        );
        root.addOrReplaceChild(
            "left_arm", CubeListBuilder.create().texOffs(44, 22).mirror().addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F), PartPose.offset(5.0F, 2.0F, 0.0F)
        );
        root.addOrReplaceChild(
            "right_leg", CubeListBuilder.create().texOffs(0, 22).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F), PartPose.offset(-2.0F, 12.0F, 0.0F)
        );
        root.addOrReplaceChild(
            "left_leg", CubeListBuilder.create().texOffs(0, 22).mirror().addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F), PartPose.offset(2.0F, 12.0F, 0.0F)
        );
        return LayerDefinition.create(mesh, 64, 64);
    }
 
    public static LayerDefinition createNoHatLayer() {
        return createBodyLayer().apply(mesh -> {
            mesh.getRoot().clearChild("head").clearRecursively();
            return mesh;
        });
    }
 
    public static ArmorModelSet<LayerDefinition> createArmorLayerSet(CubeDeformation innerDeformation, CubeDeformation outerDeformation) {
        return createArmorMeshSet(ZombieVillagerModel::createBaseArmorMesh, ADULT_ARMOR_PARTS_PER_SLOT, innerDeformation, outerDeformation)
            .map(mesh -> LayerDefinition.create(mesh, 64, 32));
    }
 
    private static MeshDefinition createBaseArmorMesh(CubeDeformation g) {
        MeshDefinition mesh = HumanoidModel.createMesh(g, 0.0F);
        PartDefinition root = mesh.getRoot();
        PartDefinition head = root.addOrReplaceChild(
            "head", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -10.0F, -4.0F, 8.0F, 8.0F, 8.0F, g), PartPose.ZERO
        );
        root.addOrReplaceChild("body", CubeListBuilder.create().texOffs(16, 16).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, g.extend(0.1F)), PartPose.ZERO);
        root.addOrReplaceChild(
            "right_leg",
            CubeListBuilder.create().texOffs(0, 16).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, g.extend(0.1F)),
            PartPose.offset(-2.0F, 12.0F, 0.0F)
        );
        root.addOrReplaceChild(
            "left_leg",
            CubeListBuilder.create().texOffs(0, 16).mirror().addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, g.extend(0.1F)),
            PartPose.offset(2.0F, 12.0F, 0.0F)
        );
        head.getChild("hat").addOrReplaceChild("hat_rim", CubeListBuilder.create(), PartPose.ZERO);
        return mesh;
    }
 
    public void setupAnim(S state) {
        super.setupAnim(state);
        AnimationUtils.animateZombieArms(this.leftArm, this.rightArm, state.isAggressive, state);
    }
 
    public void translateToArms(ZombieVillagerRenderState state, PoseStack outputPoseStack) {
        this.translateToHand(state, HumanoidArm.RIGHT, outputPoseStack);
    }
}

引用的其他类