Fix terminal appearing to change buffer mode to from_network when insertion fails
This commit is contained in:
parent
4fa5a12746
commit
e4662b0f6f
|
@ -109,7 +109,15 @@ abstract class AbstractTerminalBlockEntity(type: BlockEntityType<*>): DeviceBloc
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doHandleItemStack(packet: ItemStackPacket): ItemStack {
|
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
|
// 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
|
// we "know" how much the count in the source inventory has changed
|
||||||
|
|
Loading…
Reference in New Issue