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.

Featured Replies

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?

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

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.