Jump to content

Recommended Posts

Posted

I'm trying to make an item that when thrown creates a pool of fire on impact, yet I'm confused how to get it to actually render.

 

The entity functions as it should, and it renders fine in hand/inventory.

But the entity itself just won't render.

 

I see some people say to register entities from init() and some from preInit() so I tried both, each with negative results.

 

If I call the registry in preInit() as soon as it's thrown and tries to render, the game crashes with a NullPointerException:

  Reveal hidden contents

 

 

But if I call the registry in init() instead of crashing, everything works perfectly except that it renders as just a small white cube.

 

 

Any help?

 

Entities:

  Reveal hidden contents

 

Registry:

  Reveal hidden contents

 

EntityFirebomb:

  Reveal hidden contents

 

 

Posted

Please read https://gist.github.com/Cadiboo/fbea89dc95ebbdc58d118f5350b7ba93. Get rid of all of this

// This is called from ClientProxy
	public static void render()
	{
		RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
		RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();

		RenderingRegistry.registerEntityRenderingHandler(EntityFirebomb.class, new IRenderFactory<EntityFirebomb>()
		{
			@Override
			public Render<? super EntityFirebomb> createRenderFor(RenderManager manager)
			{
				return new RenderSnowball<EntityFirebomb>(renderManager, claybomb, renderItem);
			}
		});
	}

and replace it with something that isn't broken. You're passed a RenderManager in from createRenderFor why do you use the other one. Why does the other one even exist? Heres an example of how to register a renderer https://github.com/Cadiboo/WIPTech/blob/fb5883e9d76ef0361ec1ebbcb9c508611dd2ef6b/src/main/java/cadiboo/wiptech/client/ClientEventSubscriber.java#L137 

About Me

  Reveal hidden contents

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
  On 3/7/2019 at 2:52 AM, Cadiboo said:

Please read https://gist.github.com/Cadiboo/fbea89dc95ebbdc58d118f5350b7ba93. Get rid of all of this

// This is called from ClientProxy
	public static void render()
	{
		RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
		RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();

		RenderingRegistry.registerEntityRenderingHandler(EntityFirebomb.class, new IRenderFactory<EntityFirebomb>()
		{
			@Override
			public Render<? super EntityFirebomb> createRenderFor(RenderManager manager)
			{
				return new RenderSnowball<EntityFirebomb>(renderManager, claybomb, renderItem);
			}
		});
	}

and replace it with something that isn't broken. You're passed a RenderManager in from createRenderFor why do you use the other one. Why does the other one even exist? Heres an example of how to register a renderer https://github.com/Cadiboo/WIPTech/blob/fb5883e9d76ef0361ec1ebbcb9c508611dd2ef6b/src/main/java/cadiboo/wiptech/client/ClientEventSubscriber.java#L137 

Expand  

The RenderManager was only there because of something else I was trying that didn't work; forgot to remove it.

 

Also, changing it to this...

  Reveal hidden contents

still produces the same result. Renders a white cube instead of the item. Did I miss something?

Posted

Unless you're trying to render a white cube, it means that your renderer isn't getting registered properly. Please post your code as a working GitHub repository.

About Me

  Reveal hidden contents

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.