Terminal: sync internal buffer inventory to client
This commit is contained in:
parent
68e612c63c
commit
5d62e60bb2
|
@ -99,6 +99,7 @@ class TerminalBlockEntity: DeviceBlockEntity(PhyBlockEntities.TERMINAL), Invento
|
||||||
override fun onInvChange(inv: Inventory) {
|
override fun onInvChange(inv: Inventory) {
|
||||||
if (inv == internalBuffer) {
|
if (inv == internalBuffer) {
|
||||||
markDirty()
|
markDirty()
|
||||||
|
sync()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,6 +114,7 @@ class TerminalBlockEntity: DeviceBlockEntity(PhyBlockEntities.TERMINAL), Invento
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toClientTag(tag: CompoundTag): CompoundTag {
|
override fun toClientTag(tag: CompoundTag): CompoundTag {
|
||||||
|
tag.put("InternalBuffer", internalBuffer.toTag())
|
||||||
val list = ListTag()
|
val list = ListTag()
|
||||||
tag.put("CachedNetItems", list)
|
tag.put("CachedNetItems", list)
|
||||||
for ((stack, amount) in cachedNetItems) {
|
for ((stack, amount) in cachedNetItems) {
|
||||||
|
@ -124,6 +126,7 @@ class TerminalBlockEntity: DeviceBlockEntity(PhyBlockEntities.TERMINAL), Invento
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun fromClientTag(tag: CompoundTag) {
|
override fun fromClientTag(tag: CompoundTag) {
|
||||||
|
internalBuffer.fromTag(tag.getList("InternalBuffer", 10))
|
||||||
val list = tag.getList("CachedNetItems", 10)
|
val list = tag.getList("CachedNetItems", 10)
|
||||||
cachedNetItems.clear()
|
cachedNetItems.clear()
|
||||||
for (entryTag in list) {
|
for (entryTag in list) {
|
||||||
|
|
Loading…
Reference in New Issue