Your model name is not a valid Java name!

Status
Resolved
Type
Product/platform
MCreator/Windows
Priority
Normal
Issue description

This is the first time I've used a model from Blockbench, and I've encountered some kind of error in the code or I think. When I import my Java model it says 

"Your model name is not a valid Java name!

Custom mob model names cannot contain whitespace, start with number or contain any non ANSCII letters.

Model name is not filename, but the name inside the model Java code (model class name)!

The best solution to this problem is to properly define the model name in your modeler before exporting the model"

Please, I need help with this. Here's the code:

 

 

public class bird_peng1 extends EntityModel {
    private final RendererModel body;
    private final RendererModel leftleg;
    private final RendererModel rightleg;
    private final RendererModel head;

    public bird_peng1 () {
        textureWidth = 64;
        textureHeight = 64;

        body = new RendererModel(this);
        body.setRotationPoint(0.0F, 24.0F, 0.0F);
        body.cubeList.add(new ModelBox(body, 0, 0, -6.0F, -19.0F, -5.0F, 12, 18, 10, 0.0F, false));
        body.cubeList.add(new ModelBox(body, 0, 44, -7.0F, -18.0F, -3.0F, 1, 13, 6, 0.0F, false));
        body.cubeList.add(new ModelBox(body, 32, 32, 6.0F, -18.0F, -3.0F, 1, 13, 6, 0.0F, false));

        leftleg = new RendererModel(this);
        leftleg.setRotationPoint(0.0F, 24.0F, 0.0F);
        leftleg.cubeList.add(new ModelBox(leftleg, 34, 0, -5.0F, -1.0F, -2.0F, 1, 1, 5, 0.0F, false));

        rightleg = new RendererModel(this);
        rightleg.setRotationPoint(0.0F, 24.0F, 0.0F);
        rightleg.cubeList.add(new ModelBox(rightleg, 24, 28, 4.0F, -1.0F, -2.0F, 1, 1, 5, 0.0F, false));

        head = new RendererModel(this);
        head.setRotationPoint(0.0F, 24.0F, 0.0F);
        head.cubeList.add(new ModelBox(head, 0, 28, -4.0F, -25.0F, -4.0F, 8, 8, 8, 0.0F, false));
        head.cubeList.add(new ModelBox(head, 0, 0, -1.0F, -22.0F, -7.0F, 2, 2, 3, 0.0F, false));
    }

    @Override
    public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
        body.render(f5);
        leftleg.render(f5);
        rightleg.render(f5);
        head.render(f5);
    }

    public void setRotationAngle(RendererModel modelRenderer, float x, float y, float z) {
        modelRenderer.rotateAngleX = x;
        modelRenderer.rotateAngleY = y;
        modelRenderer.rotateAngleZ = z;
    }
}

 

 

Issue comments

hi ! I have the same problem. Can you help me please ?

MCreator says me 

 

"Your model name is not a valid Java name!

Custom mob model names cannot contain whitespace, start with number or contain any non ANSCII letters.

Model name is not filename, but the name inside the model Java code (model class name)!

The best solution to this problem is to properly define the model name in your modeler before exporting the model"

Please, I need help with this. Here's the code:

 

// Made with Blockbench 3.5.2
// Exported for Minecraft version 1.14
// Paste this class into your mod and generate all required imports

public class herobrine extends ModelBase {
    private final ModelRenderer head;
    private final ModelRenderer body;
    private final ModelRenderer leftarm;
    private final ModelRenderer rightarm;
    private final ModelRenderer rightleg;
    private final ModelRenderer leftleg;

