Jump to content

[1.11.2] [SOLVED] RenderingRegistry.registerEntityRenderingHandler not registering


Recommended Posts

Posted (edited)

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
Posted

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.

Posted (edited)

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...
Posted (edited)

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

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