mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-30 22:24:06 +01:00
Fix lighting exception in pre 1.13.2 Spigot/Paper
This commit is contained in:
parent
592ad5028e
commit
3c76c3f875
@ -164,16 +164,16 @@ public abstract class AbstractMapChunkCache extends MapChunkCache {
|
|||||||
int emit = 0, sky = 15;
|
int emit = 0, sky = 15;
|
||||||
if (step.yoff != 0) { // Y coord - snap is valid already
|
if (step.yoff != 0) { // Y coord - snap is valid already
|
||||||
int ny = y + step.yoff;
|
int ny = y + step.yoff;
|
||||||
emit = snap.getBlockEmittedLight(x, ny, z);
|
emit = snap.getBlockEmittedLight(bx, ny, bz);
|
||||||
sky = snap.getBlockSkyLight(x, ny, z);
|
sky = snap.getBlockSkyLight(bx, ny, bz);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int nx = x + step.xoff;
|
int nx = x + step.xoff;
|
||||||
int nz = z + step.zoff;
|
int nz = z + step.zoff;
|
||||||
int nchunkindex = ((nx >> 4) - x_min) + (((nz >> 4) - z_min) * x_dim);
|
int nchunkindex = ((nx >> 4) - x_min) + (((nz >> 4) - z_min) * x_dim);
|
||||||
if ((nchunkindex < snapcnt) && (nchunkindex >= 0)) {
|
if ((nchunkindex < snapcnt) && (nchunkindex >= 0)) {
|
||||||
emit = snaparray[nchunkindex].getBlockEmittedLight(nx, y, nz);
|
emit = snaparray[nchunkindex].getBlockEmittedLight(nx & 0xF, y, nz & 0xF);
|
||||||
sky = snaparray[nchunkindex].getBlockSkyLight(nx, y, nz);
|
sky = snaparray[nchunkindex].getBlockSkyLight(nx & 0xF, y, nz & 0xF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (emit << 8) + sky;
|
return (emit << 8) + sky;
|
||||||
@ -190,8 +190,8 @@ public abstract class AbstractMapChunkCache extends MapChunkCache {
|
|||||||
int nz = z + zoff;
|
int nz = z + zoff;
|
||||||
int nchunkindex = ((nx >> 4) - x_min) + (((nz >> 4) - z_min) * x_dim);
|
int nchunkindex = ((nx >> 4) - x_min) + (((nz >> 4) - z_min) * x_dim);
|
||||||
if ((nchunkindex < snapcnt) && (nchunkindex >= 0)) {
|
if ((nchunkindex < snapcnt) && (nchunkindex >= 0)) {
|
||||||
emit = snaparray[nchunkindex].getBlockEmittedLight(nx, ny, nz);
|
emit = snaparray[nchunkindex].getBlockEmittedLight(nx & 0xF, ny, nz & 0xF);
|
||||||
sky = snaparray[nchunkindex].getBlockSkyLight(nx, ny, nz);
|
sky = snaparray[nchunkindex].getBlockSkyLight(nx & 0xF, ny, nz & 0xF);
|
||||||
}
|
}
|
||||||
return (emit << 8) + sky;
|
return (emit << 8) + sky;
|
||||||
}
|
}
|
||||||
|
@ -46,15 +46,15 @@ public class MapChunkCacheClassic extends AbstractMapChunkCache {
|
|||||||
public final DynmapBlockState getBlockType(int x, int y, int z) {
|
public final DynmapBlockState getBlockType(int x, int y, int z) {
|
||||||
if ((sectionmask & (1 << (y >> 4))) != 0)
|
if ((sectionmask & (1 << (y >> 4))) != 0)
|
||||||
return DynmapBlockState.AIR;
|
return DynmapBlockState.AIR;
|
||||||
return BukkitVersionHelper.stateByID[(ss.getBlockTypeId(x, y, z) << 4) | ss.getBlockData(x, y, z)];
|
return BukkitVersionHelper.stateByID[(ss.getBlockTypeId(x & 0xF, y, z & 0xF) << 4) | ss.getBlockData(x & 0xF, y, z & 0xF)];
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public final int getBlockSkyLight(int x, int y, int z) {
|
public final int getBlockSkyLight(int x, int y, int z) {
|
||||||
return ss.getBlockSkyLight(x, y, z);
|
return ss.getBlockSkyLight(x & 0xF, y, z & 0xF);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public final int getBlockEmittedLight(int x, int y, int z) {
|
public final int getBlockEmittedLight(int x, int y, int z) {
|
||||||
return ss.getBlockEmittedLight(x, y, z);
|
return ss.getBlockEmittedLight(x & 0xF, y, z & 0xF);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public final int getHighestBlockYAt(int x, int z) {
|
public final int getHighestBlockYAt(int x, int z) {
|
||||||
@ -62,7 +62,7 @@ public class MapChunkCacheClassic extends AbstractMapChunkCache {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public final Biome getBiome(int x, int z) {
|
public final Biome getBiome(int x, int z) {
|
||||||
return ss.getBiome(x, z);
|
return ss.getBiome(x & 0xF, z & 0xF);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public final boolean isSectionEmpty(int sy) {
|
public final boolean isSectionEmpty(int sy) {
|
||||||
|
Loading…
Reference in New Issue
Block a user