CC: Tweaked

CC: Tweaked

42M Downloads

Monitor bug: TConstruct fluid tanks nearby un-render contents when monitor is placed while computer is running

fatboychummy opened this issue ยท 9 comments

commented

Minecraft Version

1.16.x

Version

1.101.0

Details

Monitors are rendering about a pixel up and left of where they should be, they seem to also be making the rendered fluid in nearby Tinker tanks disappear.

Other tanks with fluids in it (non-tinkers) seem to cause the tinker tanks to render properly.

Overall issue + pixel offset issue

ding151.mp4

Testing issue + other mods' tanks

https://cdn.discordapp.com/attachments/477911902152949771/1037961268998443008/ding152.mp4 (video too large to upload to github)

Test with just CC and TConstruct

image

There should be lava in the tanks in the above image. Pixel offset is interestingly not noticed here, there may be another mod interfering there. It's way too late currently for me to continue searching however, so for now I will just name the modpack I am running that is experiencing the offset: "Stacia Expert"

commented

image

Renders correctly when computer is turned off.

commented

Reported on Tinker's repository as well in case it is not on CC's end: SlimeKnights/TinkersConstruct#5017

commented

Tanks not showing up appears to be a TBO-only issue, so you can work around this by switching to the VBO renderer.

I thought I'd fixed the border issues way back in ba976f9, so interesting it's still showing up.

commented

It's also worth noting that things appear (I haven't tested thoroughly) to reset across chunk boundaries: tanks will render fine as long as they're in different chunks. Not actually sure why this is, I didn't think BE rendering was batched in the same way that chunks are!

commented

The one thing that makes fluids weird is they use a custom render type, I have seen similar issues with them being invisible on fabulous until I found the right setting that is not used on fast/fancy, could be another similar property that needs to be set.

commented

To be clear, what is it in CC that causes the tanks to stop rendering? Normally this type of bug is because the render state is not properly reset like expected before my code runs, is there something CC tweaked needs to reset?

commented

// Sneaky hack here: we get a buffer now in order to flush existing ones and set up the appropriate
// render state. I've no clue how well this'll work in future versions of Minecraft, but it does the trick
// for now.
bufferSource.getBuffer( RenderTypes.TERMINAL_WITH_DEPTH );
RenderTypes.TERMINAL_WITH_DEPTH.setupRenderState();
// Nobody knows what they're doing!
GlStateManager._activeTexture( MonitorTextureBufferShader.TEXTURE_INDEX );
GL11.glBindTexture( GL31.GL_TEXTURE_BUFFER, monitor.tboTexture );
GlStateManager._activeTexture( GL13.GL_TEXTURE0 );
MonitorTextureBufferShader.setupUniform( matrix, monitor.tboUniform );
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuilder();
buffer.begin( GL11.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION );
buffer.vertex( -xMargin, -yMargin, 0 ).endVertex();
buffer.vertex( -xMargin, pixelHeight + yMargin, 0 ).endVertex();
buffer.vertex( pixelWidth + xMargin, -yMargin, 0 ).endVertex();
buffer.vertex( pixelWidth + xMargin, pixelHeight + yMargin, 0 ).endVertex();
tessellator.end();
GlStateManager._glUseProgram( 0 );
break;

So this is the code in question. There's a lot going on here (we're using shaders for one), but I'm not aware of other it causing issues elsewhere so it's very odd. Unfortunately RenderDoc doesn't appear to work on 1.16.x (I guess due to it still using legacy OpenGL), so not sure quite what is going on in the render state.

commented

This is 100% a CC:T bug though, so feel free to close the issue on your end.

commented

Sorry for the delay in looking at this. I can confirm that this works on 1.18.x.

I'm going to close this, as I'm slowing down maintenance of older versions, and I don't think it's critical.