Topic category: Help with Minecraft modding (Java Edition)
Hello, I'm new to this mod making thing.
I was trying to make a simple model for a mod in blockbench and when I tried to put the java model file in it said your model name is not a valid java name. I looked it up on the forums, and the solutions wouldn't help me.
Code in the java file:
// Made with Blockbench 3.7.5
// Exported for Minecraft version 1.12
// Paste this class into your mod and generate all required imports
public class custom_model extends ModelBase {
private final ModelRenderer head;
public custom_model() {
textureWidth = 48;
textureHeight = 48;
head = new ModelRenderer(this);
head.setRotationPoint(0.0F, 24.0F, 0.0F);
head.cubeList.add(new ModelBox(head, 24, 9, -8.0F, -30.0F, 1.0F, 8, 8, 1, 0.0F, false));
head.cubeList.add(new ModelBox(head, 14, 14, -1.0F, -30.0F, 2.0F, 1, 8, 6, 0.0F, false));
head.cubeList.add(new ModelBox(head, 24, 0, -8.0F, -30.0F, 8.0F, 8, 8, 1, 0.0F, false));
head.cubeList.add(new ModelBox(head, 0, 14, -8.0F, -30.0F, 2.0F, 1, 8, 6, 0.0F, false));
head.cubeList.add(new ModelBox(head, 0, 7, -7.0F, -30.0F, 2.0F, 6, 1, 6, 0.0F, false));
head.cubeList.add(new ModelBox(head, 0, 0, -7.0F, -23.0F, 2.0F, 6, 1, 6, 0.0F, false));
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
head.render(f5);
}
public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
Please help.
Try to erase the first 3 line (With notepad or anything) so it will look like this
public class custom_model extends ModelBase {
private final ModelRenderer head;
public custom_model() {
textureWidth = 48;
textureHeight = 48;
head = new ModelRenderer(this);
head.setRotationPoint(0.0F, 24.0F, 0.0F);
head.cubeList.add(new ModelBox(head, 24, 9, -8.0F, -30.0F, 1.0F, 8, 8, 1, 0.0F, false));
head.cubeList.add(new ModelBox(head, 14, 14, -1.0F, -30.0F, 2.0F, 1, 8, 6, 0.0F, false));
head.cubeList.add(new ModelBox(head, 24, 0, -8.0F, -30.0F, 8.0F, 8, 8, 1, 0.0F, false));
head.cubeList.add(new ModelBox(head, 0, 14, -8.0F, -30.0F, 2.0F, 1, 8, 6, 0.0F, false));
head.cubeList.add(new ModelBox(head, 0, 7, -7.0F, -30.0F, 2.0F, 6, 1, 6, 0.0F, false));
head.cubeList.add(new ModelBox(head, 0, 0, -7.0F, -23.0F, 2.0F, 6, 1, 6, 0.0F, false));
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
head.render(f5);
}
public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
Yup, that worked. Thanks man