mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-13 09:18:05 -04:00
Fixed interaction of agents with trapped chests adjacent to normal chests in certain orientations (would insert/remove into/from wrong chest). Closes #1205.
This commit is contained in:
parent
8dd4d841a9
commit
6c8370bcb3
@ -1,6 +1,7 @@
|
||||
package li.cil.oc.util
|
||||
|
||||
import li.cil.oc.util.ExtendedWorld._
|
||||
import net.minecraft.block.BlockChest
|
||||
import net.minecraft.entity.item.EntityItem
|
||||
import net.minecraft.entity.item.EntityMinecartContainer
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
@ -20,9 +21,9 @@ object InventoryUtils {
|
||||
* mine carts with chests.
|
||||
*/
|
||||
def inventoryAt(position: BlockPosition): Option[IInventory] = position.world match {
|
||||
case Some(world) if world.blockExists(position) => world.getTileEntity(position) match {
|
||||
case chest: TileEntityChest => Option(net.minecraft.init.Blocks.chest.func_149951_m(world, chest.xCoord, chest.yCoord, chest.zCoord))
|
||||
case inventory: IInventory => Some(inventory)
|
||||
case Some(world) if world.blockExists(position) => (world.getBlock(position), world.getTileEntity(position)) match {
|
||||
case (block: BlockChest, chest: TileEntityChest) => Option(block.func_149951_m(world, chest.xCoord, chest.yCoord, chest.zCoord))
|
||||
case (_, inventory: IInventory) => Some(inventory)
|
||||
case _ => world.getEntitiesWithinAABB(classOf[EntityMinecartContainer], position.bounds).
|
||||
map(_.asInstanceOf[EntityMinecartContainer]).
|
||||
find(!_.isDead)
|
||||
|
Loading…
x
Reference in New Issue
Block a user