Jump to content

[1.14.4] TileEntityRenderer


Lea9ue

Recommended Posts

My Goal: I want a block that ignores "light effects".

I believe I can accomplish this with a tile entity, but cant fully figure out TileEntityRenderer. 

 

So to start with my TileEntityRenderer class:

public class TestTileRenderer extends TileEntityRenderer<TestTile> {
    @Override
    public void render(TestTile te, double x, double y, double z, float partialTicks, int destroyStage) {
  		this.setLightmapDisabled(true);
    }
}

I believe that should disable "light effects", but seems to have no effect.  I'm sure it's my lack of understanding that is the problem.   But if anyone could point out something that i'm doing wrong I would appreciate it or know of another way of achieving my goal.

 

Maybe I am registering it wrong:

 

@Mod("genericname")
public class GenericName {

    ...

    public GenericName() {

        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientRegistries);
        ...
    }
	...
    }

    private void clientRegistries(final FMLCommonSetupEvent event) {
        ClientRegistry.bindTileEntitySpecialRenderer(TestTile.class, new TestTileRenderer());
    }

 

 

Link to comment
Share on other sites

On 11/19/2019 at 5:12 PM, diesieben07 said:

That's not where this method tells you to call it. Read the documentation.

 

It seems to have no effect, because your renderer does not actually render anything...

Duh. Thanks. So now that I have that fixed I'm having an issue with the render. 

 

This is what it occasionally looks like, and how it should look.

Spoiler

2019-11-20_20_40_59.png.21f27ed5aa27b93c92a44324f2a83c92.png

 

But then it well look like this with the cut outs rendering black which just doesn't look appealing.

Spoiler

2019-11-20_20_41_37.png.dbe5b772ed2ab64302e3f6c6f19f408a.png

 

 

Any suggestions on this would be appreciated.

 

Here is my new render code if that helps.

 

    @Override
    public void render(DiamondTreeLeavesTile tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) {
        GlStateManager.enableDepthTest();
        GlStateManager.depthFunc(515);
        GlStateManager.depthMask(true);
        GlStateManager.pushMatrix();
        GlStateManager.translatef((float)x , (float)y , (float)z);
        this.bindTexture(TEXTURE);
        this.setLightmapDisabled(true);
        this.isGlobalRenderer(tileEntityIn);
        MODEL.renderThis();
        this.setLightmapDisabled(false);
        GlStateManager.popMatrix();
    }

 

 

 

Link to comment
Share on other sites

Unless there's a reason you need to, you should definitely use a FastTESR here instead of a normal one, to have much lower performance impact. That would fix your transparency issue, too, since the settings are already correct. Otherwise, I think you need to GlStateManager#enableAlpha().

 

As an aside, what's with the translatef() and isGlobalRenderer() calls?

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

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.

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.