Optimize Anti-Xray (#5991)

This commit is contained in:
stonar96
2021-06-29 11:01:47 +02:00
parent f96e1916d4
commit c7e9c0260f

View File

@@ -608,7 +608,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ next[0][1] = true; + next[0][1] = true;
+ next[1][0] = true; + next[1][0] = true;
+ } else { + } else {
+ if (nearbyChunkSections[2] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[2].getBlockState(0, y, 15))] || nearbyChunkSections[0] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[0].getBlockState(15, y, 0))] || current[0][0]) { + if (current[0][0] || nearbyChunkSections[2] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[2].getBlockState(0, y, 15))] || nearbyChunkSections[0] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[0].getBlockState(15, y, 0))]) {
+ bitStorageWriter.skip(); + bitStorageWriter.skip();
+ } else { + } else {
+ bitStorageWriter.write(presetBlockStateBits[random.getAsInt()]); + bitStorageWriter.write(presetBlockStateBits[random.getAsInt()]);
@@ -629,7 +629,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ next[0][x + 1] = true; + next[0][x + 1] = true;
+ next[1][x] = true; + next[1][x] = true;
+ } else { + } else {
+ if (nearbyChunkSections[2] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[2].getBlockState(x, y, 15))] || current[0][x]) { + if (current[0][x] || nearbyChunkSections[2] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[2].getBlockState(x, y, 15))]) {
+ bitStorageWriter.skip(); + bitStorageWriter.skip();
+ } else { + } else {
+ bitStorageWriter.write(presetBlockStateBits[random.getAsInt()]); + bitStorageWriter.write(presetBlockStateBits[random.getAsInt()]);
@@ -649,7 +649,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ next[0][14] = true; + next[0][14] = true;
+ next[1][15] = true; + next[1][15] = true;
+ } else { + } else {
+ if (nearbyChunkSections[2] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[2].getBlockState(15, y, 15))] || nearbyChunkSections[1] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[1].getBlockState(0, y, 0))] || current[0][15]) { + if (current[0][15] || nearbyChunkSections[2] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[2].getBlockState(15, y, 15))] || nearbyChunkSections[1] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[1].getBlockState(0, y, 0))]) {
+ bitStorageWriter.skip(); + bitStorageWriter.skip();
+ } else { + } else {
+ bitStorageWriter.write(presetBlockStateBits[random.getAsInt()]); + bitStorageWriter.write(presetBlockStateBits[random.getAsInt()]);
@@ -671,7 +671,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ next[z - 1][0] = true; + next[z - 1][0] = true;
+ next[z + 1][0] = true; + next[z + 1][0] = true;
+ } else { + } else {
+ if (nearbyChunkSections[0] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[0].getBlockState(15, y, z))] || current[z][0]) { + if (current[z][0] || nearbyChunkSections[0] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[0].getBlockState(15, y, z))]) {
+ bitStorageWriter.skip(); + bitStorageWriter.skip();
+ } else { + } else {
+ bitStorageWriter.write(presetBlockStateBits[random.getAsInt()]); + bitStorageWriter.write(presetBlockStateBits[random.getAsInt()]);
@@ -714,7 +714,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ next[z - 1][15] = true; + next[z - 1][15] = true;
+ next[z + 1][15] = true; + next[z + 1][15] = true;
+ } else { + } else {
+ if (nearbyChunkSections[1] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[1].getBlockState(0, y, z))] || current[z][15]) { + if (current[z][15] || nearbyChunkSections[1] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[1].getBlockState(0, y, z))]) {
+ bitStorageWriter.skip(); + bitStorageWriter.skip();
+ } else { + } else {
+ bitStorageWriter.write(presetBlockStateBits[random.getAsInt()]); + bitStorageWriter.write(presetBlockStateBits[random.getAsInt()]);
@@ -734,7 +734,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ next[15][1] = true; + next[15][1] = true;
+ next[14][0] = true; + next[14][0] = true;
+ } else { + } else {
+ if (nearbyChunkSections[3] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[3].getBlockState(0, y, 0))] || nearbyChunkSections[0] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[0].getBlockState(15, y, 15))] || current[15][0]) { + if (current[15][0] || nearbyChunkSections[3] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[3].getBlockState(0, y, 0))] || nearbyChunkSections[0] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[0].getBlockState(15, y, 15))]) {
+ bitStorageWriter.skip(); + bitStorageWriter.skip();
+ } else { + } else {
+ bitStorageWriter.write(presetBlockStateBits[random.getAsInt()]); + bitStorageWriter.write(presetBlockStateBits[random.getAsInt()]);
@@ -755,7 +755,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ next[15][x + 1] = true; + next[15][x + 1] = true;
+ next[14][x] = true; + next[14][x] = true;
+ } else { + } else {
+ if (nearbyChunkSections[3] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[3].getBlockState(x, y, 0))] || current[15][x]) { + if (current[15][x] || nearbyChunkSections[3] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[3].getBlockState(x, y, 0))]) {
+ bitStorageWriter.skip(); + bitStorageWriter.skip();
+ } else { + } else {
+ bitStorageWriter.write(presetBlockStateBits[random.getAsInt()]); + bitStorageWriter.write(presetBlockStateBits[random.getAsInt()]);
@@ -775,7 +775,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ next[15][14] = true; + next[15][14] = true;
+ next[14][15] = true; + next[14][15] = true;
+ } else { + } else {
+ if (nearbyChunkSections[3] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[3].getBlockState(15, y, 0))] || nearbyChunkSections[1] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[1].getBlockState(0, y, 15))] || current[15][15]) { + if (current[15][15] || nearbyChunkSections[3] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[3].getBlockState(15, y, 0))] || nearbyChunkSections[1] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[1].getBlockState(0, y, 15))]) {
+ bitStorageWriter.skip(); + bitStorageWriter.skip();
+ } else { + } else {
+ bitStorageWriter.write(presetBlockStateBits[random.getAsInt()]); + bitStorageWriter.write(presetBlockStateBits[random.getAsInt()]);