Your model is not a valid Java model!

Started by zacreep on

Topic category: Troubleshooting, bugs, and solutions

Joined Nov 2019
Points:

User statistics:

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

Every time i try importing my model i made in blockbench it says this, i checked the code and the names match aswell as the project name and file name. I don't know what else to try, i tried everything in this post https://mcreator.net/comment/96007 but its still not working, heres my code:

//Made with Blockbench
//Paste this code into your mod.

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 lastorc extends ModelBase {
    private final ModelRenderer body;
    private final ModelRenderer head;
    private final ModelRenderer teeth;
    private final ModelRenderer left arm;
    private final ModelRenderer right arm;
    private final ModelRenderer sash;
    private final ModelRenderer armor;
    private final ModelRenderer left leg;
    private final ModelRenderer right leg;

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

        body = new ModelRenderer(this);
        body.setRotationPoint(0.0F, 8.0F, 0.0F);
        body.cubeList.add(new ModelBox(body, 0, 16, -4.0F, -1.0F, -3.0F, 8, 4, 6, 0.0F, false));
        body.cubeList.add(new ModelBox(body, 24, 24, -4.0F, -10.0F, -2.0F, 8, 9, 4, 0.0F, false));

        head = new ModelRenderer(this);
        head.setRotationPoint(0.0F, -12.0F, 0.0F);
        body.addChild(head);
        head.cubeList.add(new ModelBox(head, 0, 0, -5.0F, -7.0F, -3.0F, 10, 9, 7, 0.0F, false));
        head.cubeList.add(new ModelBox(head, 28, 19, -4.0F, -1.0F, -4.0F, 8, 3, 1, 0.0F, false));

        teeth = new ModelRenderer(this);
        teeth.setRotationPoint(0.0F, 10.0F, 0.0F);
        setRotationAngle(teeth, 0.1745F, 0.0F, 0.0F);
        head.addChild(teeth);
        teeth.cubeList.add(new ModelBox(teeth, 0, 3, -3.0F, -13.0F, -2.0F, 1, 2, 1, 0.0F, false));
        teeth.cubeList.add(new ModelBox(teeth, 0, 0, 2.0F, -13.0F, -2.0F, 1, 2, 1, 0.0F, false));

        left arm = new ModelRenderer(this);
        left arm.setRotationPoint(6.0F, -8.0F, 0.0F);
        body.addChild(left arm);
        left arm.cubeList.add(new ModelBox(left arm, 0, 44, -2.0F, -2.0F, -2.0F, 4, 11, 4, 0.0F, false));

        right arm = new ModelRenderer(this);
        right arm.setRotationPoint(-6.0F, -8.0F, 0.0F);
        body.addChild(right arm);
        right arm.cubeList.add(new ModelBox(right arm, 40, 0, -2.0F, -2.0F, -2.0F, 4, 11, 4, 0.0F, false));

        sash = new ModelRenderer(this);
        sash.setRotationPoint(0.0F, -5.0F, 0.0F);
        setRotationAngle(sash, 0.0F, 0.0F, -0.6109F);
        body.addChild(sash);
        sash.cubeList.add(new ModelBox(sash, 0, 26, -2.0F, -7.0F, -3.0F, 2, 12, 6, 0.0F, false));
        sash.cubeList.add(new ModelBox(sash, 26, 8, -4.0F, -9.0F, -4.0F, 3, 3, 8, 0.0F, false));

        armor = new ModelRenderer(this);
        armor.setRotationPoint(0.0F, 0.0F, 0.0F);
        setRotationAngle(armor, 0.0F, 0.0F, 0.0873F);
        sash.addChild(armor);
        armor.cubeList.add(new ModelBox(armor, 44, 15, -2.0F, -9.0F, -4.0F, 2, 3, 8, 0.0F, false));
        armor.cubeList.add(new ModelBox(armor, 48, 48, -3.0F, -10.0F, -2.0F, 2, 4, 4, 0.0F, false));

        left leg = new ModelRenderer(this);
        left leg.setRotationPoint(2.0F, 13.0F, 0.0F);
        left leg.cubeList.add(new ModelBox(left leg, 38, 38, -2.0F, 7.0F, -3.0F, 5, 4, 6, 0.0F, false));
        left leg.cubeList.add(new ModelBox(left leg, 16, 47, -2.0F, -2.0F, -2.0F, 4, 9, 4, 0.0F, false));

        right leg = new ModelRenderer(this);
        right leg.setRotationPoint(-2.0F, 14.0F, 0.0F);
        right leg.cubeList.add(new ModelBox(right leg, 16, 37, -3.0F, 6.0F, -3.0F, 5, 4, 6, 0.0F, false));
        right leg.cubeList.add(new ModelBox(right leg, 32, 48, -2.0F, -3.0F, -2.0F, 4, 9, 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);
        left leg.render(f5);
        right leg.render(f5);
    }
    public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
        modelRenderer.rotateAngleX = x;
        modelRenderer.rotateAngleY = y;
        modelRenderer.rotateAngleZ = z;
    }
}

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey. In regards to this…
Sat, 05/02/2020 - 17:31

