mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 10:51:55 -04:00
Merge branch master-MC1.11 into master-MC1.12
This commit is contained in:
commit
1659af29b0
@ -12,9 +12,12 @@ trait ItemStackInventory extends Inventory {
|
||||
override def items = inventory
|
||||
|
||||
// Initialize the list automatically if we have a container.
|
||||
if (!container.isEmpty) {
|
||||
{
|
||||
val _container = container
|
||||
if (_container != null && !_container.isEmpty) {
|
||||
reinitialize()
|
||||
}
|
||||
}
|
||||
|
||||
// Load items from tag.
|
||||
def reinitialize() {
|
||||
|
@ -213,12 +213,22 @@ class Player(val agent: internal.Agent) extends FakePlayer(agent.world.asInstanc
|
||||
private var offHand: (IInventory, Int) = _
|
||||
|
||||
override def setItemStackToSlot(slotIn: EntityEquipmentSlot, stack: ItemStack): Unit = {
|
||||
var superCall: () => Unit = () => super.setItemStackToSlot(slotIn, stack)
|
||||
if (slotIn == EntityEquipmentSlot.MAINHAND) {
|
||||
agent.equipmentInventory.setInventorySlotContents(0, stack)
|
||||
superCall = () => {
|
||||
val slot = inventory.currentItem
|
||||
// So, if we're not in the main inventory, currentItem is set to -1
|
||||
// for compatibility with mods that try accessing the inv directly
|
||||
// using inventory.currentItem. See li.cil.oc.server.agent.Inventory
|
||||
if(inventory.currentItem < 0) inventory.currentItem = ~inventory.currentItem
|
||||
super.setItemStackToSlot(slotIn, stack)
|
||||
inventory.currentItem = slot
|
||||
}
|
||||
} else if(slotIn == EntityEquipmentSlot.OFFHAND && offHand != null) {
|
||||
offHand._1.setInventorySlotContents(offHand._2, stack)
|
||||
}
|
||||
super.setItemStackToSlot(slotIn, stack)
|
||||
superCall()
|
||||
}
|
||||
|
||||
override def getItemStackFromSlot(slotIn: EntityEquipmentSlot): ItemStack = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user