Invalid Java Model

Started by TheCatalystGaming on

Topic category: Help with modding (Java Edition)

Last seen on 19:36, 13. Nov 2022
Joined Nov 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Invalid Java Model

You're probably sick of seeing posts like this, but i've been looking at similar forum posts for quite a while now and I can't find the issue. The error message is "Your model is not a valid java model! Make sure that all model parts have a valid Java name and that your model is in fact Java model with a valid syntax" As far as I can tell, all the names are fine, and the model was definitely named in the modeler. Here is the code:

 

import org.lwjgl.opengl.GL11;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity;

public class trollhood extends ModelBase {
    private final ModelRenderer MainBody;
    private final ModelRenderer Horn1;
    private final ModelRenderer N40_0_0Degrees;
    private final ModelRenderer N20_0_0Degrees;
    private final ModelRenderer N10_0_0Degrees;
    private final ModelRenderer 0_0_0Degrees;
    private final ModelRenderer Horn2;
    private final ModelRenderer N40_0_0Degrees2;
    private final ModelRenderer N20_0_0Degrees2;
    private final ModelRenderer N10_0_0Degrees2;
    private final ModelRenderer 0_0_0Degrees2;

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

        MainBody = new ModelRenderer(this);
        MainBody.setRotationPoint(0.0F, 24.0F, 0.0F);
        MainBody.cubeList.add(new ModelBox(MainBody, 0, 10, -5.0F, -10.0F, -5.0F, 1, 10, 10, 0.0F, false));
        MainBody.cubeList.add(new ModelBox(MainBody, 12, 20, 4.0F, -10.0F, -5.0F, 1, 10, 10, 0.0F, false));
        MainBody.cubeList.add(new ModelBox(MainBody, 24, 19, -4.0F, -10.0F, 4.0F, 8, 10, 1, 0.0F, false));
        MainBody.cubeList.add(new ModelBox(MainBody, 0, 0, -4.0F, -10.0F, -5.0F, 8, 1, 9, 0.0F, false));
        MainBody.cubeList.add(new ModelBox(MainBody, 12, 12, -4.0F, -9.0F, -2.0F, 8, 1, 6, 0.0F, false));
        MainBody.cubeList.add(new ModelBox(MainBody, 12, 10, -4.0F, -9.0F, -5.0F, 1, 1, 1, 0.0F, false));
        MainBody.cubeList.add(new ModelBox(MainBody, 12, 12, 3.0F, -9.0F, -5.0F, 1, 1, 1, 0.0F, false));
        MainBody.cubeList.add(new ModelBox(MainBody, 12, 14, 3.0F, -1.0F, -5.0F, 1, 1, 1, 0.0F, false));
        MainBody.cubeList.add(new ModelBox(MainBody, 6, 10, -4.0F, -1.0F, -5.0F, 1, 1, 1, 0.0F, false));

        Horn1 = new ModelRenderer(this);
        Horn1.setRotationPoint(0.0F, 24.0F, 0.0F);

        N40_0_0Degrees = new ModelRenderer(this);
        N40_0_0Degrees.setRotationPoint(0.0F, 0.0F, 0.0F);
        setRotationAngle(N40_0_0Degrees, 0.0F, 0.0F, -0.6981F);
        Horn1.addChild(N40_0_0Degrees);
        N40_0_0Degrees.cubeList.add(new ModelBox(N40_0_0Degrees, 0, 30, 1.0F, -11.0F, -1.0F, 3, 2, 3, 0.0F, false));

        N20_0_0Degrees = new ModelRenderer(this);
        N20_0_0Degrees.setRotationPoint(0.0F, 0.0F, 0.0F);
        setRotationAngle(N20_0_0Degrees, 0.0F, 0.0F, -0.3491F);
        Horn1.addChild(N20_0_0Degrees);
        N20_0_0Degrees.cubeList.add(new ModelBox(N20_0_0Degrees, 0, 0, -2.55F, -13.0F, -0.75F, 2, 3, 2, 0.0F, false));

