Files
CodeChickenCore/codechicken/lib/lighting/LazyLightMatrix.java
T
2013-07-16 17:58:02 +10:00

28 lines
708 B
Java

package codechicken.lib.lighting;
import net.minecraft.world.IBlockAccess;
import codechicken.lib.vec.BlockCoord;
public class LazyLightMatrix
{
private BlockCoord pos = new BlockCoord();
private IBlockAccess access;
private boolean computed = false;
private LightMatrix lightMatrix = new LightMatrix();
public LightMatrix lightMatrix()
{
if(computed)
return lightMatrix;
computed = true;
lightMatrix.computeAt(access, pos.x, pos.y, pos.z);
return lightMatrix;
}
public void setPos(IBlockAccess access, int x, int y, int z)
{
computed = false;
this.access = access;
pos.set(x, y, z);
}
}