Jump to content

Recommended Posts

Posted

Here are the relevant code snippets:

 

Registration code (the entity registers successfully, the renderer seems not to for some reason):

registerEntity(EntitySpectre.class,"spectre",new Color(245,255,255),new Color(235,240,255));
RenderingRegistry.registerEntityRenderingHandler(EntitySpectre.class,new IRenderFactory<EntitySpectre>(){
            public Render<EntitySpectre> createRenderFor(RenderManager manager) {return new RenderSpectre(manager);}
});

 

My registerEntity method (located in ModMain, this probably isn't the cause but I decided to include it anyway):

void registerEntity(Class<? extends Entity>e,String name,Color c1,Color c2){
        EntityRegistry.registerModEntity(new ResourceLocation(MODID,name), e,name, ++i,this, 64, 1, true,c1.getRGB(),c2.getRGB());
    }

 

The RenderSpectre class (largely copied from RenderBlaze):

package sj224.mod.mobs.render;
import net.minecraft.client.model.ModelBlaze;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.util.ResourceLocation;
import sj224.mod.ModMain;
import sj224.mod.mobs.EntitySpectre;

public class RenderSpectre extends RenderLiving<EntitySpectre>
{
    public static final ResourceLocation TEXTURES = new ResourceLocation(ModMain.MODID,"textures/entity/spectre.png");
    static{
        System.out.println(TEXTURES.getResourcePath());
    }
    public RenderSpectre(RenderManager renderManagerIn)
    {
        super(renderManagerIn, new ModelBlaze(), 0.5F);
    
    }
    /**
     * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
     */
    protected ResourceLocation getEntityTexture(EntitySpectre entity)
    {
        return TEXTURES;
    }
}

 

As you can probably tell, the mob is supposed to look like a retextured blaze. When I spawn it in using the spawn egg or using the /summon command, it is instead rendering as a big white box. What might the cause of this might be?

Posted
56 minutes ago, diesieben07 said:
  • Renderers must only be registered from your client proxy.
  • You must do this in preInit.

Okay, I've moved it from global init to ClientProxy's preInit.

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.