properly load nms chunk for lighting operations

Dieser Commit ist enthalten in:
dordsor21 2021-01-13 17:09:18 +00:00
Ursprung b4d7562b87
Commit f69b1bfb21
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
4 geänderte Dateien mit 28 neuen und 28 gelöschten Zeilen

Datei anzeigen

@ -150,7 +150,7 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks implements BukkitGetBl
public void setHeightmapToGet(HeightMapType type, int[] data) { public void setHeightmapToGet(HeightMapType type, int[] data) {
BitArray bitArray = new BitArray(9, 256); BitArray bitArray = new BitArray(9, 256);
bitArray.fromRaw(data); bitArray.fromRaw(data);
nmsChunk.heightMap.get(HeightMap.Type.valueOf(type.name())).a(bitArray.getData()); getChunk().heightMap.get(HeightMap.Type.valueOf(type.name())).a(bitArray.getData());
} }
public int getChunkZ() { public int getChunkZ() {
@ -176,7 +176,7 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks implements BukkitGetBl
@Override @Override
public void removeSectionLighting(int layer, boolean sky) { public void removeSectionLighting(int layer, boolean sky) {
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer); SectionPosition sectionPosition = SectionPosition.a(getChunk().getPos(), layer);
NibbleArray nibble = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition); NibbleArray nibble = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition);
if (nibble != null) { if (nibble != null) {
lightUpdate = true; lightUpdate = true;
@ -188,7 +188,7 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks implements BukkitGetBl
} }
} }
if (sky) { if (sky) {
SectionPosition sectionPositionSky = SectionPosition.a(nmsChunk.getPos(), layer); SectionPosition sectionPositionSky = SectionPosition.a(getChunk().getPos(), layer);
NibbleArray nibbleSky = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPositionSky); NibbleArray nibbleSky = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPositionSky);
if (nibble != null) { if (nibble != null) {
lightUpdate = true; lightUpdate = true;
@ -225,7 +225,7 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks implements BukkitGetBl
public int getSkyLight(int x, int y, int z) { public int getSkyLight(int x, int y, int z) {
int layer = y >> 4; int layer = y >> 4;
if (skyLight[layer] == null) { if (skyLight[layer] == null) {
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer); SectionPosition sectionPosition = SectionPosition.a(getChunk().getPos(), layer);
NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPosition); NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPosition);
// If the server hasn't generated the section's NibbleArray yet, it will be null // If the server hasn't generated the section's NibbleArray yet, it will be null
if (nibbleArray == null) { if (nibbleArray == null) {
@ -245,7 +245,7 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks implements BukkitGetBl
public int getEmmittedLight(int x, int y, int z) { public int getEmmittedLight(int x, int y, int z) {
int layer = y >> 4; int layer = y >> 4;
if (blockLight[layer] == null) { if (blockLight[layer] == null) {
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer); SectionPosition sectionPosition = SectionPosition.a(getChunk().getPos(), layer);
NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition); NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition);
// If the server hasn't generated the section's NibbleArray yet, it will be null // If the server hasn't generated the section's NibbleArray yet, it will be null
if (nibbleArray == null) { if (nibbleArray == null) {
@ -352,7 +352,7 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks implements BukkitGetBl
private void updateGet(BukkitGetBlocks_1_15_2 get, Chunk nmsChunk, ChunkSection[] sections, ChunkSection section, char[] arr, int layer) { private void updateGet(BukkitGetBlocks_1_15_2 get, Chunk nmsChunk, ChunkSection[] sections, ChunkSection section, char[] arr, int layer) {
synchronized (get) { synchronized (get) {
if (this.nmsChunk != nmsChunk) { if (this.getChunk() != nmsChunk) {
this.nmsChunk = nmsChunk; this.nmsChunk = nmsChunk;
this.sections = sections.clone(); this.sections = sections.clone();
this.reset(); this.reset();
@ -451,7 +451,7 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks implements BukkitGetBl
synchronized (this) { synchronized (this) {
synchronized (lock) { synchronized (lock) {
lock.untilFree(); lock.untilFree();
if (this.nmsChunk != nmsChunk) { if (this.getChunk() != nmsChunk) {
this.nmsChunk = nmsChunk; this.nmsChunk = nmsChunk;
this.sections = null; this.sections = null;
this.reset(); this.reset();

Datei anzeigen

@ -151,7 +151,7 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks implements BukkitGetBl
public void setHeightmapToGet(HeightMapType type, int[] data) { public void setHeightmapToGet(HeightMapType type, int[] data) {
BitArrayUnstretched bitArray = new BitArrayUnstretched(9, 256); BitArrayUnstretched bitArray = new BitArrayUnstretched(9, 256);
bitArray.fromRaw(data); bitArray.fromRaw(data);
nmsChunk.heightMap.get(HeightMap.Type.valueOf(type.name())).a(bitArray.getData()); getChunk().heightMap.get(HeightMap.Type.valueOf(type.name())).a(bitArray.getData());
} }
public int getChunkZ() { public int getChunkZ() {
@ -177,7 +177,7 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks implements BukkitGetBl
@Override @Override
public void removeSectionLighting(int layer, boolean sky) { public void removeSectionLighting(int layer, boolean sky) {
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer); SectionPosition sectionPosition = SectionPosition.a(getChunk().getPos(), layer);
NibbleArray nibble = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition); NibbleArray nibble = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition);
if (nibble != null) { if (nibble != null) {
lightUpdate = true; lightUpdate = true;
@ -189,7 +189,7 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks implements BukkitGetBl
} }
} }
if (sky) { if (sky) {
SectionPosition sectionPositionSky = SectionPosition.a(nmsChunk.getPos(), layer); SectionPosition sectionPositionSky = SectionPosition.a(getChunk().getPos(), layer);
NibbleArray nibbleSky = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPositionSky); NibbleArray nibbleSky = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPositionSky);
if (nibble != null) { if (nibble != null) {
lightUpdate = true; lightUpdate = true;
@ -226,7 +226,7 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks implements BukkitGetBl
@Override public int getSkyLight(int x, int y, int z) { @Override public int getSkyLight(int x, int y, int z) {
int layer = y >> 4; int layer = y >> 4;
if (skyLight[layer] == null) { if (skyLight[layer] == null) {
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer); SectionPosition sectionPosition = SectionPosition.a(getChunk().getPos(), layer);
NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPosition); NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPosition);
// If the server hasn't generated the section's NibbleArray yet, it will be null // If the server hasn't generated the section's NibbleArray yet, it will be null
if (nibbleArray == null) { if (nibbleArray == null) {
@ -245,7 +245,7 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks implements BukkitGetBl
@Override public int getEmmittedLight(int x, int y, int z) { @Override public int getEmmittedLight(int x, int y, int z) {
int layer = y >> 4; int layer = y >> 4;
if (blockLight[layer] == null) { if (blockLight[layer] == null) {
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer); SectionPosition sectionPosition = SectionPosition.a(getChunk().getPos(), layer);
NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition); NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition);
// If the server hasn't generated the section's NibbleArray yet, it will be null // If the server hasn't generated the section's NibbleArray yet, it will be null
if (nibbleArray == null) { if (nibbleArray == null) {
@ -352,7 +352,7 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks implements BukkitGetBl
private void updateGet(BukkitGetBlocks_1_16_1 get, Chunk nmsChunk, ChunkSection[] sections, ChunkSection section, char[] arr, int layer) { private void updateGet(BukkitGetBlocks_1_16_1 get, Chunk nmsChunk, ChunkSection[] sections, ChunkSection section, char[] arr, int layer) {
synchronized (get) { synchronized (get) {
if (this.nmsChunk != nmsChunk) { if (this.getChunk() != nmsChunk) {
this.nmsChunk = nmsChunk; this.nmsChunk = nmsChunk;
this.sections = sections.clone(); this.sections = sections.clone();
this.reset(); this.reset();
@ -451,7 +451,7 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks implements BukkitGetBl
synchronized (this) { synchronized (this) {
synchronized (lock) { synchronized (lock) {
lock.untilFree(); lock.untilFree();
if (this.nmsChunk != nmsChunk) { if (this.getChunk() != nmsChunk) {
this.nmsChunk = nmsChunk; this.nmsChunk = nmsChunk;
this.sections = null; this.sections = null;
this.reset(); this.reset();

Datei anzeigen

@ -151,7 +151,7 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks implements BukkitGetBl
public void setHeightmapToGet(HeightMapType type, int[] data) { public void setHeightmapToGet(HeightMapType type, int[] data) {
BitArrayUnstretched bitArray = new BitArrayUnstretched(9, 256); BitArrayUnstretched bitArray = new BitArrayUnstretched(9, 256);
bitArray.fromRaw(data); bitArray.fromRaw(data);
nmsChunk.heightMap.get(HeightMap.Type.valueOf(type.name())).a(bitArray.getData()); getChunk().heightMap.get(HeightMap.Type.valueOf(type.name())).a(bitArray.getData());
} }
public int getChunkZ() { public int getChunkZ() {
@ -177,7 +177,7 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks implements BukkitGetBl
@Override @Override
public void removeSectionLighting(int layer, boolean sky) { public void removeSectionLighting(int layer, boolean sky) {
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer); SectionPosition sectionPosition = SectionPosition.a(getChunk().getPos(), layer);
NibbleArray nibble = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition); NibbleArray nibble = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition);
if (nibble != null) { if (nibble != null) {
lightUpdate = true; lightUpdate = true;
@ -189,7 +189,7 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks implements BukkitGetBl
} }
} }
if (sky) { if (sky) {
SectionPosition sectionPositionSky = SectionPosition.a(nmsChunk.getPos(), layer); SectionPosition sectionPositionSky = SectionPosition.a(getChunk().getPos(), layer);
NibbleArray nibbleSky = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPositionSky); NibbleArray nibbleSky = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPositionSky);
if (nibble != null) { if (nibble != null) {
lightUpdate = true; lightUpdate = true;
@ -227,7 +227,7 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks implements BukkitGetBl
public int getSkyLight(int x, int y, int z) { public int getSkyLight(int x, int y, int z) {
int layer = y >> 4; int layer = y >> 4;
if (skyLight[layer] == null) { if (skyLight[layer] == null) {
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer); SectionPosition sectionPosition = SectionPosition.a(getChunk().getPos(), layer);
NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPosition); NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPosition);
// If the server hasn't generated the section's NibbleArray yet, it will be null // If the server hasn't generated the section's NibbleArray yet, it will be null
if (nibbleArray == null) { if (nibbleArray == null) {
@ -247,7 +247,7 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks implements BukkitGetBl
public int getEmmittedLight(int x, int y, int z) { public int getEmmittedLight(int x, int y, int z) {
int layer = y >> 4; int layer = y >> 4;
if (blockLight[layer] == null) { if (blockLight[layer] == null) {
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer); SectionPosition sectionPosition = SectionPosition.a(getChunk().getPos(), layer);
NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition); NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition);
// If the server hasn't generated the section's NibbleArray yet, it will be null // If the server hasn't generated the section's NibbleArray yet, it will be null
if (nibbleArray == null) { if (nibbleArray == null) {
@ -355,7 +355,7 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks implements BukkitGetBl
private void updateGet(BukkitGetBlocks_1_16_2 get, Chunk nmsChunk, ChunkSection[] sections, ChunkSection section, char[] arr, int layer) { private void updateGet(BukkitGetBlocks_1_16_2 get, Chunk nmsChunk, ChunkSection[] sections, ChunkSection section, char[] arr, int layer) {
synchronized (get) { synchronized (get) {
if (this.nmsChunk != nmsChunk) { if (this.getChunk() != nmsChunk) {
this.nmsChunk = nmsChunk; this.nmsChunk = nmsChunk;
this.sections = sections.clone(); this.sections = sections.clone();
this.reset(); this.reset();
@ -454,7 +454,7 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks implements BukkitGetBl
synchronized (this) { synchronized (this) {
synchronized (lock) { synchronized (lock) {
lock.untilFree(); lock.untilFree();
if (this.nmsChunk != nmsChunk) { if (this.getChunk() != nmsChunk) {
this.nmsChunk = nmsChunk; this.nmsChunk = nmsChunk;
this.sections = null; this.sections = null;
this.reset(); this.reset();

Datei anzeigen

@ -151,7 +151,7 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
public void setHeightmapToGet(HeightMapType type, int[] data) { public void setHeightmapToGet(HeightMapType type, int[] data) {
BitArrayUnstretched bitArray = new BitArrayUnstretched(9, 256); BitArrayUnstretched bitArray = new BitArrayUnstretched(9, 256);
bitArray.fromRaw(data); bitArray.fromRaw(data);
nmsChunk.heightMap.get(HeightMap.Type.valueOf(type.name())).a(bitArray.getData()); getChunk().heightMap.get(HeightMap.Type.valueOf(type.name())).a(bitArray.getData());
} }
public int getChunkZ() { public int getChunkZ() {
@ -177,7 +177,7 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
@Override @Override
public void removeSectionLighting(int layer, boolean sky) { public void removeSectionLighting(int layer, boolean sky) {
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer); SectionPosition sectionPosition = SectionPosition.a(getChunk().getPos(), layer);
NibbleArray nibble = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition); NibbleArray nibble = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition);
if (nibble != null) { if (nibble != null) {
lightUpdate = true; lightUpdate = true;
@ -189,7 +189,7 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
} }
} }
if (sky) { if (sky) {
SectionPosition sectionPositionSky = SectionPosition.a(nmsChunk.getPos(), layer); SectionPosition sectionPositionSky = SectionPosition.a(getChunk().getPos(), layer);
NibbleArray nibbleSky = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPositionSky); NibbleArray nibbleSky = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPositionSky);
if (nibble != null) { if (nibble != null) {
lightUpdate = true; lightUpdate = true;
@ -227,7 +227,7 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
public int getSkyLight(int x, int y, int z) { public int getSkyLight(int x, int y, int z) {
int layer = y >> 4; int layer = y >> 4;
if (skyLight[layer] == null) { if (skyLight[layer] == null) {
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer); SectionPosition sectionPosition = SectionPosition.a(getChunk().getPos(), layer);
NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPosition); NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPosition);
// If the server hasn't generated the section's NibbleArray yet, it will be null // If the server hasn't generated the section's NibbleArray yet, it will be null
if (nibbleArray == null) { if (nibbleArray == null) {
@ -247,7 +247,7 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
public int getEmmittedLight(int x, int y, int z) { public int getEmmittedLight(int x, int y, int z) {
int layer = y >> 4; int layer = y >> 4;
if (blockLight[layer] == null) { if (blockLight[layer] == null) {
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer); SectionPosition sectionPosition = SectionPosition.a(getChunk().getPos(), layer);
NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition); NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition);
// If the server hasn't generated the section's NibbleArray yet, it will be null // If the server hasn't generated the section's NibbleArray yet, it will be null
if (nibbleArray == null) { if (nibbleArray == null) {
@ -355,7 +355,7 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
private void updateGet(BukkitGetBlocks_1_16_4 get, Chunk nmsChunk, ChunkSection[] sections, ChunkSection section, char[] arr, int layer) { private void updateGet(BukkitGetBlocks_1_16_4 get, Chunk nmsChunk, ChunkSection[] sections, ChunkSection section, char[] arr, int layer) {
synchronized (get) { synchronized (get) {
if (this.nmsChunk != nmsChunk) { if (this.getChunk() != nmsChunk) {
this.nmsChunk = nmsChunk; this.nmsChunk = nmsChunk;
this.sections = sections.clone(); this.sections = sections.clone();
this.reset(); this.reset();
@ -454,7 +454,7 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
synchronized (this) { synchronized (this) {
synchronized (lock) { synchronized (lock) {
lock.untilFree(); lock.untilFree();
if (this.nmsChunk != nmsChunk) { if (this.getChunk() != nmsChunk) {
this.nmsChunk = nmsChunk; this.nmsChunk = nmsChunk;
this.sections = null; this.sections = null;
this.reset(); this.reset();