cant fix "Your model name is not a valid Java name!"

Started by Nicolas_Charaba on

Topic category: Troubleshooting, bugs, and solutions

Joined Oct 2016
Points:

User statistics:

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

I had this error and I couldn't fix it at all, I saw some solutions here on the forum, but none was effective, I'm using mcreator 2020.2, the mod is for 1.12.2 and the blockbench 3.7.5 for the model. (I already checked in the blockbench itself that the model is for version 1.12.2)

here is the code

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

public class custom_model extends ModelBase {
    private final ModelRenderer bb_main;
    private final ModelRenderer cube_r1;
    private final ModelRenderer cube_r2;
    private final ModelRenderer cube_r3;
    private final ModelRenderer cube_r4;
    private final ModelRenderer cube_r5;
    private final ModelRenderer cube_r6;
    private final ModelRenderer cube_r7;
    private final ModelRenderer cube_r8;
    private final ModelRenderer cube_r9;
    private final ModelRenderer cube_r10;
    private final ModelRenderer cube_r11;
    private final ModelRenderer cube_r12;
    private final ModelRenderer cube_r13;
    private final ModelRenderer cube_r14;
    private final ModelRenderer cube_r15;
    private final ModelRenderer cube_r16;
    private final ModelRenderer cube_r17;
    private final ModelRenderer cube_r18;
    private final ModelRenderer cube_r19;
    private final ModelRenderer cube_r20;