    public herobrine() {
        textureWidth = 128;
        textureHeight = 128;

        head = new ModelRenderer(this);
        head.setRotationPoint(0.0F, 0.0F, 0.0F);
        head.cubeList.add(new ModelBox(head, 0, 0, -4.0F, -8.0F, -4.0F, 8, 8, 8, 0.0F, false));

        body = new ModelRenderer(this);
        body.setRotationPoint(0.0F, 12.0F, 0.0F);
        body.cubeList.add(new ModelBox(body, 0, 16, -4.0F, -12.0F, -2.0F, 8, 12, 4, 0.0F, false));

        leftarm = new ModelRenderer(this);
        leftarm.setRotationPoint(6.0F, 0.0F, 0.0F);
        leftarm.cubeList.add(new ModelBox(leftarm, 40, 16, -2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F, false));

        rightarm = new ModelRenderer(this);
        rightarm.setRotationPoint(-6.0F, 0.0F, 0.0F);
        rightarm.cubeList.add(new ModelBox(rightarm, 24, 16, -2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F, false));

        rightleg = new ModelRenderer(this);
        rightleg.setRotationPoint(-2.0F, 12.0F, 0.0F);
        rightleg.cubeList.add(new ModelBox(rightleg, 0, 32, -2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F, false));

        leftleg = new ModelRenderer(this);
        leftleg.setRotationPoint(2.0F, 12.0F, 0.0F);
        leftleg.cubeList.add(new ModelBox(leftleg, 17, 32, -2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F, false));
    }

    @Override
    public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
        head.render(f5);
        body.render(f5);
        leftarm.render(f5);
        rightarm.render(f5);
        rightleg.render(f5);
        leftleg.render(f5);
    }

    public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
        modelRenderer.rotateAngleX = x;
        modelRenderer.rotateAngleY = y;
        modelRenderer.rotateAngleZ = z;
    }
}

Hello I have the same problem. Only my code is a little different. The problem is that when importing a Java model into MKreator, an error appears that the Java file name should not contain spaces and other invalid ASCII characters, but I do not have any spaces, just the name is cube.java. Maybe this is due to the version of the model ( 1.14 SME) I don't know for sure. Sorry if there are errors in the text, it's just that I don't know English very well and I use a translator. Here is my code:

// Made with Blockbench 3.9.1
// Exported for Minecraft version 1.14 with MCP mappings
// Paste this class into your mod and generate all required imports

public class cube extends EntityModel {
    private final RendererModel BODY;
    private final RendererModel leftarm;
    private final RendererModel rightarm;
    private final RendererModel leftleg;
    private final RendererModel rightleg;

    public cube() {
        textureWidth = 64;
        textureHeight = 64;

        BODY = new RendererModel(this);
        BODY.setRotationPoint(-0.5F, 11.0F, 0.0F);
        BODY.cubeList.add(new ModelBox(BODY, 0, 24, -7.0F, -7.0F, -3.0F, 14, 12, 6, 0.0F, false));
        BODY.cubeList.add(new ModelBox(BODY, 0, 12, -10.0F, -4.0F, -1.5F, 3, 9, 3, 0.0F, false));
        BODY.cubeList.add(new ModelBox(BODY, 0, 12, 7.0F, -4.0F, -1.5F, 3, 9, 3, 0.0F, false));

        leftarm = new RendererModel(this);
        leftarm.setRotationPoint(7.75F, 9.0F, 0.0F);
        leftarm.cubeList.add(new ModelBox(leftarm, 0, 12, -18.25F, -2.0F, -1.5F, 3, 9, 3, 0.0F, false));

        rightarm = new RendererModel(this);
        rightarm.setRotationPoint(-9.0F, 9.0F, 0.0F);
        rightarm.cubeList.add(new ModelBox(rightarm, 0, 12, 15.5F, -2.0F, -1.5F, 3, 9, 3, 0.0F, false));

        leftleg = new RendererModel(this);
        leftleg.setRotationPoint(-3.5F, 18.0F, 0.0F);
        leftleg.cubeList.add(new ModelBox(leftleg, 0, 0, -2.0F, -2.0F, -2.0F, 4, 8, 4, 0.0F, false));

        rightleg = new RendererModel(this);
        rightleg.setRotationPoint(3.25F, 18.0F, 0.0F);
        rightleg.cubeList.add(new ModelBox(rightleg, 0, 0, -1.75F, -2.0F, -2.0F, 4, 8, 4, 0.0F, false));
    }

    @Override
    public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
        BODY.render(f5);
        leftarm.render(f5);
        rightarm.render(f5);
        leftleg.render(f5);
        rightleg.render(f5);
    }

    public void setRotationAngle(RendererModel modelRenderer, float x, float y, float z) {
        modelRenderer.rotateAngleX = x;
        modelRenderer.rotateAngleY = y;
        modelRenderer.rotateAngleZ = z;
    }
}



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.