Jump to content

[1.16.4] SpriteRenderer not working?


Recommended Posts

Does anyone have experience working with SpriteRenderer? I've been looking around everywhere for the past few hours on how I could render my item similarly to how snowballs/ender pearls/fireballs do, and I've gotten nowhere. Any help would be greatly appreciated!


Entity class: https://pastebin.com/LkZE1qLU


public class PancakeProjectileRender extends SpriteRenderer<PancakeProjectile> {
    public PancakeProjectileRender(EntityRendererManager renderManagerIn) {
        super(renderManagerIn, Minecraft.getInstance().getItemRenderer());


RenderingRegistry.registerEntityRenderingHandler(ModEntities.pancakeProjectileEntity, PancakeProjectileRender::new);


Using the above, I can confirm the registration runs (I have it run during the FMLClientSetupEvent), but the entity isn't visible in the world. I can confirm that the entity itself works, as it's still able to move and kill entities, just that it doesn't show a hitbox in F3+B and it doesn't render a texture.

Edited by hammy3502
Link to comment
Share on other sites

You need to override createSpawnPacket in your entity class. Look at this guide for reference: https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe81_entity_projectile

Also, why did you put this above your entity class?

        value = Dist.CLIENT,
        _interface = IRendersAsItem.class


Edited by Beethoven92

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

Link to comment
Share on other sites

Hello, and thank you for the help!


The overriding of createSpawnPacket didn't seem to work, though thank you for catching it before it didn't work in multiplayer!


Although I'm using the constructor that actually takes in a shooter (I'm having another item spawn the projectile using it), Forge seems to try to spawn it using the FMLPlayMessages.SpawnEntity spawnEntity, World world constructor, where I can't seem to find the shooter, leading me to believe it had been lost. Would there be any way to recover it, and transfer any other data along with it?

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.