    public custom_model{
        textureWidth = 256;
        textureHeight = 256;

        bb_main = new ModelRenderer(this);
        bb_main.setRotationPoint(0.0F, 24.0F, 0.0F);
        bb_main.cubeList.add(new ModelBox(bb_main, 68, 0, -6.5F, -30.0F, 4.0F, 13, 4, 11, 0.0F, false));
        bb_main.cubeList.add(new ModelBox(bb_main, 73, 21, -11.0F, -40.0F, 4.0F, 22, 10, 11, 0.0F, false));
        bb_main.cubeList.add(new ModelBox(bb_main, 36, 82, 17.75F, -32.0F, 1.0F, 12, 13, 12, 0.0F, false));
        bb_main.cubeList.add(new ModelBox(bb_main, 0, 63, -28.25F, -32.0F, 1.0F, 12, 13, 12, 0.0F, false));
        bb_main.cubeList.add(new ModelBox(bb_main, 0, 32, -28.25F, -19.0F, 5.0F, 4, 12, 4, 0.0F, false));

        cube_r1 = new ModelRenderer(this);
        cube_r1.setRotationPoint(-24.25F, -7.75F, -1.0F);
        bb_main.addChild(cube_r1);
        setRotationAngle(cube_r1, -0.1309F, 0.0F, 0.0F);
        cube_r1.cubeList.add(new ModelBox(cube_r1, 0, 0, -4.0F, -12.0F, 0.0F, 4, 12, 4, 0.0F, false));

        cube_r2 = new ModelRenderer(this);
        cube_r2.setRotationPoint(-24.25F, -7.0F, 11.0F);
        bb_main.addChild(cube_r2);
        setRotationAngle(cube_r2, 0.1309F, 0.0F, 0.0F);
        cube_r2.cubeList.add(new ModelBox(cube_r2, 32, 134, -4.0F, -12.0F, 0.0F, 4, 12, 4, 0.0F, false));

        cube_r3 = new ModelRenderer(this);
        cube_r3.setRotationPoint(-18.25F, -9.0F, 0.75F);
        bb_main.addChild(cube_r3);
        setRotationAngle(cube_r3, 0.0F, 0.0873F, 0.2182F);
        cube_r3.cubeList.add(new ModelBox(cube_r3, 136, 113, -4.0F, -10.0F, 0.0F, 4, 10, 4, 0.0F, false));

        cube_r4 = new ModelRenderer(this);
        cube_r4.setRotationPoint(23.75F, -11.0F, 1.0F);
        bb_main.addChild(cube_r4);
        setRotationAngle(cube_r4, 0.0F, -0.0873F, -0.2182F);
        cube_r4.cubeList.add(new ModelBox(cube_r4, 16, 137, -4.0F, -10.0F, 0.0F, 4, 10, 4, 0.0F, false));

        cube_r5 = new ModelRenderer(this);
        cube_r5.setRotationPoint(27.75F, -8.0F, 11.0F);
        bb_main.addChild(cube_r5);
        setRotationAngle(cube_r5, 0.1309F, 0.0F, 0.2182F);
        cube_r5.cubeList.add(new ModelBox(cube_r5, 48, 134, -4.0F, -12.0F, 0.0F, 4, 12, 4, 0.0F, false));

        cube_r6 = new ModelRenderer(this);
        cube_r6.setRotationPoint(27.75F, -8.0F, 5.0F);
        bb_main.addChild(cube_r6);
        setRotationAngle(cube_r6, 0.0F, 0.0F, 0.2182F);
        cube_r6.cubeList.add(new ModelBox(cube_r6, 135, 38, -4.0F, -12.0F, 0.0F, 4, 12, 4, 0.0F, false));

        cube_r7 = new ModelRenderer(this);
        cube_r7.setRotationPoint(27.75F, -8.75F, -1.0F);
        bb_main.addChild(cube_r7);
        setRotationAngle(cube_r7, -0.1309F, 0.0F, 0.2182F);
        cube_r7.cubeList.add(new ModelBox(cube_r7, 0, 137, -4.0F, -12.0F, 0.0F, 4, 12, 4, 0.0F, false));

        cube_r8 = new ModelRenderer(this);
        cube_r8.setRotationPoint(18.0F, -43.0F, 1.1F);
        bb_main.addChild(cube_r8);
        setRotationAngle(cube_r8, 0.0F, 0.0F, 0.3054F);
        cube_r8.cubeList.add(new ModelBox(cube_r8, 80, 108, -10.0F, -10.0F, 0.0F, 10, 10, 10, 0.0F, false));

        cube_r9 = new ModelRenderer(this);
        cube_r9.setRotationPoint(18.0F, -40.0F, 0.0F);
        bb_main.addChild(cube_r9);
        setRotationAngle(cube_r9, 0.0F, 0.0F, 0.829F);
        cube_r9.cubeList.add(new ModelBox(cube_r9, 84, 84, -12.0F, -12.0F, 0.0F, 12, 12, 12, 0.0F, false));

        cube_r10 = new ModelRenderer(this);
        cube_r10.setRotationPoint(28.0F, -32.0F, 3.1F);
        bb_main.addChild(cube_r10);
        setRotationAngle(cube_r10, 0.0F, 0.0F, -0.2182F);
        cube_r10.cubeList.add(new ModelBox(cube_r10, 112, 120, -8.0F, -17.0F, 0.0F, 8, 17, 8, 0.0F, false));

        cube_r11 = new ModelRenderer(this);
        cube_r11.setRotationPoint(-19.0F, -30.0F, 3.1F);
        bb_main.addChild(cube_r11);
        setRotationAngle(cube_r11, 0.0F, 0.0F, 0.2182F);
        cube_r11.cubeList.add(new ModelBox(cube_r11, 120, 64, -8.0F, -17.0F, 0.0F, 8, 17, 8, 0.0F, false));

        cube_r12 = new ModelRenderer(this);
        cube_r12.setRotationPoint(-4.0F, -49.0F, -3.0F);
        bb_main.addChild(cube_r12);
        setRotationAngle(cube_r12, 0.0F, 0.0F, -0.5236F);
        cube_r12.cubeList.add(new ModelBox(cube_r12, 0, 32, -17.0F, -14.0F, 0.0F, 17, 14, 17, 0.0F, false));

        cube_r13 = new ModelRenderer(this);
        cube_r13.setRotationPoint(3.0F, -49.0F, 0.1F);
        bb_main.addChild(cube_r13);
        setRotationAngle(cube_r13, 0.0F, 0.0F, -0.2182F);
        cube_r13.cubeList.add(new ModelBox(cube_r13, 96, 42, -10.0F, -10.0F, 0.0F, 10, 10, 12, 0.0F, false));

        cube_r14 = new ModelRenderer(this);
        cube_r14.setRotationPoint(11.0F, -44.0F, -2.0F);
        bb_main.addChild(cube_r14);
        setRotationAngle(cube_r14, 0.0F, 0.0F, 0.2618F);
        cube_r14.cubeList.add(new ModelBox(cube_r14, 52, 52, -14.0F, -14.0F, 0.0F, 14, 14, 16, 0.0F, false));

        cube_r15 = new ModelRenderer(this);
        cube_r15.setRotationPoint(1.0F, -1.0F, 5.0F);
        bb_main.addChild(cube_r15);
        setRotationAngle(cube_r15, 0.1309F, 0.0F, 0.0F);
        cube_r15.cubeList.add(new ModelBox(cube_r15, 51, 34, -3.0F, -46.0F, -9.0F, 5, 2, 8, 0.0F, false));
        cube_r15.cubeList.add(new ModelBox(cube_r15, 69, 42, -7.0F, -45.0F, -9.0F, 3, 1, 8, 0.0F, false));
        cube_r15.cubeList.add(new ModelBox(cube_r15, 72, 82, 3.0F, -45.0F, -9.0F, 2, 1, 8, 0.0F, false));
        cube_r15.cubeList.add(new ModelBox(cube_r15, 0, 124, -6.0F, -50.0F, -8.0F, 10, 6, 7, 0.0F, false));
        cube_r15.cubeList.add(new ModelBox(cube_r15, 108, 7, -7.0F, -44.0F, -9.0F, 12, 4, 8, 0.0F, false));

        cube_r16 = new ModelRenderer(this);
        cube_r16.setRotationPoint(13.0F, -33.0F, 2.0F);
        bb_main.addChild(cube_r16);
        setRotationAngle(cube_r16, 0.3927F, 0.0F, 0.0F);
        cube_r16.cubeList.add(new ModelBox(cube_r16, 0, 0, -26.0F, -16.0F, 0.0F, 26, 16, 16, 0.0F, false));

        cube_r17 = new ModelRenderer(this);
        cube_r17.setRotationPoint(8.0F, -17.0F, 5.0F);
        bb_main.addChild(cube_r17);
        setRotationAngle(cube_r17, -0.3491F, -0.1745F, 0.0F);
        cube_r17.cubeList.add(new ModelBox(cube_r17, 74, 128, -3.0F, -16.0F, -3.0F, 6, 18, 6, 0.0F, false));

        cube_r18 = new ModelRenderer(this);
        cube_r18.setRotationPoint(-8.0F, -17.0F, 5.0F);
        bb_main.addChild(cube_r18);
        setRotationAngle(cube_r18, -0.3491F, 0.1745F, 0.0F);
        cube_r18.cubeList.add(new ModelBox(cube_r18, 132, 89, -3.0F, -16.0F, -3.0F, 6, 18, 6, 0.0F, false));

        cube_r19 = new ModelRenderer(this);
        cube_r19.setRotationPoint(8.0F, 0.0F, 5.0F);
        bb_main.addChild(cube_r19);
        setRotationAngle(cube_r19, 0.0F, -0.1745F, 0.0F);
        cube_r19.cubeList.add(new ModelBox(cube_r19, 0, 97, -5.0F, -17.0F, -5.0F, 10, 17, 10, 0.0F, false));

        cube_r20 = new ModelRenderer(this);
        cube_r20.setRotationPoint(-8.0F, 0.0F, 5.0F);
        bb_main.addChild(cube_r20);
        setRotationAngle(cube_r20, 0.0F, 0.1745F, 0.0F);
        cube_r20.cubeList.add(new ModelBox(cube_r20, 40, 107, -5.0F, -17.0F, -5.0F, 10, 17, 10, 0.0F, false));
    }

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

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

Joined Apr 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ah, this is a simple fix, I…
Tue, 02/09/2021 - 21:54

Ah, this is a simple fix, I had the same problem too a while back.

Simply remove:

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

From your code, and presto!