Your model name is not a valid Java name!

Started by The1GiantWalrus on

Topic category: Help with Minecraft modding (Java Edition)

Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Your model name is not a valid Java name!

I tried to import a custom mob model, but I was faced with this error message:

"Your model name is not a valid Java name!

Custom mob model names can not contain whitespace, start with number
or contain any non ASCII letters."

I don't understant this. I've looked for an answer in other forum topics, but haven't found it!

I know that I need to change the name in the code, but I don't know how to do that. Can someone help?

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hello I have the same…
Sat, 07/03/2021 - 16:33

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;
    }
}