This commit is contained in:
HoosierTransfer 2024-06-18 19:51:47 -04:00
parent 3409da13de
commit b06faea26e
3 changed files with 44 additions and 14 deletions

View File

@ -162,7 +162,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
* OpenGL sky list 2 * OpenGL sky list 2
*/ */
private int glSkyList2 = -1; private int glSkyList2 = -1;
private int cloudTickCounter; public int cloudTickCounter;
private final Map<Integer, DestroyBlockProgress> damagedBlocks = Maps.newHashMap(); private final Map<Integer, DestroyBlockProgress> damagedBlocks = Maps.newHashMap();
private final Map<BlockPos, ISound> mapSoundPositions = Maps.newHashMap(); private final Map<BlockPos, ISound> mapSoundPositions = Maps.newHashMap();
private final EaglerTextureAtlasSprite[] destroyBlockIcons = new EaglerTextureAtlasSprite[10]; private final EaglerTextureAtlasSprite[] destroyBlockIcons = new EaglerTextureAtlasSprite[10];
@ -926,12 +926,13 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation3 = new RenderGlobal.ContainerLocalRenderInformation( RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation3 = new RenderGlobal.ContainerLocalRenderInformation(
renderchunk, (EnumFacing) null, 0); renderchunk, (EnumFacing) null, 0);
Set set1 = this.getVisibleFacings(blockpos1); Set set1 = this.getVisibleFacings(blockpos1);
if (set1.size() == 1) { // if (set1.size() == 1) {
Vector3f vector3f = this.getViewVector(viewEntity, partialTicks); // Vector3f vector3f = this.getViewVector(viewEntity, partialTicks);
EnumFacing enumfacing = EnumFacing.getFacingFromVector(vector3f.x, vector3f.y, vector3f.z) // EnumFacing enumfacing = EnumFacing.getFacingFromVector(vector3f.x,
.getOpposite(); // vector3f.y, vector3f.z)
set1.remove(enumfacing); // .getOpposite();
} // set1.remove(enumfacing);
// }
if (set1.isEmpty()) { if (set1.isEmpty()) {
flag2 = true; flag2 = true;

View File

@ -90,7 +90,9 @@ public class CompiledChunk {
} }
public boolean isVisible(EnumFacing enumfacing, EnumFacing enumfacing1) { 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) { public void setVisibility(SetVisibility visibility) {

View File

@ -38,6 +38,8 @@ public class SetVisibility {
private static final int COUNT_FACES = EnumFacing._VALUES.length; private static final int COUNT_FACES = EnumFacing._VALUES.length;
private final BitSet bitSet; private final BitSet bitSet;
private long bitField = 0;
public SetVisibility() { public SetVisibility() {
this.bitSet = new BitSet(COUNT_FACES * COUNT_FACES); this.bitSet = new BitSet(COUNT_FACES * COUNT_FACES);
} }
@ -52,19 +54,44 @@ public class SetVisibility {
} }
public void setVisible(EnumFacing facing, EnumFacing facing2, boolean parFlag) { public void setVisible(EnumFacing fromFace, EnumFacing toFace, boolean isVisible) {
this.bitSet.set(facing.ordinal() + facing2.ordinal() * COUNT_FACES, parFlag); long shiftBy;
this.bitSet.set(facing2.ordinal() + facing.ordinal() * COUNT_FACES, parFlag);
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) { 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) { // public void setAllVisible(boolean visible) {
return this.bitSet.get(facing.ordinal() + facing2.ordinal() * COUNT_FACES); // 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() { public String toString() {
StringBuilder stringbuilder = new StringBuilder(); StringBuilder stringbuilder = new StringBuilder();
stringbuilder.append(' '); stringbuilder.append(' ');