use of net.minecraft.world.EnumSkyBlock in project Galacticraft by micdoodle8.
the class TileEntityArclamp method getRawLight.
/**
* From vanilla. This is buggy, gets confused if two low opacity blocks adjacent (e.g. redstone wire, stairs)
* if those blocks are receiving similar light levels from another source
*/
private int getRawLight(BlockPos pos, EnumSkyBlock lightType) {
Block block = this.worldObj.getBlockState(pos).getBlock();
int blockLight = block.getLightValue(this.worldObj, pos);
int light = lightType == EnumSkyBlock.SKY ? 0 : blockLight;
if (light < 14) {
int opacity = block.getLightOpacity(this.worldObj, pos);
if (opacity < 1) {
opacity = 1;
} else if (opacity >= 15) {
if (blockLight > 0) {
opacity = 1;
} else {
return 0;
}
}
for (BlockPos blockpos : GCCoreUtil.getPositionsAdjoining(pos)) {
// Easily picks up neighbour lighting if opacity is low...
int neighbourLight = this.worldObj.getLightFor(lightType, blockpos) - opacity;
if (neighbourLight > light) {
if (neighbourLight >= 14) {
return neighbourLight;
}
light = neighbourLight;
}
}
}
return light;
}
Aggregations