Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.14.4] Entity renderer seems to not be called nor registered


Recommended Posts

I am trying to make an entity which works and renders in a similar fashion to a splash potion.

 

It is defined thus:

https://pastebin.com/edkgrnYW

 

To render it, I am using the SpriteRenderer class like so:

@EventBusSubscriber(modid = Main.MOD_ID, value = {Dist.CLIENT}, bus = EventBusSubscriber.Bus.MOD)
public class ClientProxy {
    @SubscribeEvent
    public static void init(FMLClientSetupEvent event) {
        RenderingRegistry.registerEntityRenderingHandler(EntityExplosivePotion.class, m -> new SpriteRenderer<>(m, Minecraft.getInstance().getItemRenderer()));
        //RenderingRegistry.registerEntityRenderingHandler(EntitySpicyExplosivePotion.class, RenderSpicyExplosivePotion::new);
        getItemModelMesher().register(ModItems.EXPLOSIVE_POTION, new ModelResourceLocation("expotions:potion_explosive", "inventory"));
        getItemModelMesher().register(ModItems.THROWABLE_EXPLOSIVE_POTION, new ModelResourceLocation("expotions:potion_explosive_throwable", "inventory"));
        getItemModelMesher().register(ModItems.SPICY_EXPLOSIVE_POTION, new ModelResourceLocation("expotions:potion_explosive_spicy", "inventory"));
        getItemModelMesher().register(ModItems.SPICY_THROWABLE_EXPLOSIVE_POTION, new ModelResourceLocation("expotions:potion_explosive_throwable_spicy", "inventory"));
    }
    
    /**
     * Convenience function for getting the {@code ItemModelMesher}.
     * @return The {@code ItemModelMesher} from {@link RenderItem#getItemModelMesher()} via {@link Minecraft#getItemRenderer()}
     */
    public static ItemModelMesher getItemModelMesher() {
        return Minecraft.getInstance().getItemRenderer().getItemModelMesher();
    }
}

 

When the entity is spawned it is spawned like so:

EntityExplosivePotion potion = new EntityExplosivePotion(player, world);
potion.setStrength(getStrength(stack));
potion.setSpicy(spicy);
potion.shoot(player, player.rotationPitch, player.rotationYaw, -20.0F, 0.5F, 1.0F);
world.addEntity(potion);

The problem that I am having is that the entity is not rendering. It functions but no model appears when it is spawned and no output appears in the log either.

The event handler for FMLClientSetupEvent is called but the renderer still does not appear to be registered.

 

Here is a copy of my latest.log: https://pastebin.com/ftE0Ffag

Edited by sanman00

My mod: Explosive Potions for 1.10.2

Link to post
Share on other sites
5 hours ago, sanman00 said:

getItemModelMesher().register(ModItems.EXPLOSIVE_POTION, new ModelResourceLocation("expotions:potion_explosive", "inventory")); getItemModelMesher().register(ModItems.THROWABLE_EXPLOSIVE_POTION, new ModelResourceLocation("expotions:potion_explosive_throwable", "inventory")); getItemModelMesher().register(ModItems.SPICY_EXPLOSIVE_POTION, new ModelResourceLocation("expotions:potion_explosive_spicy", "inventory")); getItemModelMesher().register(ModItems.SPICY_THROWABLE_EXPLOSIVE_POTION, new ModelResourceLocation("expotions:potion_explosive_throwable_spicy", "inventory"));

Why are you doing this? This is unnecessary.

 

Is your entity registered properly? Does it exist on the client (verify with the debugger)?

Link to post
Share on other sites

Going to guess that the entity in question doesn't extend LivingEntity, in which case see 

 or one of the other several threads I found by Googling "forge 1.14 entity renderer".

 

And yeah, ditch that itemModelMesher code like yesterday :)  It's utterly unnecessary.

  • Thanks 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.