your model name is not a valid Java name! Help

Started by Hgha on

Topic category: Help with modding (Java Edition)

Last seen on 15:36, 11. Sep 2020
Joined May 2019
Points:

User statistics:

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

Hi i want to add a 3d model to MCreator. I used a Blockbench. When import java file Mcreator show error. How can i decide problem

 

public class custom_model extends EntityModel<Entity> {
    private final ModelRenderer legs;
    private final ModelRenderer body;
    private final ModelRenderer head;
    private final ModelRenderer left_arm;
    private final ModelRenderer right_arm;

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

        legs = new ModelRenderer(this);
        legs.setRotationPoint(0.0F, 8.0F, -3.0F);
        legs.setTextureOffset(0, 0).addBox(-1.0F, 9.0F, 0.0F, 1.0F, 6.0F, 3.0F, 0.0F, false);
        legs.setTextureOffset(0, 0).addBox(3.0F, 9.0F, 0.0F, 1.0F, 6.0F, 3.0F, 0.0F, false);
        legs.setTextureOffset(0, 0).addBox(1.0F, 9.0F, 0.0F, 1.0F, 6.0F, 3.0F, 0.0F, false);
        legs.setTextureOffset(0, 0).addBox(-5.0F, 9.0F, 0.0F, 1.0F, 6.0F, 3.0F, 0.0F, false);
        legs.setTextureOffset(0, 0).addBox(-3.0F, 9.0F, 0.0F, 1.0F, 6.0F, 3.0F, 0.0F, false);

        body = new ModelRenderer(this);
        body.setRotationPoint(0.0F, 24.0F, 0.0F);
        body.setTextureOffset(0, 0).addBox(-6.0F, -16.0F, -5.0F, 12.0F, 9.0F, 9.0F, 0.0F, false);

        head = new ModelRenderer(this);
        head.setRotationPoint(0.0F, 8.0F, -3.0F);
        head.setTextureOffset(0, 0).addBox(-3.0F, -5.0F, 0.0F, 6.0F, 5.0F, 5.0F, 0.0F, false);

        left_arm = new ModelRenderer(this);
        left_arm.setRotationPoint(0.0F, 24.0F, 0.0F);
        left_arm.setTextureOffset(0, 0).addBox(-9.0F, -15.0F, -2.0F, 2.0F, 10.0F, 3.0F, 0.0F, false);

        right_arm = new ModelRenderer(this);
        right_arm.setRotationPoint(-8.0F, -8.0F, 0.0F);
        left_arm.addChild(right_arm);
        right_arm.setTextureOffset(0, 0).addBox(14.0F, -7.0F, -2.0F, 2.0F, 10.0F, 3.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){
        legs.render(matrixStack, buffer, packedLight, packedOverlay);
        body.render(matrixStack, buffer, packedLight, packedOverlay);
        head.render(matrixStack, buffer, packedLight, packedOverlay);
        left_arm.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;
    }
}

Last seen on 16:24, 20. Nov 2020
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
theres an easy fix for this…
Sun, 06/28/2020 - 18:12

theres an easy fix for this. Load up blockbench and then the model, click on file, then project and change the model identifier to the name of the model 

Last seen on 16:48, 17. Dec 2020
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Blockbench/MCreator tend to…
Sun, 06/28/2020 - 19:06

Blockbench/MCreator tend to not like underscores in the filename. Try removing the underscores in the file and bone names, see if that does the trick.