Topic category: Help with modding (Java Edition)
I help me please.
I'm making a car for my mod, BUT when I try to import the corresponding model I get the error "Your model name is invalid".
here is the java code:
// Made with Blockbench 4.9.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 car<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", "car"), "main");
private final ModelPart bb_main;
public car(ModelPart root) {
this.bb_main = root.getChild("bb_main");
}
public static LayerDefinition createBodyLayer() {
MeshDefinition meshdefinition = new MeshDefinition();
PartDefinition partdefinition = meshdefinition.getRoot();
PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(0, 0).addBox(15.0F, -15.0F, -24.0F, 1.0F, 10.0F, 48.0F, new CubeDeformation(0.0F))
.texOffs(0, 0).addBox(-16.0F, -15.0F, -24.0F, 1.0F, 10.0F, 48.0F, new CubeDeformation(0.0F))
.texOffs(0, 60).addBox(-10.0F, -14.0F, -25.0F, 20.0F, 9.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(0, 123).addBox(-15.0F, -20.0F, -9.0F, 30.0F, 5.0F, 0.0F, new CubeDeformation(0.0F))
.texOffs(0, 0).addBox(-15.0F, -15.0F, -24.0F, 30.0F, 10.0F, 16.0F, new CubeDeformation(0.0F))
.texOffs(118, 123).addBox(-15.0F, -14.0F, -25.0F, 4.0F, 4.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(118, 123).addBox(11.0F, -14.0F, -25.0F, 4.0F, 4.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(0, 110).addBox(-15.0F, -9.0F, -25.0F, 4.0F, 2.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(0, 110).addBox(11.0F, -9.0F, -25.0F, 4.0F, 2.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(81, 62).addBox(12.0F, -14.0F, 24.0F, 3.0F, 5.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(81, 62).addBox(-15.0F, -14.0F, 24.0F, 3.0F, 5.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(0, 110).addBox(-15.0F, -8.0F, 24.0F, 3.0F, 2.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(0, 110).addBox(12.0F, -8.0F, 24.0F, 3.0F, 2.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(22, 61).addBox(-3.0F, -7.0F, 24.0F, 6.0F, 3.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(102, 52).addBox(-15.0F, -4.0F, -21.0F, 5.0F, 4.0F, 8.0F, new CubeDeformation(0.0F))
.texOffs(102, 52).addBox(-15.0F, -4.0F, 13.0F, 5.0F, 4.0F, 8.0F, new CubeDeformation(0.0F))
.texOffs(102, 52).addBox(10.0F, -4.0F, 13.0F, 5.0F, 4.0F, 8.0F, new CubeDeformation(0.0F))
.texOffs(102, 52).addBox(10.0F, -4.0F, -21.0F, 5.0F, 4.0F, 8.0F, new CubeDeformation(0.0F))
.texOffs(0, 0).addBox(16.0F, -11.0F, -23.0F, 1.0F, 7.0F, 12.0F, new CubeDeformation(0.0F))
.texOffs(0, 0).addBox(16.0F, -11.0F, 11.0F, 1.0F, 7.0F, 12.0F, new CubeDeformation(0.0F))
.texOffs(0, 0).addBox(-17.0F, -11.0F, 11.0F, 1.0F, 7.0F, 12.0F, new CubeDeformation(0.0F))
.texOffs(0, 0).addBox(-17.0F, -11.0F, -23.0F, 1.0F, 7.0F, 12.0F, new CubeDeformation(0.0F))
.texOffs(0, 60).addBox(-0.5F, -16.0F, -24.0F, 1.0F, 1.0F, 3.0F, new CubeDeformation(0.0F))
.texOffs(0, 0).addBox(-15.0F, -15.0F, 8.0F, 30.0F, 10.0F, 16.0F, new CubeDeformation(0.0F))
.texOffs(0, 73).addBox(-16.0F, -5.0F, -24.0F, 32.0F, 1.0F, 48.0F, new CubeDeformation(0.0F))
.texOffs(52, 61).addBox(-10.0F, -5.0F, 22.0F, 2.0F, 2.0F, 3.0F, new CubeDeformation(0.0F))
.texOffs(52, 61).addBox(8.0F, -5.0F, 22.0F, 2.0F, 2.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F));
return LayerDefinition.create(meshdefinition, 128, 128);
}
@Override
public void setupAnim(T 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) {
bb_main.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
}
}
Before exporting your entity from Blockbench, check that you put in a correct File Name and Model Identifier, just lowercase letters without spaces or special characters. The name must be different from other entities already imported into MCreator.
So I hope this helps you. Sorry for my English.
it does not work
Here is the name given to my blockbench files
1. carcanemarche
2.car
Whats the problem here in the name
can you provide a link to test the Blockbench file?
You wouldn't be French by chance?