        N10_0_0Degrees = new ModelRenderer(this);
        N10_0_0Degrees.setRotationPoint(0.0F, 0.0F, 0.0F);
        setRotationAngle(N10_0_0Degrees, 0.0F, 0.0F, -0.1745F);
        Horn1.addChild(N10_0_0Degrees);
        N10_0_0Degrees.cubeList.add(new ModelBox(N10_0_0Degrees, 0, 15, -4.5F, -15.0F, -0.5F, 2, 3, 2, 0.0F, false));

        0_0_0Degrees = new ModelRenderer(this);
        0_0_0Degrees.setRotationPoint(0.0F, 0.0F, 0.0F);
        Horn1.addChild(0_0_0Degrees);
        0_0_0Degrees.cubeList.add(new ModelBox(0_0_0Degrees, 4, 5, -6.7F, -16.0F, -0.1F, 1, 2, 1, 0.0F, false));

        Horn2 = new ModelRenderer(this);
        Horn2.setRotationPoint(0.0F, 24.0F, 1.0F);
        setRotationAngle(Horn2, 0.0F, 3.1416F, 0.0F);

        N40_0_0Degrees2 = new ModelRenderer(this);
        N40_0_0Degrees2.setRotationPoint(0.0F, 0.0F, 0.0F);
        setRotationAngle(N40_0_0Degrees2, 0.0F, 0.0F, -0.6981F);
        Horn2.addChild(N40_0_0Degrees2);
        N40_0_0Degrees2.cubeList.add(new ModelBox(N40_0_0Degrees2, 25, 0, 1.0F, -11.0F, -1.0F, 3, 2, 3, 0.0F, false));

        N20_0_0Degrees2 = new ModelRenderer(this);
        N20_0_0Degrees2.setRotationPoint(0.0F, 0.0F, 0.0F);
        setRotationAngle(N20_0_0Degrees2, 0.0F, 0.0F, -0.3491F);
        Horn2.addChild(N20_0_0Degrees2);
        N20_0_0Degrees2.cubeList.add(new ModelBox(N20_0_0Degrees2, 0, 10, -2.55F, -13.0F, -0.75F, 2, 3, 2, 0.0F, false));

        N10_0_0Degrees2 = new ModelRenderer(this);
        N10_0_0Degrees2.setRotationPoint(0.0F, 0.0F, 0.0F);
        setRotationAngle(N10_0_0Degrees2, 0.0F, 0.0F, -0.1745F);
        Horn2.addChild(N10_0_0Degrees2);
        N10_0_0Degrees2.cubeList.add(new ModelBox(N10_0_0Degrees2, 34, 34, -4.5F, -15.0F, -0.5F, 2, 3, 2, 0.0F, false));

        0_0_0Degrees2 = new ModelRenderer(this);
        0_0_0Degrees2.setRotationPoint(0.0F, 0.0F, 0.0F);
        Horn2.addChild(0_0_0Degrees2);
        0_0_0Degrees2.cubeList.add(new ModelBox(0_0_0Degrees2, 0, 5, -6.7F, -16.0F, -0.1F, 1, 2, 1, 0.0F, false));
    }

    @Override
    public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
        MainBody.render(f5);
        Horn1.render(f5);
        Horn2.render(f5);
    }
    public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
        modelRenderer.rotateAngleX = x;
        modelRenderer.rotateAngleY = y;
        modelRenderer.rotateAngleZ = z;
    }
}

Java variables can't start…
Tue, 12/31/2019 - 10:14

Java variables can't start with numbers, but some of your part names do, for example: 0_0_0Degrees2

You are welcome! I am glad I…
Fri, 01/03/2020 - 08:45

You are welcome! I am glad I could help :) If you like what we do, consider donating to us to help us keep this project up.