mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
parent
28837c7106
commit
d3ff4131a3
@ -105,19 +105,18 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
|
|||||||
return AdaptedMap.immutable(nmsTiles, posNms2We, nmsTile2We);
|
return AdaptedMap.immutable(nmsTiles, posNms2We, nmsTile2We);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override 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(nmsChunk.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) {
|
||||||
byte[] a = new byte[2048];
|
byte[] a = new byte[2048];
|
||||||
// Safe enough to assume if it's not created, it's under the sky. Unlikely to be created before lighting is fixed anyway.
|
// Safe enough to assume if it's not created, it's under the sky. Unlikely to be created before lighting is fixed anyway.
|
||||||
Arrays.fill(a, (byte) 15);
|
Arrays.fill(a, (byte) 15);
|
||||||
nibbleArray = new NibbleArray(a);
|
nibbleArray = new NibbleArray(a);
|
||||||
((LightEngine) world.getChunkProvider().getLightEngine()).a(EnumSkyBlock.SKY, sectionPosition, nibbleArray, true);
|
((LightEngine) world.getChunkProvider().getLightEngine()).a(EnumSkyBlock.SKY, sectionPosition, nibbleArray, true);
|
||||||
}
|
}
|
||||||
skyLight[layer] = nibbleArray;
|
skyLight[layer] = nibbleArray;
|
||||||
}
|
}
|
||||||
@ -125,21 +124,20 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
|
|||||||
return skyLight[layer].a(SectionPosition.b(BlockPosition.b(l)), SectionPosition.b(BlockPosition.c(l)), SectionPosition.b(BlockPosition.d(l)));
|
return skyLight[layer].a(SectionPosition.b(BlockPosition.b(l)), SectionPosition.b(BlockPosition.c(l)), SectionPosition.b(BlockPosition.d(l)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override 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 (skyLight[layer] == null) {
|
if (blockLight[layer] == null) {
|
||||||
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer);
|
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.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) {
|
||||||
byte[] a = new byte[2048];
|
byte[] a = new byte[2048];
|
||||||
// Safe enough to assume if it's not created, it's under the sky. Unlikely to be created before lighting is fixed anyway.
|
// Safe enough to assume if it's not created, it's under the sky. Unlikely to be created before lighting is fixed anyway.
|
||||||
Arrays.fill(a, (byte) 15);
|
Arrays.fill(a, (byte) 15);
|
||||||
nibbleArray = new NibbleArray(a);
|
nibbleArray = new NibbleArray(a);
|
||||||
((LightEngine) world.getChunkProvider().getLightEngine()).a(EnumSkyBlock.BLOCK, sectionPosition, nibbleArray, true);
|
((LightEngine) world.getChunkProvider().getLightEngine()).a(EnumSkyBlock.BLOCK, sectionPosition, nibbleArray, true);
|
||||||
}
|
}
|
||||||
skyLight[layer] = nibbleArray;
|
blockLight[layer] = nibbleArray;
|
||||||
}
|
}
|
||||||
long l = BlockPosition.a(x, y, z);
|
long l = BlockPosition.a(x, y, z);
|
||||||
return blockLight[layer].a(SectionPosition.b(BlockPosition.b(l)), SectionPosition.b(BlockPosition.c(l)), SectionPosition.b(BlockPosition.d(l)));
|
return blockLight[layer].a(SectionPosition.b(BlockPosition.b(l)), SectionPosition.b(BlockPosition.c(l)), SectionPosition.b(BlockPosition.d(l)));
|
||||||
|
Loading…
Reference in New Issue
Block a user