Started by
Snusik_2009
on
Topic category: Troubleshooting, bugs, and solutions
I can't import my java entity! Why?
Code:
public class hacker<T extends Entity> extends EntityModel<T> {
public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation("modid", "hacker"), "main");
private final ModelPart hacker;
public hacker(ModelPart root) {
this.hacker = root.getChild("hacker");
}
public static LayerDefinition createBodyLayer() {
MeshDefinition meshdefinition = new MeshDefinition();
PartDefinition partdefinition = meshdefinition.getRoot();
PartDefinition hacker = partdefinition.addOrReplaceChild("hacker", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F));
PartDefinition Head = hacker.addOrReplaceChild("Head", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F));
PartDefinition Mask = Head.addOrReplaceChild("Mask", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F));
PartDefinition Maskrope3_r1 = Mask.addOrReplaceChild("Maskrope3_r1", CubeListBuilder.create().texOffs(25, 40).addBox(-4.0F, -6.0F, -0.6F, 8.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(24, 34).addBox(3.0F, -6.0F, -7.6F, 1.0F, 1.0F, 8.0F, new CubeDeformation(0.0F))
.texOffs(24, 34).addBox(-4.0F, -6.0F, -7.6F, 1.0F, 1.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, -0.829F, 0.0F, 0.0F));
PartDefinition Mask_r1 = Mask.addOrReplaceChild("Mask_r1", CubeListBuilder.create().texOffs(0, 33).addBox(-4.0F, -8.0F, -9.0F, 8.0F, 8.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, -0.9163F, 0.0F, 0.0F));
PartDefinition Body = hacker.addOrReplaceChild("Body", CubeListBuilder.create().texOffs(16, 16).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F));
PartDefinition RightArm = hacker.addOrReplaceChild("RightArm", CubeListBuilder.create().texOffs(40, 16).addBox(-3.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(-5.0F, 2.0F, 0.0F));
PartDefinition LeftArm = hacker.addOrReplaceChild("LeftArm", CubeListBuilder.create().texOffs(32, 48).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(5.0F, 2.0F, 0.0F));
PartDefinition RightLeg = hacker.addOrReplaceChild("RightLeg", CubeListBuilder.create().texOffs(0, 16).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(-1.9F, 12.0F, 0.0F));
PartDefinition LeftLeg = hacker.addOrReplaceChild("LeftLeg", CubeListBuilder.create().texOffs(16, 48).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(1.9F, 12.0F, 0.0F));
return LayerDefinition.create(meshdefinition, 64, 64);
}
@Override
public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
}
@Override
public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
hacker.render(poseStack, buffer, packedLight, packedOverlay);
}
}
File name: hacker.java
Edited by Snusik_2009 on Sun, 04/17/2022 - 14:12