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.

[1.11.2] [SOLVED] RenderingRegistry.registerEntityRenderingHandler not registering

Featured Replies

Posted

Using Minecraft Forge 1.11.2-13.20.0.2264.

 

I've got this in my ClientProxy:

RenderingRegistry.registerEntityRenderingHandler(EntityCustomCow.class, RenderCustomCow::new);

and I've checked that this is executing by printing to the console before this line.

 

EntityCustomCow extends EntityCow and RenderCustomCow looks like this:

@SideOnly(Side.CLIENT)
public class RenderCustomCow extends RenderLiving<EntityCustomCow> {
	private static final ResourceLocation texture = new ResourceLocation("textures/entity/cow/mooshroom.png");

    public RenderCustomCow(RenderManager manager) {
    	super(manager, new ModelCow(), 0.7F);
    }
    
    @Override
    protected ResourceLocation getEntityTexture(EntityCustomCow entity) {
        return texture;
    }
}

 

However the cow still has the default cow texture, not the mooshroom one. Not sure what I'm doing wrong here.

 

Edited by Xyfero

  • Author

CustomCow.java

package com.xyfero.customcow;

import com.xyfero.customcow.proxy.CommonProxy;

import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;

@Mod(modid = CustomCow.MODID, version = CustomCow.VERSION)
public class CustomCow {
    public static final String MODID = "customcow";
    public static final String VERSION = "1.0";
    
    @Instance(CustomCow.MODID)
	public static CustomCow instance;
    
    @SidedProxy(clientSide="com.xyfero.customcow.proxy.ClientProxy", serverSide="com.xyfero.customcow.proxy.CommonProxy")
	public static CommonProxy proxy;
    
    @EventHandler
    public void preInit(FMLInitializationEvent event) {
    	proxy.preInit(event);
    }
}

ClientProxy.java

package com.xyfero.customcow.proxy;

import com.xyfero.customcow.EntityCustomCow;
import com.xyfero.customcow.client.RenderCustomCow;

import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;

public class ClientProxy extends CommonProxy {
	@Override
	public void preInit(FMLInitializationEvent event) {
		super.preInit(event);
		
		RenderingRegistry.registerEntityRenderingHandler(EntityCustomCow.class, RenderCustomCow::new);
	}
}

CommonProxy.java

package com.xyfero.customcow.proxy;

import com.xyfero.customcow.CustomCow;
import com.xyfero.customcow.EntityCustomCow;
import com.xyfero.customcow.client.RenderCustomCow;

import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.registry.EntityRegistry;

public class CommonProxy {
	public void preInit(FMLInitializationEvent event) {
		EntityRegistry.registerModEntity(new ResourceLocation(CustomCow.MODID, "custom_cow"), EntityCustomCow.class, CustomCow.MODID + ":custom_cow", 0, CustomCow.instance, 80, 3, false, 0, 1);
	}
}

Then I'm using the command "/summon customcow:custom_cow" and the cow's texture is the original rather than the mooshroom one. I must be missing something but I just can't find it.

  • Author

Thank you so much.

I spent so long trying to figure this out thinking it was something wrong with my render file and it just turns out that I had just forgotten to change that one word, thought I was going crazy.

 

You deserve a medal.

Edited by Xyfero

  • 4 weeks later...

Hey, I'm just wondering, as I'm also using Forge 1.11.2, how come you don't have to pass the RenderCustomCow class a RenderManager when you instantiate it in the ClientProxy? As I'm trying to make a tile entity renderer for a block which can draw lines in the world (for testing purposes) and having no luck as I have no clue what it wants a RenderManager for or where to get/make one.

 

Edit: Nevermind, I realized it's not an Entity, it's a TileEntity. *DERP*

 

Edited by DrLogiq
I derped... once again

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.