Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Issue with entity renderer, game crashes when I try spawning custom entity.

Featured Replies

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.