From b06faea26e204afcbade2caff7f4f9841ce503be Mon Sep 17 00:00:00 2001 From: HoosierTransfer <97118529+HoosierTransfer@users.noreply.github.com> Date: Tue, 18 Jun 2024 19:51:47 -0400 Subject: [PATCH] huh --- .../client/renderer/RenderGlobal.java | 15 +++---- .../client/renderer/chunk/CompiledChunk.java | 4 +- .../client/renderer/chunk/SetVisibility.java | 39 ++++++++++++++++--- 3 files changed, 44 insertions(+), 14 deletions(-) diff --git a/src/main/java/net/minecraft/client/renderer/RenderGlobal.java b/src/main/java/net/minecraft/client/renderer/RenderGlobal.java index 49a39a4..7afc4e9 100644 --- a/src/main/java/net/minecraft/client/renderer/RenderGlobal.java +++ b/src/main/java/net/minecraft/client/renderer/RenderGlobal.java @@ -162,7 +162,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene * OpenGL sky list 2 */ private int glSkyList2 = -1; - private int cloudTickCounter; + public int cloudTickCounter; private final Map damagedBlocks = Maps.newHashMap(); private final Map mapSoundPositions = Maps.newHashMap(); private final EaglerTextureAtlasSprite[] destroyBlockIcons = new EaglerTextureAtlasSprite[10]; @@ -926,12 +926,13 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation3 = new RenderGlobal.ContainerLocalRenderInformation( renderchunk, (EnumFacing) null, 0); Set set1 = this.getVisibleFacings(blockpos1); - if (set1.size() == 1) { - Vector3f vector3f = this.getViewVector(viewEntity, partialTicks); - EnumFacing enumfacing = EnumFacing.getFacingFromVector(vector3f.x, vector3f.y, vector3f.z) - .getOpposite(); - set1.remove(enumfacing); - } + // if (set1.size() == 1) { + // Vector3f vector3f = this.getViewVector(viewEntity, partialTicks); + // EnumFacing enumfacing = EnumFacing.getFacingFromVector(vector3f.x, + // vector3f.y, vector3f.z) + // .getOpposite(); + // set1.remove(enumfacing); + // } if (set1.isEmpty()) { flag2 = true; diff --git a/src/main/java/net/minecraft/client/renderer/chunk/CompiledChunk.java b/src/main/java/net/minecraft/client/renderer/chunk/CompiledChunk.java index df0eec0..9723723 100644 --- a/src/main/java/net/minecraft/client/renderer/chunk/CompiledChunk.java +++ b/src/main/java/net/minecraft/client/renderer/chunk/CompiledChunk.java @@ -90,7 +90,9 @@ public class CompiledChunk { } public boolean isVisible(EnumFacing enumfacing, EnumFacing enumfacing1) { - return this.setVisibility.isVisible(enumfacing, enumfacing1); + // boolean visible = this.setVisibility.isVisible(enumfacing, enumfacing1); + return setVisibility.vfix$anyPathToFace(enumfacing1); + // return visible; } public void setVisibility(SetVisibility visibility) { diff --git a/src/main/java/net/minecraft/client/renderer/chunk/SetVisibility.java b/src/main/java/net/minecraft/client/renderer/chunk/SetVisibility.java index 6da30fe..c2f4aa0 100644 --- a/src/main/java/net/minecraft/client/renderer/chunk/SetVisibility.java +++ b/src/main/java/net/minecraft/client/renderer/chunk/SetVisibility.java @@ -38,6 +38,8 @@ public class SetVisibility { private static final int COUNT_FACES = EnumFacing._VALUES.length; private final BitSet bitSet; + private long bitField = 0; + public SetVisibility() { this.bitSet = new BitSet(COUNT_FACES * COUNT_FACES); } @@ -52,19 +54,44 @@ public class SetVisibility { } - public void setVisible(EnumFacing facing, EnumFacing facing2, boolean parFlag) { - this.bitSet.set(facing.ordinal() + facing2.ordinal() * COUNT_FACES, parFlag); - this.bitSet.set(facing2.ordinal() + facing.ordinal() * COUNT_FACES, parFlag); + public void setVisible(EnumFacing fromFace, EnumFacing toFace, boolean isVisible) { + long shiftBy; + + shiftBy = fromFace.ordinal() + toFace.ordinal() * COUNT_FACES; + this.bitField = (this.bitField & ~(1L << shiftBy)) | ((isVisible ? 1L : 0L) << shiftBy); + + shiftBy = toFace.ordinal() + fromFace.ordinal() * COUNT_FACES; + this.bitField = (this.bitField & ~(1L << shiftBy)) | ((isVisible ? 1L : 0L) << shiftBy); } + // public void setVisible(EnumFacing facing, EnumFacing facing2, boolean + // parFlag) { + // this.bitSet.set(facing.ordinal() + facing2.ordinal() * COUNT_FACES, parFlag); + // this.bitSet.set(facing2.ordinal() + facing.ordinal() * COUNT_FACES, parFlag); + // } + public void setAllVisible(boolean visible) { - this.bitSet.set(0, this.bitSet.size(), visible); + this.bitField = visible ? 0xFFFFFFFFFL : 0L; } - public boolean isVisible(EnumFacing facing, EnumFacing facing2) { - return this.bitSet.get(facing.ordinal() + facing2.ordinal() * COUNT_FACES); + // public void setAllVisible(boolean visible) { + // this.bitSet.set(0, this.bitSet.size(), visible); + // } + + public boolean isVisible(EnumFacing fromFace, EnumFacing toFace) { + boolean ret = ((1L << (fromFace.ordinal() + toFace.ordinal() * COUNT_FACES)) & this.bitField) != 0; + return ret; } + public boolean vfix$anyPathToFace(EnumFacing targetFace) { + long mask = 0b111111 << (targetFace.ordinal() * COUNT_FACES); + return (mask & this.bitField) > 0; + } + + // public boolean isVisible(EnumFacing facing, EnumFacing facing2) { + // return this.bitSet.get(facing.ordinal() + facing2.ordinal() * COUNT_FACES); + // } + public String toString() { StringBuilder stringbuilder = new StringBuilder(); stringbuilder.append(' ');