diff --git a/common/src/main/java/net/irisshaders/batchedentityrendering/impl/SegmentedBufferBuilder.java b/common/src/main/java/net/irisshaders/batchedentityrendering/impl/SegmentedBufferBuilder.java index 7c3d8aa762..2c04da5251 100644 --- a/common/src/main/java/net/irisshaders/batchedentityrendering/impl/SegmentedBufferBuilder.java +++ b/common/src/main/java/net/irisshaders/batchedentityrendering/impl/SegmentedBufferBuilder.java @@ -33,7 +33,7 @@ private static boolean shouldSortOnUpload(RenderType type) { public VertexConsumer getBuffer(RenderType renderType) { try { - ByteBufferBuilderHolder buffer = buffers.computeIfAbsent(renderType, (r) -> new ByteBufferBuilderHolder(new ByteBufferBuilder(512 * 2024))); + ByteBufferBuilderHolder buffer = buffers.computeIfAbsent(renderType, (r) -> new ByteBufferBuilderHolder(new ByteBufferBuilder(renderType.bufferSize()))); buffer.wasUsed(); BufferBuilder builder = builders.computeIfAbsent(renderType, (t) -> new BufferBuilder(buffer.getBuffer(), renderType.mode(), renderType.format())); diff --git a/common/src/main/java/net/irisshaders/batchedentityrendering/mixin/CompositeStateAccessor.java b/common/src/main/java/net/irisshaders/batchedentityrendering/mixin/CompositeStateAccessor.java index 0b75ba5f03..4067e8d7ed 100644 --- a/common/src/main/java/net/irisshaders/batchedentityrendering/mixin/CompositeStateAccessor.java +++ b/common/src/main/java/net/irisshaders/batchedentityrendering/mixin/CompositeStateAccessor.java @@ -9,4 +9,7 @@ public interface CompositeStateAccessor { @Accessor("transparencyState") RenderStateShard.TransparencyStateShard getTransparency(); + + @Accessor("depthTestState") + RenderStateShard.DepthTestStateShard getDepth(); } diff --git a/common/src/main/java/net/irisshaders/batchedentityrendering/mixin/MixinCompositeRenderType.java b/common/src/main/java/net/irisshaders/batchedentityrendering/mixin/MixinCompositeRenderType.java index 95a2c0a45e..9c1b879c20 100644 --- a/common/src/main/java/net/irisshaders/batchedentityrendering/mixin/MixinCompositeRenderType.java +++ b/common/src/main/java/net/irisshaders/batchedentityrendering/mixin/MixinCompositeRenderType.java @@ -27,8 +27,9 @@ private MixinCompositeRenderType(String name, VertexFormat vertexFormat, VertexF @Inject(method = INIT, at = @At("RETURN")) private void batchedentityrendering$onCompositeInit(String string, VertexFormat vertexFormat, VertexFormat.Mode mode, int i, boolean bl, boolean bl2, CompositeState compositeState, CallbackInfo ci) { RenderStateShard.TransparencyStateShard transparency = ((CompositeStateAccessor) (Object) compositeState).getTransparency(); + RenderStateShard.DepthTestStateShard depth = ((CompositeStateAccessor) (Object) compositeState).getDepth(); - if ("water_mask".equals(name)) { + if ("water_mask".equals(name) || depth == RenderStateShard.NO_DEPTH_TEST) { transparencyType = TransparencyType.WATER_MASK; } else if ("lines".equals(name)) { transparencyType = TransparencyType.LINES; diff --git a/common/src/main/resources/iris.accesswidener b/common/src/main/resources/iris.accesswidener index a1cf0ecde7..f5e969cc04 100644 --- a/common/src/main/resources/iris.accesswidener +++ b/common/src/main/resources/iris.accesswidener @@ -6,6 +6,7 @@ accessible class com/mojang/blaze3d/platform/GlStateManager$TextureState accessible class com/mojang/blaze3d/platform/GlStateManager$ColorMask accessible class com/mojang/blaze3d/platform/GlStateManager$DepthState accessible class net/minecraft/client/renderer/RenderStateShard$TransparencyStateShard +accessible class net/minecraft/client/renderer/RenderStateShard$DepthTestStateShard accessible class net/minecraft/client/renderer/RenderType$CompositeRenderType accessible class net/minecraft/client/renderer/RenderType$CompositeState accessible class net/minecraft/client/renderer/FogRenderer$FogData