mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-14 01:39:36 -04:00
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
This commit is contained in:
parent
ea252ff475
commit
9aef16b2a3
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user