1

New Rendering Methods

Cardinal System8/19/17 3:50 pm history
1 emeralds 223 3
9/14/2017 10:42 pm
coolAlias
I realized that the rendering methods have changed for 1.8, but I cannot figure out how to use them. I have successfully rendered throwable entities first by including a factory in the render class, then registering it in the main mod class using this method:

RenderingRegistry.registerEntityRenderingHandler(EntityGrenade.class, RenderGrenade.FACTORY);
But I cannot render regular entities. I tried the same methods but with no success, they render as invisible entities.

My render class for the regular entity is here: https://hastebin.com/cemirozewi.java
and the register method I used is as follows:

RenderingRegistry.registerEntityRenderingHandler(EntityNuke.class, RenderNuke.FACTORY);
So what exactly is the trick to rendering in these newer versions?


- UPDATE -


I loaded the mod and pressed F3 + B then an outline appeared around each entity. After doing this I placed the BlockNuke and ignited it. There was no outline present, but there was an explosion as programmed in the EntityNuke class. Now I am more confused then ever...

- SOLUTION -


It took a while to find, but there was a thread in the entity class that was killing the entity before it could render. I simply changed when this thread killed the entity, and everything worked great!
Posted by avatar
Cardinal System
Level 29 : Expert Geek
221

Create an account or sign in to comment.

3

2
09/14/2017 10:42 pmhistory
Level 70 : Legendary Modder
coolAlias
coolAlias avatar
I don't recommend using a singleton (static instance) for your render factory - use a new instance of it for each entity, e.g.:

```
RenderingRegistry.registerEntityRenderingHandler(EntityChu.class, new RenderEntityChu.Factory(new ModelSlime(16), 0.25F));
```

Then make sure your render class extends one of the vanilla entity renderer classes and overrides / calls the required methods. Example.
1
08/25/2017 8:18 pm
Level 34 : Artisan Modder
Aeronica
Aeronica avatar
How and where are you registering your EntityNuke class. It should be registered on both sides preferably in your main mod class in the FMLInitializationEvent

e.g.

static int modEntityId = 0;

private int getNextModEntityId() {
return modEntityId++;
}

...
@EventHandler
public void init(FMLInitializationEvent event) {
EntityRegistry.registerModEntity(new ResourceLocation(MODID, "entity_nuke"), EntityNuke.class, "entity_nuke", getNextModEntityId(), this, 64, 20, true);
}

...
1
08/25/2017 9:05 pm
Level 29 : Expert Geek
Cardinal System
Cardinal System avatar
Planet Minecraft

Website

© 2010 - 2022
www.planetminecraft.com

Welcome