Topic category: Help with Minecraft modding (Java Edition)
I've looked almost everywhere online but Mcreator keeps calling my model invalid and saying it needs a valid Java name and a valid syntax but I have no clue how to fix it. Here is model code:
// Made with Blockbench 4.10.4
// Exported for Minecraft version 1.17 or later with Mojang mappings
// Paste this class into your mod and generate all required imports
public class 1<T extends Entity> extends EntityModel<T> {
// This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor
public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation("modid", "1"), "main");
private final ModelPart Frontleftleg;
private final ModelPart Frontrightleg;
private final ModelPart Backleftleg;
private final ModelPart Backrightleg;
private final ModelPart bb_main;
public 1(ModelPart root) {
this.Frontleftleg = root.getChild("Frontleftleg");
this.Frontrightleg = root.getChild("Frontrightleg");
this.Backleftleg = root.getChild("Backleftleg");
this.Backrightleg = root.getChild("Backrightleg");
this.bb_main = root.getChild("bb_main");
}
public static LayerDefinition createBodyLayer() {
MeshDefinition meshdefinition = new MeshDefinition();
PartDefinition partdefinition = meshdefinition.getRoot();
PartDefinition Frontleftleg = partdefinition.addOrReplaceChild("Frontleftleg", CubeListBuilder.create().texOffs(40, 43).addBox(-3.0F, -15.0F, -1.0F, 4.0F, 15.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(6.0F, 22.0F, 0.0F));
PartDefinition Frontrightleg = partdefinition.addOrReplaceChild("Frontrightleg", CubeListBuilder.create().texOffs(16, 43).addBox(-3.0F, -15.0F, -1.0F, 4.0F, 15.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(6.0F, 22.0F, -4.0F));
PartDefinition Backleftleg = partdefinition.addOrReplaceChild("Backleftleg", CubeListBuilder.create().texOffs(28, 28).addBox(-3.0F, -15.0F, -1.0F, 4.0F, 15.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(-6.0F, 22.0F, 0.0F));
PartDefinition Backrightleg = partdefinition.addOrReplaceChild("Backrightleg", CubeListBuilder.create().texOffs(0, 32).addBox(-3.0F, -15.0F, -1.0F, 4.0F, 15.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(-6.0F, 22.0F, -4.0F));
PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 0).addBox(-9.0F, -25.0F, -5.0F, 16.0F, 8.0F, 8.0F, new CubeDeformation(0.0F))
.texOffs(40, 27).addBox(4.0F, -27.0F, -2.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(0, 16).addBox(3.0F, -35.0F, -5.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.0F))
.texOffs(48, 5).addBox(11.0F, -30.0F, -3.0F, 2.0F, 3.0F, 4.0F, new CubeDeformation(0.0F))
.texOffs(0, 16).addBox(3.0F, -39.0F, 1.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(0, 0).addBox(3.0F, -39.0F, -5.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(12, 32).addBox(-10.0F, -26.0F, -2.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(58, 33).addBox(-13.0F, -28.0F, -2.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(58, 28).addBox(-13.0F, -25.0F, -2.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(56, 57).addBox(-16.0F, -22.0F, -2.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(56, 52).addBox(-16.0F, -25.0F, -2.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(56, 47).addBox(-13.0F, -19.0F, -2.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(56, 0).addBox(-13.0F, -22.0F, -2.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(0, 56).addBox(-19.0F, -16.0F, -2.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(54, 23).addBox(-19.0F, -19.0F, -2.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(52, 42).addBox(-16.0F, -19.0F, -2.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(24, 16).addBox(1.0F, -38.0F, -3.0F, 14.0F, 3.0F, 4.0F, new CubeDeformation(0.0F))
.texOffs(32, 23).addBox(4.0F, -40.0F, -2.0F, 9.0F, 2.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(44, 27).addBox(0.0F, -35.0F, -3.0F, 3.0F, 7.0F, 4.0F, new CubeDeformation(0.0F))
.texOffs(40, 5).addBox(1.0F, -28.0F, -2.0F, 2.0F, 1.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(40, 0).addBox(3.0F, -26.0F, -3.0F, 4.0F, 1.0F, 4.0F, new CubeDeformation(0.0F))
.texOffs(0, 22).addBox(4.0F, -26.0F, -4.0F, 3.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(0, 6).addBox(4.0F, -26.0F, 1.0F, 3.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(16, 32).addBox(7.0F, -25.0F, -3.0F, 1.0F, 5.0F, 4.0F, new CubeDeformation(0.0F))
.texOffs(0, 51).addBox(-16.0F, -25.0F, -2.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(16, 41).addBox(4.0F, -26.0F, -4.0F, 3.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F));
PartDefinition cube_r1 = bb_main.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(44, 38).addBox(-1.0F, -2.0F, -1.0F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(5.0F, -35.0F, 1.0F, 0.0F, -0.3054F, 0.0F));
PartDefinition cube_r2 = bb_main.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(48, 12).addBox(-1.0F, -2.0F, -1.0F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(5.0F, -35.0F, -3.0F, 0.0F, 0.3491F, 0.0F));
return LayerDefinition.create(meshdefinition, 128, 128);
}
@Override
public void setupAnim(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
}
@Override
public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
Frontleftleg.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
Frontrightleg.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
Backleftleg.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
Backrightleg.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
bb_main.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
}
}
Got it working I think but now it's doing this. So a video online told me to change a couple lines and this is what I got now:
// Made with Blockbench 4.10.4
// Exported for Minecraft version 1.17 or later with Mojang mappings
// Paste this class into your mod and generate all required imports
public class Woodshoe extends EntityModel<T> {
// This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor
public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation("modid", "1"), "main");
private final ModelPart Frontleftleg;
private final ModelPart Frontrightleg;
private final ModelPart Backleftleg;
private final ModelPart Backrightleg;
private final ModelPart bb_main;
public Woodshoe() {
this.Frontleftleg = root.getChild("Frontleftleg");
this.Frontrightleg = root.getChild("Frontrightleg");
this.Backleftleg = root.getChild("Backleftleg");
this.Backrightleg = root.getChild("Backrightleg");
this.bb_main = root.getChild("bb_main");
}
public static LayerDefinition createBodyLayer() {
MeshDefinition meshdefinition = new MeshDefinition();
PartDefinition partdefinition = meshdefinition.getRoot();
PartDefinition Frontleftleg = partdefinition.addOrReplaceChild("Frontleftleg", CubeListBuilder.create().texOffs(40, 43).addBox(-3.0F, -15.0F, -1.0F, 4.0F, 15.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(6.0F, 22.0F, 0.0F));
PartDefinition Frontrightleg = partdefinition.addOrReplaceChild("Frontrightleg", CubeListBuilder.create().texOffs(16, 43).addBox(-3.0F, -15.0F, -1.0F, 4.0F, 15.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(6.0F, 22.0F, -4.0F));
PartDefinition Backleftleg = partdefinition.addOrReplaceChild("Backleftleg", CubeListBuilder.create().texOffs(28, 28).addBox(-3.0F, -15.0F, -1.0F, 4.0F, 15.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(-6.0F, 22.0F, 0.0F));
PartDefinition Backrightleg = partdefinition.addOrReplaceChild("Backrightleg", CubeListBuilder.create().texOffs(0, 32).addBox(-3.0F, -15.0F, -1.0F, 4.0F, 15.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(-6.0F, 22.0F, -4.0F));
PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 0).addBox(-9.0F, -25.0F, -5.0F, 16.0F, 8.0F, 8.0F, new CubeDeformation(0.0F))
.texOffs(40, 27).addBox(4.0F, -27.0F, -2.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(0, 16).addBox(3.0F, -35.0F, -5.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.0F))
.texOffs(48, 5).addBox(11.0F, -30.0F, -3.0F, 2.0F, 3.0F, 4.0F, new CubeDeformation(0.0F))
.texOffs(0, 16).addBox(3.0F, -39.0F, 1.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(0, 0).addBox(3.0F, -39.0F, -5.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(12, 32).addBox(-10.0F, -26.0F, -2.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(58, 33).addBox(-13.0F, -28.0F, -2.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(58, 28).addBox(-13.0F, -25.0F, -2.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(56, 57).addBox(-16.0F, -22.0F, -2.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(56, 52).addBox(-16.0F, -25.0F, -2.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(56, 47).addBox(-13.0F, -19.0F, -2.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(56, 0).addBox(-13.0F, -22.0F, -2.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(0, 56).addBox(-19.0F, -16.0F, -2.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(54, 23).addBox(-19.0F, -19.0F, -2.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(52, 42).addBox(-16.0F, -19.0F, -2.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(24, 16).addBox(1.0F, -38.0F, -3.0F, 14.0F, 3.0F, 4.0F, new CubeDeformation(0.0F))
.texOffs(32, 23).addBox(4.0F, -40.0F, -2.0F, 9.0F, 2.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(44, 27).addBox(0.0F, -35.0F, -3.0F, 3.0F, 7.0F, 4.0F, new CubeDeformation(0.0F))
.texOffs(40, 5).addBox(1.0F, -28.0F, -2.0F, 2.0F, 1.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(40, 0).addBox(3.0F, -26.0F, -3.0F, 4.0F, 1.0F, 4.0F, new CubeDeformation(0.0F))
.texOffs(0, 22).addBox(4.0F, -26.0F, -4.0F, 3.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(0, 6).addBox(4.0F, -26.0F, 1.0F, 3.0F, 1.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(16, 32).addBox(7.0F, -25.0F, -3.0F, 1.0F, 5.0F, 4.0F, new CubeDeformation(0.0F))
.texOffs(0, 51).addBox(-16.0F, -25.0F, -2.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(16, 41).addBox(4.0F, -26.0F, -4.0F, 3.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F));
PartDefinition cube_r1 = bb_main.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(44, 38).addBox(-1.0F, -2.0F, -1.0F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(5.0F, -35.0F, 1.0F, 0.0F, -0.3054F, 0.0F));
PartDefinition cube_r2 = bb_main.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(48, 12).addBox(-1.0F, -2.0F, -1.0F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(5.0F, -35.0F, -3.0F, 0.0F, 0.3491F, 0.0F));
return LayerDefinition.create(meshdefinition, 128, 128);
}
@Override
public void setupAnim(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
}
@Override
public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
Frontleftleg.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
Frontrightleg.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
Backleftleg.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
Backrightleg.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
bb_main.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
}
}
Name the model class something other than 1
You removed <T extends Entity> next to the model class name. You also need to change the 1 in "ModelLayerLocation(new ResourceLocation("modid", "1"), "main");" wifh the lowercase version of your model's name so mcreator can register it properly.
Okay so. The model works, the textures are just messed up but it looks fine in blockbench