your model name is not a valid java name

Started by titou31 on

Topic category: Help with modding (Java Edition)

Last seen on 15:45, 6. May 2020
Joined Dec 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
your model name is not a valid java name

Hello , when I try to import a model of something ,  I get an error : "your model name is not a valid java name, custom mob model names can not contain white spaces, start with number or contain any ASCII letters; Model name is not file name, but the name inside the model java code(model class name)"

can you help me solve my problem please .

Last seen on 14:48, 4. Jul 2021
Joined Jul 2021
Points:

User statistics:

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

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