From 9aef16b2a3df56e542945fa1134d2af7042b5d87 Mon Sep 17 00:00:00 2001 From: payonel Date: Thu, 27 Sep 2018 01:41:23 -0700 Subject: [PATCH] use sided inventory for accessors to agent inv inventory calls such as `suck` and `suckFromSlot` were creating a sideless inventory handler on the agents (drones and robots). The sideless access was allowing the api calls to access slot indexes beyond the intended main inventory size, and creep into their component inventory (e.g. starting with slot index 69 on creatix), thus creating a copy of the agent's first component (e.g. a Screen block) This fix creates a sided inventory handler from the inventoryAt call, fixing these cases. closes #2935 --- src/main/scala/li/cil/oc/util/InventoryUtils.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/li/cil/oc/util/InventoryUtils.scala b/src/main/scala/li/cil/oc/util/InventoryUtils.scala index 5d9faeb7b..4a407bf50 100644 --- a/src/main/scala/li/cil/oc/util/InventoryUtils.scala +++ b/src/main/scala/li/cil/oc/util/InventoryUtils.scala @@ -47,7 +47,7 @@ object InventoryUtils { def inventoryAt(position: BlockPosition, side: EnumFacing): Option[IItemHandler] = position.world match { case Some(world) if world.blockExists(position) => world.getTileEntity(position) match { case tile: TileEntity if tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side) => Option(tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side)) - case tile: IInventory => Option(asItemHandler(tile)) + case tile: IInventory => Option(asItemHandler(tile, side)) case _ => world.getEntitiesWithinAABB(classOf[Entity], position.bounds) .filter(e => !e.isDead && e.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side)) .map(_.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side))