Jump to content

Recommended Posts

Posted

I have tried to add a custom entity to my mod but when I run the mod I get this error:

No renderer registered for bigbadboybob2:caveman_entity

When I then try to spawn this entity main game crashes.

 

Here is my code for the renderer:

package lucas.MoeMobsMod.client.render;

import lucas.MoeMobsMod.MainMod;
import lucas.MoeMobsMod.client.models.CavemanModel;
import lucas.MoeMobsMod.entities.Caveman;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.entity.LivingRenderer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.registry.IRenderFactory;


@OnlyIn(Dist.CLIENT)
public class CavemanEntityRender extends LivingRenderer<Caveman, CavemanModel> {
	public CavemanEntityRender(EntityRendererManager manager) {
		super(manager, new CavemanModel(), 0f);
	}

	@Override
	public ResourceLocation getEntityTexture(Caveman entity) {
		return MainMod.Location("textures/entity/caveman_entity.png");
	}
	
	public static class RenderFactory implements IRenderFactory<Caveman> {

		@Override
		public EntityRenderer<? super Caveman> createRenderFor(EntityRendererManager manager) {
			return new CavemanEntityRender(manager);
		}
		
	}

}

 

and here is my code for the render registry:

package lucas.MoeMobsMod.client.render;

import lucas.MoeMobsMod.lists.EntityList;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.registry.RenderingRegistry;

@OnlyIn(Dist.CLIENT)
public class CavemanEntityRenderRegistry {
	public static void registerEntityRenders() {
		RenderingRegistry.registerEntityRenderingHandler(EntityList.caveman_entity, new CavemanEntityRender.RenderFactory());
	}

}

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.