Rift

Rift

407k Downloads

TileEntityRenderer not rendering

raphydaphy opened this issue ยท 8 comments

commented

I've noticed that my tileentityrenderer isnt doing anything after successfully registering it using the TileEntityRendererAdder interface. Using the code below to register and declare the renderer, it only prints out 'render render render' one or two times when my block is first placed and never again even when block updates occur or the tileentity is updated. I dont mention the renderer class anywhere else in the code though, so i may be missing some important function calls and im sorry if thats the case.

// in main class which implements TileEntityRendererAdder
@Override
public void addTileEntityRenderers(Map<Class<? extends TileEntity>, TileEntityRenderer<? extends TileEntity>> renderers)
{
    System.out.println("added renderer");
    renderers.put(TileEntityAltar.class, new AltarRenderer());
}

// the renderer class
public class AltarRenderer extends TileEntityRenderer<TileEntityAltar>
{
    public void func_199341_a(TileEntityAltar altar, double x, double y, double z, float partialTicks, int destroyStage) // i think this is the render method???
    {
        System.out.println("render render render");
    }
}
commented

use notch names as func_ is a forge srg name. I don't think he has mcp installed. Also your ide will tell you if your overriding it with the @OverRide annotation

commented

i made a mod with just a tileentityrenderer and it worked so i guess this is on my side

commented

I have found the source of this problem - adding this line https://gist.github.com/raphydaphy/cae7e915972a85f12abd3e12048ff20c#file-tesrdebug-java-L89 will cause the tileEntityRenderer to never render again after it has recieved a data packet from the server. That gist is a self contained mod which demonstrates the problem Reopening because it is not something I am doing wrong in fact

commented

turns out you can avoid this issue by not reading the position when reading from NBT if the read is for rendering purposes only, guess this isnt too important then

commented

TileEntity.readFromNBT { } will set xyz pos to 0,0,0 it's not a rift issue it's your logic issue.

the id:"id" tag has to be unique registered and written write before doing anything with it.

commented

That's the name that was in the TileEntityRenderer class though so i would have thought it was correct, my IDE also correctly links it back to the base function (I am using @OverRide, i just forgot to include it in the code example).

How do i convert the forge name to notch though?

commented

was the name in forge or rift tile entity render? it's the the mcp-srg. notch names are the obfuscated names that are totally unreadable

commented

I just found it when looking at the source of TileEntityRenderer (from vanilla) inside my rift dev environment.