Your model name is not a valid Java name!

Started by SoyElDerp on

Topic category: Help with modding (Java Edition)

Last seen on 22:37, 4. Feb 2021
Joined Aug 2019
Points:

User statistics:

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

I have been making a mod for version 1.12.2, but I created a model in Blockbench which is a helmet, but when wanting to import it as java I get that error, the model code is the following:

 

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

public class MEGO extends EntityModel<Entity> {
    private final ModelRenderer bone;

    public MEGO() {
        textureWidth = 16;
        textureHeight = 16;

        bone = new ModelRenderer(this);
        bone.setRotationPoint(0.0F, 24.0F, 0.0F);
        bone.setTextureOffset(0, 10).addBox(-6.0F, -2.0F, -8.0F, 12.0F, 2.0F, 2.0F, 0.0F, false);
        bone.setTextureOffset(0, 2).addBox(6.0F, -2.0F, -8.0F, 2.0F, 2.0F, 16.0F, 0.0F, false);
        bone.setTextureOffset(0, 10).addBox(-8.0F, -2.0F, -8.0F, 2.0F, 2.0F, 16.0F, 0.0F, false);
        bone.setTextureOffset(0, 10).addBox(-6.0F, -2.0F, 6.0F, 12.0F, 2.0F, 2.0F, 0.0F, false);
        bone.setTextureOffset(0, 10).addBox(-8.0F, -10.0F, -8.0F, 16.0F, 8.0F, 16.0F, 0.0F, false);
        bone.setTextureOffset(0, 10).addBox(1.0F, -2.0F, -2.0F, 1.0F, 1.0F, 4.0F, 0.0F, false);
        bone.setTextureOffset(0, 10).addBox(-2.0F, -2.0F, -2.0F, 1.0F, 1.0F, 4.0F, 0.0F, false);
        bone.setTextureOffset(0, 10).addBox(-1.0F, -2.0F, 1.0F, 2.0F, 1.0F, 1.0F, 0.0F, false);
        bone.setTextureOffset(0, 10).addBox(-1.0F, -2.0F, -2.0F, 2.0F, 1.0F, 1.0F, 0.0F, false);
        bone.setTextureOffset(0, 4).addBox(-5.0F, -12.0F, -5.0F, 4.0F, 2.0F, 4.0F, 0.0F, false);
        bone.setTextureOffset(0, 4).addBox(1.0F, -12.0F, -5.0F, 4.0F, 2.0F, 4.0F, 0.0F, false);
        bone.setTextureOffset(0, 4).addBox(-5.0F, -12.0F, 1.0F, 4.0F, 2.0F, 4.0F, 0.0F, false);
        bone.setTextureOffset(0, 4).addBox(1.0F, -12.0F, 1.0F, 4.0F, 2.0F, 4.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){
        bone.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;
    }
}