mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-08-29 00:32:18 +00:00
Fix: Stop water and chests being drawn over monitors
Somewhere along the line the gl state was being mangled and I'm still not sure where! I moved the monitor blocks from the cutout render layer to the default solid layer, which obviates the depth blocker. I don't think the transparent front of the monitor blocks was ever visible so this should be fine. Then the terminal quads are moved slightly outward to prevent z-fighting with the now present block front. Finally I noticed some chests were not rendering correctly around monitors, so I paired an endDrawing() call with our sneaky hack of calling startDrawing() to force the rendering state. This fixed the chests. Hopefully we haven't messed up the render state in more ways :)
This commit is contained in:
parent
84a1f63445
commit
f3d22444d3
@ -77,10 +77,6 @@ public final class ComputerCraftProxyClient implements ClientModInitializer
|
||||
BlockRenderLayerMap.INSTANCE.putBlock( ComputerCraftRegistry.ModBlocks.TURTLE_NORMAL, RenderLayer.getTranslucent() );
|
||||
BlockRenderLayerMap.INSTANCE.putBlock( ComputerCraftRegistry.ModBlocks.TURTLE_ADVANCED, RenderLayer.getTranslucent() );
|
||||
|
||||
// Monitors' textures have transparent fronts and so count as cutouts.
|
||||
BlockRenderLayerMap.INSTANCE.putBlock( ComputerCraftRegistry.ModBlocks.MONITOR_NORMAL, RenderLayer.getCutout() );
|
||||
BlockRenderLayerMap.INSTANCE.putBlock( ComputerCraftRegistry.ModBlocks.MONITOR_ADVANCED, RenderLayer.getCutout() );
|
||||
|
||||
// Setup TESRs
|
||||
BlockEntityRendererRegistry.INSTANCE.register( ComputerCraftRegistry.ModTiles.MONITOR_NORMAL, TileEntityMonitorRenderer::new );
|
||||
BlockEntityRendererRegistry.INSTANCE.register( ComputerCraftRegistry.ModTiles.MONITOR_ADVANCED, TileEntityMonitorRenderer::new );
|
||||
|
@ -59,10 +59,7 @@ public class TileEntityMonitorRenderer extends BlockEntityRenderer<TileMonitor>
|
||||
// Render from the origin monitor
|
||||
ClientMonitor originTerminal = monitor.getClientMonitor();
|
||||
|
||||
if( originTerminal == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if( originTerminal == null ) return;
|
||||
TileMonitor origin = originTerminal.getOrigin();
|
||||
BlockPos monitorPos = monitor.getPos();
|
||||
|
||||
@ -96,7 +93,7 @@ public class TileEntityMonitorRenderer extends BlockEntityRenderer<TileMonitor>
|
||||
transform.multiply( Vector3f.POSITIVE_X.getDegreesQuaternion( pitch ) );
|
||||
transform.translate( -0.5 + TileMonitor.RENDER_BORDER + TileMonitor.RENDER_MARGIN,
|
||||
origin.getHeight() - 0.5 - (TileMonitor.RENDER_BORDER + TileMonitor.RENDER_MARGIN) + 0,
|
||||
0.5 );
|
||||
0.501 );
|
||||
double xSize = origin.getWidth() - 2.0 * (TileMonitor.RENDER_MARGIN + TileMonitor.RENDER_BORDER);
|
||||
double ySize = origin.getHeight() - 2.0 * (TileMonitor.RENDER_MARGIN + TileMonitor.RENDER_BORDER);
|
||||
|
||||
@ -112,8 +109,7 @@ public class TileEntityMonitorRenderer extends BlockEntityRenderer<TileMonitor>
|
||||
transform.push();
|
||||
transform.scale( (float) xScale, (float) -yScale, 1.0f );
|
||||
|
||||
Matrix4f matrix = transform.peek()
|
||||
.getModel();
|
||||
Matrix4f matrix = transform.peek().getModel();
|
||||
|
||||
// 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
|
||||
@ -127,6 +123,8 @@ public class TileEntityMonitorRenderer extends BlockEntityRenderer<TileMonitor>
|
||||
// reasonable.
|
||||
FixedWidthFontRenderer.drawCursor( matrix, buffer, 0, 0, terminal, !originTerminal.isColour() );
|
||||
|
||||
FixedWidthFontRenderer.TYPE.endDrawing();
|
||||
|
||||
transform.pop();
|
||||
}
|
||||
else
|
||||
@ -140,13 +138,12 @@ public class TileEntityMonitorRenderer extends BlockEntityRenderer<TileMonitor>
|
||||
(float) -(ySize + MARGIN * 2) );
|
||||
}
|
||||
|
||||
FixedWidthFontRenderer.drawBlocker( transform.peek()
|
||||
.getModel(),
|
||||
renderer,
|
||||
(float) -TileMonitor.RENDER_MARGIN,
|
||||
(float) TileMonitor.RENDER_MARGIN,
|
||||
(float) (xSize + 2 * TileMonitor.RENDER_MARGIN),
|
||||
(float) -(ySize + TileMonitor.RENDER_MARGIN * 2) );
|
||||
// FixedWidthFontRenderer.drawBlocker( transform.peek().getModel(),
|
||||
// renderer,
|
||||
// (float) -TileMonitor.RENDER_MARGIN,
|
||||
// (float) TileMonitor.RENDER_MARGIN,
|
||||
// (float) (xSize + 2 * TileMonitor.RENDER_MARGIN),
|
||||
// (float) -(ySize + TileMonitor.RENDER_MARGIN * 2) );
|
||||
|
||||
transform.pop();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user