Problem with EntityRenderer.java non-static variable

Started by JakiWasHere on

Topic category: Help with MCreator software

Joined Sep 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Problem with EntityRenderer.java non-static variable
Executing Gradle task: build 
Build info: MCreator 2021.2.36710, forge-1.16.5, 64-bit, 15733 MB, Windows 10, JVM 11.0.11, JAVA_HOME: C:\Users\***\Downloads\MCreator20212\jdk 
> Task :compileJava FAILED 
C:\Users\***\MCreatorWorkspaces\WorkspaceFolder\src\main\java\net\mcreator\ModName\entity\renderer\RatRemiRenderer.java:27: error: non-static variable this cannot be referenced from a static context 
            return new MobRenderer(renderManager, new rat_remi_model(), 0.5f) { 
                                                  ^ 
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. 

hello forum! i'm asking for some help with this compiler error i keep getting? so far i couldn't find a solution to this anywhere

i've attached a bit of the error message i recieved in the console whenever i save something

 

i think it might have something to do with the model

Joined Sep 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
here's the contents of…
Thu, 09/16/2021 - 19:23

here's the contents of RatRemiRenderer.java if it helps with anything

 

package net.mcreator.cringpuppimod.entity.renderer;

import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.api.distmarker.Dist;

import net.minecraft.util.ResourceLocation;
import net.minecraft.entity.Entity;
import net.minecraft.client.renderer.model.ModelRenderer;
import net.minecraft.client.renderer.entity.model.EntityModel;
import net.minecraft.client.renderer.entity.MobRenderer;

import net.mcreator.cringpuppimod.entity.RatRemiEntity;

import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.mojang.blaze3d.matrix.MatrixStack;

@OnlyIn(Dist.CLIENT)
public class RatRemiRenderer {
	public static class ModelRegisterHandler {
		@SubscribeEvent
		@OnlyIn(Dist.CLIENT)
		public void registerModels(ModelRegistryEvent event) {
			RenderingRegistry.registerEntityRenderingHandler(RatRemiEntity.entity, renderManager -> {
				return new MobRenderer(renderManager, new rat_remi_model(), 0.5f) {
					@Override
					public ResourceLocation getEntityTexture(Entity entity) {
						return new ResourceLocation("cring_puppi_mod:textures/rat_remi.png");
					}
				};
			});
		}
	}

	// Made with Blockbench 3.9.3
	// Exported for Minecraft version 1.15 - 1.16 with MCP mappings
	// Paste this class into your mod and generate all required imports
	public class rat_remi_model extends EntityModel<Entity> {
		private final ModelRenderer head;
		private final ModelRenderer bone;
		private final ModelRenderer body;
		private final ModelRenderer body_rotation;
		private final ModelRenderer leg1;
		private final ModelRenderer leg2;
		private final ModelRenderer leg3;
		private final ModelRenderer leg4;
		private final ModelRenderer tail;
		private final ModelRenderer tail_rotation;
		public rat_remi_model() {
			textureWidth = 32;
			textureHeight = 16;
			head = new ModelRenderer(this);
			head.setRotationPoint(0.0F, 22.1667F, -2.1667F);
			setRotationAngle(head, 0.4363F, 0.0F, 0.0F);
			head.setTextureOffset(0, 9).addBox(-1.5F, -1.9019F, -3.8944F, 3.0F, 2.0F, 5.0F, 0.0F, false);
			bone = new ModelRenderer(this);
			bone.setRotationPoint(0.0F, -1.6519F, 0.8556F);
			head.addChild(bone);
			setRotationAngle(bone, -0.5236F, 0.0F, 0.0F);
			bone.setTextureOffset(26, 0).addBox(0.5F, -1.5F, -0.634F, 2.0F, 2.0F, 1.0F, 0.0F, false);
			bone.setTextureOffset(20, 0).addBox(-2.5F, -1.5F, -0.634F, 2.0F, 2.0F, 1.0F, 0.0F, false);
			body = new ModelRenderer(this);
			body.setRotationPoint(0.0F, 24.0F, 0.0F);
			body_rotation = new ModelRenderer(this);
			body_rotation.setRotationPoint(0.0F, -2.3F, 1.5F);
			body.addChild(body_rotation);
			setRotationAngle(body_rotation, 1.5708F, 0.0F, 0.0F);
			body_rotation.setTextureOffset(18, 6).addBox(-2.0F, -3.5F, -1.5F, 4.0F, 7.0F, 3.0F, 0.0F, false);
			leg1 = new ModelRenderer(this);
			leg1.setRotationPoint(-1.501F, 22.5F, 3.5F);
			leg1.setTextureOffset(0, 0).addBox(-0.5F, 0.5F, -0.5F, 1.0F, 1.0F, 1.0F, 0.0F, false);
			leg2 = new ModelRenderer(this);
			leg2.setRotationPoint(1.501F, 22.5F, 3.5F);
			leg2.setTextureOffset(0, 0).addBox(-0.5F, 0.5F, -0.5F, 1.0F, 1.0F, 1.0F, 0.0F, false);
			leg3 = new ModelRenderer(this);
			leg3.setRotationPoint(-1.501F, 22.5F, -0.5F);
			leg3.setTextureOffset(0, 0).addBox(-0.5F, 0.5F, -0.5F, 1.0F, 1.0F, 1.0F, 0.0F, false);
			leg4 = new ModelRenderer(this);
			leg4.setRotationPoint(1.501F, 22.5F, -0.5F);
			leg4.setTextureOffset(0, 0).addBox(-0.5F, 0.5F, -0.5F, 1.0F, 1.0F, 1.0F, 0.0F, false);
			tail = new ModelRenderer(this);
			tail.setRotationPoint(0.0F, 22.0F, 4.0F);
			tail_rotation = new ModelRenderer(this);
			tail_rotation.setRotationPoint(0.0F, 0.5F, 0.5F);
			tail.addChild(tail_rotation);
			setRotationAngle(tail_rotation, 1.5708F, 0.0F, 0.0F);
			tail_rotation.setTextureOffset(0, 3).addBox(-0.5F, -0.5F, -0.5F, 1.0F, 9.0F, 1.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) {
			head.render(matrixStack, buffer, packedLight, packedOverlay);
			body.render(matrixStack, buffer, packedLight, packedOverlay);
			leg1.render(matrixStack, buffer, packedLight, packedOverlay);
			leg2.render(matrixStack, buffer, packedLight, packedOverlay);
			leg3.render(matrixStack, buffer, packedLight, packedOverlay);
			leg4.render(matrixStack, buffer, packedLight, packedOverlay);
			tail.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;
		}
	}
}