Started by
Mariolover63
on
Topic category: Troubleshooting, bugs, and solutions
I was making a plush for my mod, BUT when I try to import the model for it, the error 'Your model name is invalid' shows up. The filename is plush.java by the way.
Actually that was my old one, this one is the one i want to use:
//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 splodesquatch extends ModelBase {
private final ModelRenderer Body1;
private final ModelRenderer Body;
private final ModelRenderer Head1;
private final ModelRenderer Neck;
private final ModelRenderer Head;
private final ModelRenderer Leg1;
private final ModelRenderer Leg2;
private final ModelRenderer Leg3;
private final ModelRenderer Leg4;
public () {
textureWidth = 64;
textureHeight = 64;
Body1 = new ModelRenderer(this);
Body1.setRotationPoint(0.0F, 0.0F, 0.0F);
setRotationAngle(Body1, 0.2618F, 0.0F, 0.0F);
Body.addChild(Body1);
Body1.cubeList.add(new ModelBox(Body1, 0, 0, -6.0F, -17.9496F, -2.6143F, 12, 12, 12, 0.0F, false));
Body = new ModelRenderer(this);
Body.setRotationPoint(0.0F, 24.0F, 0.0F);
Body.cubeList.add(new ModelBox(Body, 30, 36, -3.0026F, -22.5F, -3.0026F, 6, 6, 6, 0.0F, false));
Head1 = new ModelRenderer(this);
Head1.setRotationPoint(0.0F, -3.0F, 0.0F);
setRotationAngle(Head1, 0.0873F, 0.0F, 0.0F);
Neck.addChild(Head1);
Head1.cubeList.add(new ModelBox(Head1, 0, 24, -4.5026F, -9.0F, -6.0026F, 9, 9, 9, 0.0F, false));
Neck = new ModelRenderer(this);
Neck.setRotationPoint(0.0F, 0.0F, 0.0F);
Head.addChild(Neck);
Neck.cubeList.add(new ModelBox(Neck, 0, 0, -1.5026F, -4.0F, -1.5026F, 3, 4, 3, 0.0F, false));
Head = new ModelRenderer(this);
Head.setRotationPoint(0.0F, 1.5F, 0.0F);
Leg1 = new ModelRenderer(this);
Leg1.setRotationPoint(5.25F, 7.5F, -6.0F);
Leg1.cubeList.add(new ModelBox(Leg1, 0, 42, -1.5F, 0.0F, -1.5F, 3, 17, 3, 0.0F, false));
Leg2 = new ModelRenderer(this);
Leg2.setRotationPoint(-5.25F, 7.5F, -6.0F);
Leg2.cubeList.add(new ModelBox(Leg2, 0, 42, -1.5F, 0.0F, -1.5F, 3, 17, 3, 0.0F, false));
Leg3 = new ModelRenderer(this);
Leg3.setRotationPoint(5.25F, 13.5F, 6.0F);
Leg3.cubeList.add(new ModelBox(Leg3, 0, 48, -1.5F, 0.0F, -1.5F, 3, 11, 3, 0.0F, false));
Leg4 = new ModelRenderer(this);
Leg4.setRotationPoint(-5.25F, 13.5F, 6.0F);
Leg4.cubeList.add(new ModelBox(Leg4, 0, 48, -1.5F, 0.0F, -1.5F, 3, 11, 3, 0.0F, false));
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
Body.render(f5);
Head.render(f5);
Leg1.render(f5);
Leg2.render(f5);
Leg3.render(f5);
Leg4.render(f5);
}
public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
Replace
public () {
with
public splodesquatch () {
too.
Thanks! works perfectly now!
it still has the error
hey. im trying to import a model (java) and it just keeps saying "Custom mob model names cannot contain any whitespace, start with numbers, or cotain any no ASCII letters."
Klemen, i fixed the first problem myself but when i import the model, there is no error, it just doesn't appear in resources
Make sure to set a valid name of the model before exporting it to JAVA.
i was reading through this but nothing silved it for me
// 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 goblincave extends EntityModel<Entity> {
private final ModelRenderer head;
private final ModelRenderer legleft;
private final ModelRenderer legright;
private final ModelRenderer armleft;
private final ModelRenderer armright;
private final ModelRenderer jaw;
private final ModelRenderer body;
public goblincave() {
textureWidth = 64;
textureHeight = 64;
head = new ModelRenderer(this);
head.setRotationPoint(0.0F, 24.0F, 0.0F);
head.setTextureOffset(0, 21).addBox(-4.0F, -14.0F, -4.0F, 8.0F, 3.0F, 5.0F, 0.0F, false);
head.setTextureOffset(21, 21).addBox(-1.0F, -13.0F, -6.0F, 2.0F, 1.0F, 2.0F, 0.0F, false);
head.setTextureOffset(8, 25).addBox(-4.0F, -17.0F, -3.0F, 0.0F, 4.0F, 4.0F, 0.0F, false);
head.setTextureOffset(0, 25).addBox(4.0F, -17.0F, -3.0F, 0.0F, 4.0F, 4.0F, 0.0F, false);
legleft = new ModelRenderer(this);
legleft.setRotationPoint(0.0F, 24.0F, 0.0F);
legleft.setTextureOffset(28, 21).addBox(-7.0F, -5.0F, -1.0F, 1.0F, 5.0F, 3.0F, 0.0F, false);
legright = new ModelRenderer(this);
legright.setRotationPoint(0.0F, 24.0F, 0.0F);
legright.setTextureOffset(23, 26).addBox(6.0F, -5.0F, -1.0F, 1.0F, 5.0F, 3.0F, 0.0F, false);
armleft = new ModelRenderer(this);
armleft.setRotationPoint(0.0F, 24.0F, 0.0F);
armleft.setTextureOffset(16, 29).addBox(-7.0F, -8.0F, -5.0F, 1.0F, 6.0F, 2.0F, 0.0F, false);
armright = new ModelRenderer(this);
armright.setRotationPoint(0.0F, 24.0F, 0.0F);
jaw = new ModelRenderer(this);
jaw.setRotationPoint(0.0F, 24.0F, 0.0F);
jaw.setTextureOffset(0, 14).addBox(-5.0F, -11.0F, -5.0F, 10.0F, 1.0F, 6.0F, 0.0F, false);
body = new ModelRenderer(this);
body.setRotationPoint(0.0F, 24.0F, 0.0F);
body.setTextureOffset(0, 0).addBox(-6.0F, -10.0F, -4.0F, 12.0F, 7.0F, 7.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){
head.render(matrixStack, buffer, packedLight, packedOverlay);
legleft.render(matrixStack, buffer, packedLight, packedOverlay);
legright.render(matrixStack, buffer, packedLight, packedOverlay);
armleft.render(matrixStack, buffer, packedLight, packedOverlay);
armright.render(matrixStack, buffer, packedLight, packedOverlay);
jaw.render(matrixStack, buffer, packedLight, packedOverlay);
body.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;
}
}
https://mcreator.net/tracker/issue/60446
ty!
Np :)
I have the same problem and I tried to do all your advice to repair this problem but nothing is actually working. My filename is casque.java. Thanks for your help
https://www.youtube.com/watch?v=g0MuAEV7zIA&list=PLAeL-oIFIEngE6jRgFYeFMfuj8WQsO3Ei&index=71&t=0s
I followed through and it still replies with "Your model name is not a valid Java name"
I have edited everything but still.