Why can't I import my Blockbench java model?

Started by JeremySeq on

Topic category: Troubleshooting, bugs, and solutions

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Why can't I import my Blockbench java model?

I export my blockbench model as a java file, but when I import it into MCreator it says:  "Your model name is not a valid Java name. Custom mob models cannot contain whitespace, start with number or contain any non ASCII letters. Model name is not filename, but the name inside the model Java code (model class name)!". 

Help please!

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
// Made with Blockbench 3.5…
Wed, 05/06/2020 - 23:23

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

public class custom_model extends EntityModel<Entity> {
    private final ModelRenderer Penguin;
    private final ModelRenderer Head;
    private final ModelRenderer Body;
    private final ModelRenderer LeftFlipper;
    private final ModelRenderer RightFlipper;
    private final ModelRenderer RightFoot;
    private final ModelRenderer LeftFoot;

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

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

        Head = new ModelRenderer(this);
        Head.setRotationPoint(0.0F, -14.0F, 0.0F);
        Penguin.addChild(Head);
        Head.setTextureOffset(12, 41).addBox(0.0F, -2.0F, -3.0F, 2.0F, 1.0F, 1.0F, 0.0F, false);
        Head.setTextureOffset(0, 17).addBox(-2.0F, -6.0F, -2.0F, 6.0F, 6.0F, 5.0F, 0.0F, false);

        Body = new ModelRenderer(this);
        Body.setRotationPoint(0.0F, 14.0F, 0.0F);
        Head.addChild(Body);
        Body.setTextureOffset(0, 0).addBox(-3.0F, -14.0F, -1.0F, 8.0F, 13.0F, 4.0F, 0.0F, false);
        Body.setTextureOffset(24, 0).addBox(-2.0F, -13.0F, -2.0F, 6.0F, 10.0F, 6.0F, 0.0F, false);

        LeftFlipper = new ModelRenderer(this);
        LeftFlipper.setRotationPoint(0.0F, 0.0F, 0.0F);
        Penguin.addChild(LeftFlipper);
        LeftFlipper.setTextureOffset(28, 28).addBox(5.0F, -14.0F, -1.0F, 1.0F, 9.0F, 4.0F, 0.0F, false);
        LeftFlipper.setTextureOffset(6, 41).addBox(5.0F, -5.0F, 1.0F, 1.0F, 2.0F, 2.0F, 0.0F, false);
        LeftFlipper.setTextureOffset(18, 41).addBox(5.0F, -5.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);

        RightFlipper = new ModelRenderer(this);
        RightFlipper.setRotationPoint(0.0F, 0.0F, 0.0F);
        Penguin.addChild(RightFlipper);
        RightFlipper.setTextureOffset(18, 28).addBox(-4.0F, -14.0F, -1.0F, 1.0F, 9.0F, 4.0F, 0.0F, false);
        RightFlipper.setTextureOffset(0, 41).addBox(-4.0F, -5.0F, 1.0F, 1.0F, 2.0F, 2.0F, 0.0F, false);
        RightFlipper.setTextureOffset(12, 43).addBox(-4.0F, -5.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);

        RightFoot = new ModelRenderer(this);
        RightFoot.setRotationPoint(0.0F, 0.0F, 0.0F);
        Penguin.addChild(RightFoot);
        RightFoot.setTextureOffset(22, 17).addBox(-3.0F, -1.0F, -3.0F, 3.0F, 1.0F, 6.0F, 0.0F, false);

        LeftFoot = new ModelRenderer(this);
        LeftFoot.setRotationPoint(0.0F, 0.0F, 0.0F);
        Penguin.addChild(LeftFoot);
        LeftFoot.setTextureOffset(0, 28).addBox(2.0F, -1.0F, -3.0F, 3.0F, 1.0F, 6.0F, 0.0F, false);
    }

    @Override
    public void setRotationAngles(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){
        //previously the render function, render code was moved to a method below
    }

    @Override
    public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){
        Penguin.render(matrixStack, buffer, packedLight, packedOverlay);
    }

    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:
That is the code for my…
Wed, 05/06/2020 - 23:23

That is the code for my Blockbench model.

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I've got it! Try using 2020…
Wed, 05/06/2020 - 23:39

I've got it! Try using 2020.3 Snapshot!

Joined Apr 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
1.open it in Blockbench 2…
Wed, 05/06/2020 - 23:39

1.open it in Blockbench
2. File>Properties
3. Put the name of your model in first 2 tables than export
4. Import it to MCR
5. Just as note, I think MCR does not import models from Blockbench correctly in some cases as this bug report says: #60020

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Remove the comments at the…
Wed, 05/13/2020 - 04:14

Remove the comments at the top. Worked in my case - I think it just looks at the first line for some reason.

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
remove capital letters and…
Sat, 03/13/2021 - 17:57

remove capital letters and spaces from the the "folder" and "cube" names in blockbench AS WELL AS from the actual .java name.

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
"Custom mob models cannot…
Sat, 03/13/2021 - 17:58

"Custom mob models cannot contain whitespace, start with number or contain any non ASCII letters" 
this counts for the cubes and folders u made with blockbench