FIx 1.11.2 and 1.12.2 lighting exception

This commit is contained in:
Mike Primm 2022-01-30 15:07:07 -06:00
parent e22ad9b8bf
commit 1e733a7d51
2 changed files with 43 additions and 8 deletions

View File

@ -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)

View File

@ -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()
{