1

New Rendering Methods

1 emerald 3 replies 99 views | started 08/19/2017 3:50 pm by Cardinal System
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 10 : Journeyman Network
41

3 replies

2
09/14/2017 10:42 pm
Level 66 High Grandmaster Modder
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 31 Artisan Modder
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 10 Journeyman Network
Cardinal System
avatar

Search

Browse

Site

© planetminecraft.com

Welcome