mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-19 04:06:43 -04:00
Added Useability check for wrapped inventories.
This commit is contained in:
parent
3a8132a60e
commit
97ee3f3ac7
@ -20,6 +20,7 @@ import net.minecraftforge.event.world.BlockEvent
|
||||
import net.minecraftforge.fluids.FluidRegistry
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.Result
|
||||
import net.minecraftforge.items.IItemHandler
|
||||
import net.minecraftforge.items.wrapper.InvWrapper
|
||||
|
||||
trait WorldAware {
|
||||
def position: BlockPosition
|
||||
@ -46,7 +47,10 @@ trait WorldAware {
|
||||
}
|
||||
}
|
||||
|
||||
def mayInteract(blockPos: BlockPosition, side: EnumFacing, inventory: IItemHandler): Boolean = mayInteract(blockPos, side) // This uses the inventory object in 1.9+
|
||||
def mayInteract(blockPos: BlockPosition, side: EnumFacing, inventory: IItemHandler): Boolean = mayInteract(blockPos, side) && (inventory match {
|
||||
case inv: InvWrapper if inv.getInv != null => inv.getInv.isUseableByPlayer(fakePlayer)
|
||||
case _ => true
|
||||
})
|
||||
|
||||
def entitiesInBounds[Type <: Entity](clazz: Class[Type], bounds: AxisAlignedBB) = {
|
||||
world.getEntitiesWithinAABB(clazz, bounds)
|
||||
|
Loading…
x
Reference in New Issue
Block a user