Fix terminal appearing to change buffer mode to from_network when insertion fails
This commit is contained in:
parent
afd0db4929
commit
535dedbdd2
|
@ -109,7 +109,15 @@ abstract class AbstractTerminalBlockEntity(type: BlockEntityType<*>): DeviceBloc
|
|||
}
|
||||
|
||||
override fun doHandleItemStack(packet: ItemStackPacket): ItemStack {
|
||||
val remaining = internalBuffer.insert(packet.stack, TerminalBufferInventory.Mode.FROM_NETWORK)
|
||||
val mode =
|
||||
if (packet.bounceCount > 0) {
|
||||
// if this stack bounced from an inventory, that means we previously tried to send it to the network, so retry
|
||||
TerminalBufferInventory.Mode.TO_NETWORK
|
||||
} else {
|
||||
TerminalBufferInventory.Mode.FROM_NETWORK
|
||||
}
|
||||
|
||||
val remaining = internalBuffer.insert(packet.stack, mode)
|
||||
|
||||
// this happens outside the normal update loop because by receiving the item stack packet
|
||||
// we "know" how much the count in the source inventory has changed
|
||||
|
|
Loading…
Reference in New Issue