Entity with custom model not compiling.

Started by TheDuckKnight_Mc on

Topic category: Help with modding (Java Edition)

Last seen on 08:24, 14. Nov 2021
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Entity with custom model not compiling.

Here's what appears in the console, when the mod doesn't compile properly when using a custom model:

10 errors
> Task :compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.3/userguide/command_line_interface.html#se…
BUILD FAILED in 9s
1 actionable task: 1 executed
BUILD FAILED
Task completed in 12566 milliseconds
 

and here's the model code:

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

public class endknightplease extends EntityModel<Entity> {
    private final ModelRenderer body;
    private final ModelRenderer belly;
    private final ModelRenderer arm_left;
    private final ModelRenderer arm_part2;
    private final ModelRenderer arm_right;
    private final ModelRenderer arm_part;
    private final ModelRenderer sword;
    private final ModelRenderer head;
    private final ModelRenderer horns;
    private final ModelRenderer 2;
    private final ModelRenderer 3;
    private final ModelRenderer leg_right;
    private final ModelRenderer bone2;
    private final ModelRenderer legthingright2;
    private final ModelRenderer leg_left;
    private final ModelRenderer bone;
    private final ModelRenderer legthingleft;

    public endknightplease() {
        textureWidth = 128;
        textureHeight = 128;

        body = new ModelRenderer(this);
        body.setRotationPoint(0.0F, 24.0F, 0.0F);
        

        belly = new ModelRenderer(this);
        belly.setRotationPoint(0.0F, 1.0F, 5.0F);
        body.addChild(belly);
        setRotationAngle(belly, 0.0873F, 0.0F, 0.0F);
        belly.setTextureOffset(104, 0).addBox(-4.0F, -40.9734F, -0.3899F, 8.0F, 16.0F, 4.0F, 0.0F, false);

        arm_left = new ModelRenderer(this);
        arm_left.setRotationPoint(4.0F, -40.0F, 4.0F);
        body.addChild(arm_left);
        arm_left.setTextureOffset(0, 0).addBox(0.0F, 0.0F, -3.0F, 3.0F, 10.0F, 3.0F, 0.0F, false);

        arm_part2 = new ModelRenderer(this);
        arm_part2.setRotationPoint(-7.0F, 20.0F, -2.0F);
        arm_left.addChild(arm_part2);
        setRotationAngle(arm_part2, -0.4363F, 0.0F, 0.0F);
        arm_part2.setTextureOffset(0, 49).addBox(7.0F, -9.9826F, -6.0999F, 3.0F, 12.0F, 3.0F, 0.0F, false);

        arm_right = new ModelRenderer(this);
        arm_right.setRotationPoint(-4.0F, -40.0F, 2.0F);
        body.addChild(arm_right);
        arm_right.setTextureOffset(0, 0).addBox(-3.0F, 0.0F, -1.0F, 3.0F, 10.0F, 3.0F, 0.0F, false);

        arm_part = new ModelRenderer(this);
        arm_part.setRotationPoint(1.0F, 22.0F, 0.0F);
        arm_right.addChild(arm_part);
        setRotationAngle(arm_part, -0.4363F, 0.0F, 0.0F);
        arm_part.setTextureOffset(0, 49).addBox(-4.0F, -12.4052F, -5.1936F, 3.0F, 12.0F, 3.0F, 0.0F, false);

        sword = new ModelRenderer(this);
        sword.setRotationPoint(0.0F, 11.0F, 2.0F);
        arm_right.addChild(sword);
        setRotationAngle(sword, 1.1345F, 0.0F, 0.0F);
        sword.setTextureOffset(47, 79).addBox(-2.5F, -8.5774F, -9.9063F, 2.0F, 9.0F, 2.0F, 0.0F, false);
        sword.setTextureOffset(44, 74).addBox(-3.5F, -18.7759F, -11.054F, 4.0F, 14.0F, 4.0F, 0.0F, false);

        head = new ModelRenderer(this);
        head.setRotationPoint(0.0F, -40.0F, 3.0F);
        body.addChild(head);
        setRotationAngle(head, 0.1745F, 0.0F, 0.0F);
        head.setTextureOffset(104, 19).addBox(-3.0F, -6.0F, -3.0F, 6.0F, 6.0F, 6.0F, 0.0F, false);

        horns = new ModelRenderer(this);
        horns.setRotationPoint(3.0F, 0.0F, -3.0F);
        head.addChild(horns);
        horns.setTextureOffset(0, 124).addBox(-8.0F, -5.0069F, 1.8425F, 2.0F, 2.0F, 2.0F, 0.0F, false);
        horns.setTextureOffset(0, 124).addBox(0.0F, -5.0069F, 1.8425F, 2.0F, 2.0F, 2.0F, 0.0F, false);

        2 = new ModelRenderer(this);
        2.setRotationPoint(14.0F, 34.8485F, -1.4695F);
        horns.addChild(2);
        setRotationAngle(2, 0.0F, 0.0F, -0.3491F);
        2.setTextureOffset(0, 123).addBox(-7.599F, -47.1267F, 3.5566F, 2.0F, 3.0F, 2.0F, 0.0F, false);

        3 = new ModelRenderer(this);
        3.setRotationPoint(-18.0F, 38.0114F, 0.2615F);
        horns.addChild(3);
        setRotationAngle(3, 0.0F, 0.0F, 0.3491F);
        3.setTextureOffset(0, 123).addBox(2.5387F, -49.2896F, 1.8257F, 2.0F, 3.0F, 2.0F, 0.0F, false);

        leg_right = new ModelRenderer(this);
        leg_right.setRotationPoint(-3.0F, -26.0F, 3.0F);
        body.addChild(leg_right);
        leg_right.setTextureOffset(64, 28).addBox(-1.0F, 23.0F, -3.0F, 3.0F, 3.0F, 2.0F, 0.0F, false);
        leg_right.setTextureOffset(0, 21).addBox(-1.0F, 17.0F, -1.0F, 3.0F, 9.0F, 3.0F, 0.0F, false);

        bone2 = new ModelRenderer(this);
        bone2.setRotationPoint(10.0F, 24.0F, 1.0F);
        leg_right.addChild(bone2);
        setRotationAngle(bone2, 0.6109F, 0.0F, 0.0F);
        bone2.setTextureOffset(55, 52).addBox(-11.0F, -14.2429F, 1.2296F, 3.0F, 9.0F, 3.0F, 0.0F, false);

        legthingright2 = new ModelRenderer(this);
        legthingright2.setRotationPoint(5.0F, 22.0F, -13.0F);
        leg_right.addChild(legthingright2);
        setRotationAngle(legthingright2, -0.4363F, 0.0F, 0.0F);
        legthingright2.setTextureOffset(116, 46).addBox(-6.0F, -27.0F, 2.0F, 3.0F, 15.0F, 3.0F, 0.0F, false);

        leg_left = new ModelRenderer(this);
        leg_left.setRotationPoint(3.0F, -26.0F, 3.0F);
        body.addChild(leg_left);
        leg_left.setTextureOffset(64, 28).addBox(-2.0F, 23.0F, -3.0F, 3.0F, 3.0F, 2.0F, 0.0F, false);
        leg_left.setTextureOffset(0, 21).addBox(-2.0F, 17.0F, -1.0F, 3.0F, 9.0F, 3.0F, 0.0F, false);

        bone = new ModelRenderer(this);
        bone.setRotationPoint(0.0F, 24.0F, 1.0F);
        leg_left.addChild(bone);
        setRotationAngle(bone, 0.6109F, 0.0F, 0.0F);
        bone.setTextureOffset(56, 52).addBox(-2.0F, -14.2429F, 1.2296F, 3.0F, 9.0F, 3.0F, 0.0F, false);

        legthingleft = new ModelRenderer(this);
        legthingleft.setRotationPoint(-5.0F, 26.0F, -7.0F);
        leg_left.addChild(legthingleft);
        setRotationAngle(legthingleft, -0.4363F, 0.0F, 0.0F);
        legthingleft.setTextureOffset(116, 46).addBox(3.0F, -28.0F, -5.0F, 3.0F, 15.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){
        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;
    }
}

 

Certain model folder names are not particularly genius so I apologise.

You trimmed out the most…
Tue, 06/02/2020 - 11:43

You trimmed out the most important part of the log. Full logs

Also, logs and code belongs to pastebin.

   private final…
Tue, 06/02/2020 - 11:43

   private final ModelRenderer 2;
    private final ModelRenderer 3;

2 and 3 are not valid Java identifiers for a field. Check https://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html#:~:text=A%20variable's%20name%20can%20be,%24%20%22%20or%20%22%20_%20%22.

Last seen on 08:24, 14. Nov 2021
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm sorry if I did sth wrong…
Tue, 06/02/2020 - 11:51

I'm sorry if I did sth wrong with the pasting of the log and the code, same for that I forgot to paste the full log. Thanks, I din't realise that 2 and 3 are invalid names, I feel so dumb for all of these reasons. I will format my posts right from now on :)