Fixed BlockRef crash on dedicated servers (bdew/generators#26)

This commit is contained in:
bdew committed 2015-02-20 13:23:11 +02:00
1 parent be3a1cf2aa
commit 35b3a77582
1 file changed
+1 -1
+1 -1
View File
@@ -18,7 +18,7 @@ import net.minecraftforge.common.util.ForgeDirection
import scala.reflect.ClassTag
case class BlockRef(x: Int, y: Int, z: Int) {
def isValid(w: IBlockAccess) = y >= 0 && y < w.getHeight
def isValid(w: IBlockAccess) = y >= 0 && y < 256 // hardcoded because getHeight is unavailable on servers :(
def block(w: IBlockAccess) = if (isValid(w)) Option(w.getBlock(x, y, z)) else None
def tile(w: IBlockAccess) = if (isValid(w)) Option(w.getTileEntity(x, y, z)) else None