mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-09 15:25:56 -04:00
in case held item updates INHAND (e.g. milking a cow) move it to our offhand buffer as our agent code expects
closes #3200
This commit is contained in:
parent
481ae2f91a
commit
1178a90f80
@ -226,10 +226,16 @@ class Player(val agent: internal.Agent) extends FakePlayer(agent.world.asInstanc
|
||||
case living: EntityLivingBase if !getHeldItemMainhand.isEmpty => getHeldItemMainhand.interactWithEntity(this, living, hand)
|
||||
case _ => false
|
||||
}))
|
||||
if (!getHeldItemMainhand.isEmpty && getHeldItemMainhand.getCount <= 0) {
|
||||
val orig = getHeldItemMainhand
|
||||
this.inventory.setInventorySlotContents(this.inventory.currentItem, ItemStack.EMPTY)
|
||||
ForgeEventFactory.onPlayerDestroyItem(this, orig, hand)
|
||||
if (!getHeldItemMainhand.isEmpty) {
|
||||
if (getHeldItemMainhand.getCount <= 0) {
|
||||
val orig = getHeldItemMainhand
|
||||
this.inventory.setInventorySlotContents(this.inventory.currentItem, ItemStack.EMPTY)
|
||||
ForgeEventFactory.onPlayerDestroyItem(this, orig, hand)
|
||||
} else {
|
||||
// because of various hacks for IC2, we expect the in-hand result to be moved to our offhand buffer
|
||||
this.inventory.offHandInventory.set(0, getHeldItemMainhand)
|
||||
this.inventory.setInventorySlotContents(this.inventory.currentItem, ItemStack.EMPTY)
|
||||
}
|
||||
}
|
||||
result
|
||||
})) EnumActionResult.SUCCESS else EnumActionResult.PASS
|
||||
|
Loading…
x
Reference in New Issue
Block a user