cable only checks neighbor blocks if y >= 0 , Fixes #63

This commit is contained in:
Johannes Lohrer 2014-01-06 01:00:52 +01:00
parent c1e283ca87
commit f4d8f8c51f

View File

@ -91,16 +91,17 @@ object Cable {
def neighbors(world: IBlockAccess, x: Int, y: Int, z: Int) = {
var result = 0
for (side <- ForgeDirection.VALID_DIRECTIONS) {
world.getBlockTileEntity(x + side.offsetX, y + side.offsetY, z + side.offsetZ) match {
case robot: tileentity.RobotProxy =>
case host: SidedEnvironment =>
val connects = if (host.getWorldObj.isRemote) host.canConnect(side.getOpposite) else host.sidedNode(side.getOpposite) != null
if (connects) {
result |= side.flag
}
case host: Environment => result |= side.flag
case _ =>
}
if (y + side.offsetY >= 0)
world.getBlockTileEntity(x + side.offsetX, y + side.offsetY, z + side.offsetZ) match {
case robot: tileentity.RobotProxy =>
case host: SidedEnvironment =>
val connects = if (host.getWorldObj.isRemote) host.canConnect(side.getOpposite) else host.sidedNode(side.getOpposite) != null
if (connects) {
result |= side.flag
}
case host: Environment => result |= side.flag
case _ =>
}
}
result
}