mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 03:05:30 -04:00
Fixed NPE in robot.use().
Fixed undirected robot commands leading to unexpected results (in particular place, which can place blocks in "adjacent" blocks if the block is replaceable), always testing into the primary facing direction first now.
This commit is contained in:
parent
1bb2c76bd5
commit
b3ea58c96b
@ -306,7 +306,7 @@ class Player(val robot: tileentity.Robot) extends EntityPlayer(robot.world, Sett
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private def isItemUseAllowed(stack: ItemStack) = {
|
private def isItemUseAllowed(stack: ItemStack) = stack == null || {
|
||||||
(Settings.get.allowUseItemsWithDuration || stack.getMaxItemUseDuration <= 0) &&
|
(Settings.get.allowUseItemsWithDuration || stack.getMaxItemUseDuration <= 0) &&
|
||||||
(!PortalGun.isPortalGun(stack) || PortalGun.isStandardPortalGun(stack)) &&
|
(!PortalGun.isPortalGun(stack) || PortalGun.isStandardPortalGun(stack)) &&
|
||||||
!stack.isItemEqual(new ItemStack(Item.leash))
|
!stack.isItemEqual(new ItemStack(Item.leash))
|
||||||
|
@ -231,7 +231,8 @@ class Robot(val robot: tileentity.Robot) extends ManagedComponent {
|
|||||||
Iterable(checkSideForFace(args, 1, facing))
|
Iterable(checkSideForFace(args, 1, facing))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ForgeDirection.VALID_DIRECTIONS.filter(_ != facing.getOpposite).toIterable
|
// Always try the direction we're looking first.
|
||||||
|
Iterable(facing) ++ ForgeDirection.VALID_DIRECTIONS.filter(side => side != facing && side != facing.getOpposite).toIterable
|
||||||
}
|
}
|
||||||
val sneaky = args.isBoolean(2) && args.checkBoolean(2)
|
val sneaky = args.isBoolean(2) && args.checkBoolean(2)
|
||||||
val stack = player.robotInventory.selectedItemStack
|
val stack = player.robotInventory.selectedItemStack
|
||||||
@ -337,7 +338,8 @@ class Robot(val robot: tileentity.Robot) extends ManagedComponent {
|
|||||||
Iterable(checkSideForFace(args, 1, facing))
|
Iterable(checkSideForFace(args, 1, facing))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ForgeDirection.VALID_DIRECTIONS.filter(_ != facing.getOpposite).toIterable
|
// Always try the direction we're looking first.
|
||||||
|
Iterable(facing) ++ ForgeDirection.VALID_DIRECTIONS.filter(side => side != facing && side != facing.getOpposite).toIterable
|
||||||
}
|
}
|
||||||
val sneaky = args.isBoolean(2) && args.checkBoolean(2)
|
val sneaky = args.isBoolean(2) && args.checkBoolean(2)
|
||||||
|
|
||||||
@ -414,7 +416,8 @@ class Robot(val robot: tileentity.Robot) extends ManagedComponent {
|
|||||||
Iterable(checkSideForFace(args, 1, facing))
|
Iterable(checkSideForFace(args, 1, facing))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ForgeDirection.VALID_DIRECTIONS.filter(_ != facing.getOpposite).toIterable
|
// Always try the direction we're looking first.
|
||||||
|
Iterable(facing) ++ ForgeDirection.VALID_DIRECTIONS.filter(side => side != facing && side != facing.getOpposite).toIterable
|
||||||
}
|
}
|
||||||
val sneaky = args.isBoolean(2) && args.checkBoolean(2)
|
val sneaky = args.isBoolean(2) && args.checkBoolean(2)
|
||||||
val duration =
|
val duration =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user