mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-10 07:45:05 -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 living: EntityLivingBase if !getHeldItemMainhand.isEmpty => getHeldItemMainhand.interactWithEntity(this, living, hand)
|
||||||
case _ => false
|
case _ => false
|
||||||
}))
|
}))
|
||||||
if (!getHeldItemMainhand.isEmpty && getHeldItemMainhand.getCount <= 0) {
|
if (!getHeldItemMainhand.isEmpty) {
|
||||||
val orig = getHeldItemMainhand
|
if (getHeldItemMainhand.getCount <= 0) {
|
||||||
this.inventory.setInventorySlotContents(this.inventory.currentItem, ItemStack.EMPTY)
|
val orig = getHeldItemMainhand
|
||||||
ForgeEventFactory.onPlayerDestroyItem(this, orig, hand)
|
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
|
result
|
||||||
})) EnumActionResult.SUCCESS else EnumActionResult.PASS
|
})) EnumActionResult.SUCCESS else EnumActionResult.PASS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user