mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-15 10:21:45 -04:00
added checks for invalid coordinates when fetching tile entities for neighbors, fixes #63
This commit is contained in:
parent
c1e283ca87
commit
e266ccbcc3
@ -91,7 +91,8 @@ 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 {
|
||||
val (tx, ty, tz) = (x + side.offsetX, y + side.offsetY, z + side.offsetZ)
|
||||
if (world.getBlockId(tx, ty, tz) != 0) world.getBlockTileEntity(tx, ty, tz) match {
|
||||
case robot: tileentity.RobotProxy =>
|
||||
case host: SidedEnvironment =>
|
||||
val connects = if (host.getWorldObj.isRemote) host.canConnect(side.getOpposite) else host.sidedNode(side.getOpposite) != null
|
||||
|
@ -101,7 +101,8 @@ class RobotAfterimage(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
|
||||
def findMovingRobot(world: IBlockAccess, x: Int, y: Int, z: Int): Option[tileentity.Robot] = {
|
||||
for (side <- ForgeDirection.VALID_DIRECTIONS) {
|
||||
world.getBlockTileEntity(x + side.offsetX, y + side.offsetY, z + side.offsetZ) match {
|
||||
val (tx, ty, tz) = (x + side.offsetX, y + side.offsetY, z + side.offsetZ)
|
||||
if (world.getBlockId(tx, ty, tz) != 0) world.getBlockTileEntity(tx, ty, tz) match {
|
||||
case proxy: tileentity.RobotProxy if proxy.robot.moveFromX == x && proxy.robot.moveFromY == y && proxy.robot.moveFromZ == z => return Some(proxy.robot)
|
||||
case _ =>
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user