Mob code not working

Started by geni_o_o_ on

Topic category: Help with modding (Java Edition)

Last seen on 12:26, 11. Apr 2023
Joined Feb 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Mob code not working
Sun, 04/02/2023 - 16:20 (edited)

So I wanted to add A mob called Crystalgolem and I always get this error

*

> Task :compileJava FAILED 

C:\Users\MCreatorWorkspaces\the_paradend\src\main\java\net\mcreator\theparadend\client\model\CrystalGolem.java:27: error: invalid method declaration; return type required 

   public Crystalgolem(ModelPart root) { 

          ^ 

1 error 

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 

BUILD FAILED in 1s 

1 actionable task: 1 executed 

  

BUILD FAILED 

Task completed in 1 second 

 

 
This is the model in java
 

// Made with Blockbench 4.6.5
// Exported for Minecraft version 1.17 or later with Mojang mappings
// Paste this class into your mod and generate all required imports

public class Crystalgolem<T extends Entity> extends EntityModel<T> {
	// This layer location should be baked with EntityRendererProvider.Context in
	// the entity renderer and passed into this model's constructor
	public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(
			new ResourceLocation("modid", "Crystalgolem"), "main");
	private final ModelPart golem;

	public Crystalgolem(ModelPart root) {
		this.golem = root.getChild("golem");
	}

	public static LayerDefinition createBodyLayer() {
		MeshDefinition meshdefinition = new MeshDefinition();
		PartDefinition partdefinition = meshdefinition.getRoot();

		PartDefinition golem = partdefinition.addOrReplaceChild("golem", CubeListBuilder.create(),
				PartPose.offset(0.0F, 24.0F, 0.0F));

		PartDefinition head = golem.addOrReplaceChild("head",
				CubeListBuilder.create().texOffs(0, 0)
						.addBox(-3.75F, -4.4583F, -3.5F, 8.0F, 7.0F, 7.0F, new CubeDeformation(0.0F)).texOffs(0, 23)
						.addBox(-1.35F, -6.4583F, -2.0F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)).texOffs(10, 25)
						.addBox(-2.35F, -9.4583F, -1.0F, 2.0F, 5.0F, 2.0F, new CubeDeformation(0.0F)).texOffs(0, 26)
						.addBox(-0.35F, -8.4583F, -1.0F, 3.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)).texOffs(18, 26)
						.addBox(-0.35F, -12.4583F, -1.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)).texOffs(26, 28)
						.addBox(-1.35F, -7.4583F, 1.0F, 2.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)),
				PartPose.offset(-0.25F, -5.5417F, 0.0F));

		PartDefinition leftarm = head.addOrReplaceChild("leftarm", CubeListBuilder.create().texOffs(0, 0).addBox(-0.5F,
				-0.5F, -1.0F, 1.0F, 5.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(4.75F, -0.9583F, 0.0F));

		PartDefinition rightarm = head.addOrReplaceChild("rightarm", CubeListBuilder.create().texOffs(0, 0)
				.addBox(-0.5F, -0.5F, -1.0F, 1.0F, 5.0F, 2.0F, new CubeDeformation(0.0F)),
				PartPose.offset(-4.25F, -0.9583F, 0.0F));

		PartDefinition leftleg = golem.addOrReplaceChild("leftleg", CubeListBuilder.create().texOffs(24, 14)
				.addBox(-1.0F, 0.75F, -1.25F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)),
				PartPose.offset(2.0F, -3.25F, -0.15F));

		PartDefinition rightleg = golem.addOrReplaceChild("rightleg", CubeListBuilder.create().texOffs(0, 0)
				.addBox(-1.0F, 0.75F, -1.25F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)),
				PartPose.offset(-2.0F, -3.25F, -0.15F));

		return LayerDefinition.create(meshdefinition, 32, 32);
	}

	@Override
	public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay,
			float red, float green, float blue, float alpha) {
		golem.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
	}

	public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw,
			float headPitch) {
	}
}

I would really appreciate help, thanks!
 

 

Edited by geni_o_o_ on Sun, 04/02/2023 - 16:20