Topic category: Troubleshooting, bugs, and solutions
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;
}
}
I only modified it because it was already giving errors, but it was the white space error (name) and after I modified it it started giving the invalidated model error
The unmodified code is here:
// Made with Blockbench 4.9.2
// Exported for Minecraft version 1.17 or later with Mojang mappings
// Paste this class into your mod and generate all required imports
public class Rex<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", "rex"), "main");
private final ModelPart cabeca;
private final ModelPart pescoco;
private final ModelPart corpo;
private final ModelPart cauda;
private final ModelPart pernas;
private final ModelPart coxad;
private final ModelPart coxae;
private final ModelPart peE;
private final ModelPart ped;
public Rex(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.coxad = root.getChild("coxad");
this.coxae = root.getChild("coxae");
this.peE = root.getChild("peE");
this.ped = root.getChild("ped");
}
Unmodified code looks ok on the first glance
now, it says that there is a white space in the name when I import it into mcreator
I redid it in another version
// Made with Blockbench 3.8.3
// Exported for Minecraft version 1.7 - 1.12
// Paste this class into your mod and generate all required imports
public class custom_model extends ModelBase {
private final ModelRenderer cabeca;
private final ModelRenderer frentec;
private final ModelRenderer cube_r1;
private final ModelRenderer maxdenteb;
private final ModelRenderer cube_r2;
private final ModelRenderer dentec;
private final ModelRenderer pescoco;
private final ModelRenderer cube_r3;
private final ModelRenderer corpo;
private final ModelRenderer cube_r4;
private final ModelRenderer cube_r5;
private final ModelRenderer braco;
private final ModelRenderer e_r1;
private final ModelRenderer cauda;
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 pernas;
private final ModelRenderer pantd;
private final ModelRenderer di_r1;
private final ModelRenderer pante;
private final ModelRenderer es_r1;
private final ModelRenderer coxad;
private final ModelRenderer di_r2;
private final ModelRenderer coxae;
private final ModelRenderer es_r2;
private final ModelRenderer peE;
private final ModelRenderer ped;
public custom_model() {
textureWidth = 256;
textureHeight = 256;
but it's still giving the whitespace error
What MC version are you working with?
2020.2 (1.12.2)
Ok this is old version and may have bugs with importing models so not sure if we can help there. 1.12.2 is no longer supported
ok, thank you very much for your help so far, I'll try to do it in a newer version
The solution is simple, download a old version of blockbench, and stay happy!
https://www.blockbench.net/downloads/#v3.4.1