mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 18:55:03 -04:00
Merge branch master-MC1.11 into master-MC1.12
This commit is contained in:
commit
1659af29b0
@ -12,8 +12,11 @@ trait ItemStackInventory extends Inventory {
|
|||||||
override def items = inventory
|
override def items = inventory
|
||||||
|
|
||||||
// Initialize the list automatically if we have a container.
|
// Initialize the list automatically if we have a container.
|
||||||
if (!container.isEmpty) {
|
{
|
||||||
reinitialize()
|
val _container = container
|
||||||
|
if (_container != null && !_container.isEmpty) {
|
||||||
|
reinitialize()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load items from tag.
|
// Load items from tag.
|
||||||
|
@ -213,12 +213,22 @@ class Player(val agent: internal.Agent) extends FakePlayer(agent.world.asInstanc
|
|||||||
private var offHand: (IInventory, Int) = _
|
private var offHand: (IInventory, Int) = _
|
||||||
|
|
||||||
override def setItemStackToSlot(slotIn: EntityEquipmentSlot, stack: ItemStack): Unit = {
|
override def setItemStackToSlot(slotIn: EntityEquipmentSlot, stack: ItemStack): Unit = {
|
||||||
|
var superCall: () => Unit = () => super.setItemStackToSlot(slotIn, stack)
|
||||||
if (slotIn == EntityEquipmentSlot.MAINHAND) {
|
if (slotIn == EntityEquipmentSlot.MAINHAND) {
|
||||||
agent.equipmentInventory.setInventorySlotContents(0, stack)
|
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) {
|
} else if(slotIn == EntityEquipmentSlot.OFFHAND && offHand != null) {
|
||||||
offHand._1.setInventorySlotContents(offHand._2, stack)
|
offHand._1.setInventorySlotContents(offHand._2, stack)
|
||||||
}
|
}
|
||||||
super.setItemStackToSlot(slotIn, stack)
|
superCall()
|
||||||
}
|
}
|
||||||
|
|
||||||
override def getItemStackFromSlot(slotIn: EntityEquipmentSlot): ItemStack = {
|
override def getItemStackFromSlot(slotIn: EntityEquipmentSlot): ItemStack = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user