Hey. In regards to this problem how do you access the code in the first place, and how do you fix the code?

 

Thanks

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
im also having trouble with…
Thu, 05/14/2020 - 20:44

im also having trouble with this and i dont understand how to fix it just by looking at this topic

Joined Jun 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
//Made with Blockbench /…
Thu, 05/14/2020 - 21:25

//Made with Blockbench
//Paste this code into your mod.

 

remove this

Joined Jul 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I've done everything, but it…
Mon, 07/17/2023 - 04:38

I've done everything, but it still says "not valid java model"

this is my code:

 


public class 155566 extends EntityModel {
    private final RendererModel bb_main;

    public 155566() {
        texWidth = 64;
        texHeight = 64;

        bb_main = new RendererModel(this);
        bb_main.setPos(0.0F, 24.0F, 0.0F);
        bb_main.cubes.add(new ModelBox(bb_main, 0, 0, -4.0F, -20.0F, -4.6F, 9, 9, 9, 0.0F, false));
        bb_main.cubes.add(new ModelBox(bb_main, 0, 18, -4.2F, -19.15F, -3.9F, 2, 7, 7, 0.0F, false));
        bb_main.cubes.add(new ModelBox(bb_main, 0, 0, -4.5F, -16.7F, -1.0F, 2, 2, 2, 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(RendererModel modelRenderer, float x, float y, float z) {
        modelRenderer.xRot = x;
        modelRenderer.yRot = y;
        modelRenderer.zRot = z;
    }
}

155566 is not a valid Java…
Mon, 07/17/2023 - 06:10

155566 is not a valid Java name.

The solution to this problem and many other problems can be found in our knowledge base: https://mcreator.net/support/knowledgebase Please check the knowledge base before opening a new topic on the issue which has a known fix.

Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
your model is not a valid…
Thu, 12/21/2023 - 22:25

your model is not a valid java model

can u help me?


public teste1 class<T extends Entity> extends EntityModel<T> {
    // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor
    public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation("modid", "teste1"), "main");
    private final ModelPart cabeca;
    private final ModelPart pescoco;
    private final ModelPart corpo;
    private final ModelPart cauda;
    private final ModelPart pernas;
    private final ModelPart bone6;
    private final ModelPart bone7;
    private final ModelPart pes;
    private final ModelPart bone8;

    public teste1(ModelPart root) {
        this.cabeca = root.getChild("cabeca");
        this.pescoco = root.getChild("pescoco");
        this.corpo = root.getChild("corpo");
        this.cauda = root.getChild("cauda");
        this.pernas = root.getChild("pernas");
        this.bone6 = root.getChild("bone6");
        this.bone7 = root.getChild("bone7");
        this.pes = root.getChild("pes");
        this.bone8 = root.getChild("bone8");
    }

 

If you need the entire code let me know, please

Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I used blockbench, and…
Fri, 12/22/2023 - 19:46

I used blockbench, and deleted the top lines (made by blockbench...

Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I just tried to solve it by…
Sat, 12/23/2023 - 15:52

I just tried to solve it by changing some names that could be wrong, but it didn't work. what should I do? try to redo the model with some tool so that the code comes out correctly?

I believe blockbench…
Sat, 12/23/2023 - 16:24

I believe blockbench generates valid code as long as you set the model name correctly in the tool itself and then don't manually alter the code without Java knowledge