diff --git a/forge-1.11.2/src/main/java/org/dynmap/forge_1_11_2/ForgeMapChunkCache.java b/forge-1.11.2/src/main/java/org/dynmap/forge_1_11_2/ForgeMapChunkCache.java index 6abe9d3c..3be15118 100644 --- a/forge-1.11.2/src/main/java/org/dynmap/forge_1_11_2/ForgeMapChunkCache.java +++ b/forge-1.11.2/src/main/java/org/dynmap/forge_1_11_2/ForgeMapChunkCache.java @@ -186,20 +186,38 @@ public class ForgeMapChunkCache extends MapChunkCache int emit = 0, sky = 15; if (step.yoff != 0) { // Y coord - snap is valid already int ny = y + step.yoff; - emit = snap.getBlockEmittedLight(x, ny, z); - sky = snap.getBlockSkyLight(x, ny, z); + emit = snap.getBlockEmittedLight(bx, ny, bz); + sky = snap.getBlockSkyLight(bx, ny, bz); } else { int nx = x + step.xoff; int nz = z + step.zoff; int nchunkindex = ((nx >> 4) - x_min) + (((nz >> 4) - z_min) * x_dim); if ((nchunkindex < snapcnt) && (nchunkindex >= 0)) { - emit = snaparray[nchunkindex].getBlockEmittedLight(nx, y, nz); - sky = snaparray[nchunkindex].getBlockSkyLight(nx, y, nz); + emit = snaparray[nchunkindex].getBlockEmittedLight(nx & 0xF, y, nz & 0xF); + sky = snaparray[nchunkindex].getBlockSkyLight(nx & 0xF, y, nz & 0xF); } } return (emit << 8) + sky; } + @Override + /** + * Get block sky and emitted light, relative to current coordinate + * @return (emitted light * 256) + sky light + */ + public final int getBlockLight(int xoff, int yoff, int zoff) { + int emit = 0, sky = 15; + int nx = x + xoff; + int ny = y + yoff; + int nz = z + zoff; + int nchunkindex = ((nx >> 4) - x_min) + (((nz >> 4) - z_min) * x_dim); + if ((nchunkindex < snapcnt) && (nchunkindex >= 0)) { + emit = snaparray[nchunkindex].getBlockEmittedLight(nx & 0xF, ny, nz & 0xF); + sky = snaparray[nchunkindex].getBlockSkyLight(nx & 0xF, ny, nz & 0xF); + } + return (emit << 8) + sky; + } + private void biomePrep() { if (sameneighborbiomecnt != null) diff --git a/forge-1.12.2/src/main/java/org/dynmap/forge_1_12_2/ForgeMapChunkCache.java b/forge-1.12.2/src/main/java/org/dynmap/forge_1_12_2/ForgeMapChunkCache.java index a878820a..5ab462ea 100644 --- a/forge-1.12.2/src/main/java/org/dynmap/forge_1_12_2/ForgeMapChunkCache.java +++ b/forge-1.12.2/src/main/java/org/dynmap/forge_1_12_2/ForgeMapChunkCache.java @@ -186,20 +186,37 @@ public class ForgeMapChunkCache extends MapChunkCache int emit = 0, sky = 15; if (step.yoff != 0) { // Y coord - snap is valid already int ny = y + step.yoff; - emit = snap.getBlockEmittedLight(x, ny, z); - sky = snap.getBlockSkyLight(x, ny, z); + emit = snap.getBlockEmittedLight(bx, ny, bz); + sky = snap.getBlockSkyLight(bx, ny, bz); } else { int nx = x + step.xoff; int nz = z + step.zoff; int nchunkindex = ((nx >> 4) - x_min) + (((nz >> 4) - z_min) * x_dim); if ((nchunkindex < snapcnt) && (nchunkindex >= 0)) { - emit = snaparray[nchunkindex].getBlockEmittedLight(nx, y, nz); - sky = snaparray[nchunkindex].getBlockSkyLight(nx, y, nz); + emit = snaparray[nchunkindex].getBlockEmittedLight(nx & 0xF, y, nz & 0xF); + sky = snaparray[nchunkindex].getBlockSkyLight(nx & 0xF, y, nz & 0xF); } } return (emit << 8) + sky; } + @Override + /** + * Get block sky and emitted light, relative to current coordinate + * @return (emitted light * 256) + sky light + */ + public final int getBlockLight(int xoff, int yoff, int zoff) { + int emit = 0, sky = 15; + int nx = x + xoff; + int ny = y + yoff; + int nz = z + zoff; + int nchunkindex = ((nx >> 4) - x_min) + (((nz >> 4) - z_min) * x_dim); + if ((nchunkindex < snapcnt) && (nchunkindex >= 0)) { + emit = snaparray[nchunkindex].getBlockEmittedLight(nx & 0xF, ny, nz & 0xF); + sky = snaparray[nchunkindex].getBlockSkyLight(nx & 0xF, ny, nz & 0xF); + } + return (emit << 8) + sky; + } private void biomePrep() {