mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 03:15:35 -04:00
simple container action: commit action correctly
This commit is contained in:
parent
d046c69574
commit
ebb2e50387
@ -82,6 +82,7 @@ class SimpleContainerAction(
|
|||||||
target.item._count -= subtract
|
target.item._count -= subtract
|
||||||
floatingItem.item._count += subtract
|
floatingItem.item._count += subtract
|
||||||
}
|
}
|
||||||
|
target.commit(false)
|
||||||
|
|
||||||
if (floatingItem._valid) {
|
if (floatingItem._valid) {
|
||||||
container.floatingItem = floatingItem
|
container.floatingItem = floatingItem
|
||||||
|
@ -198,11 +198,13 @@ class ItemStack {
|
|||||||
lock.lock()
|
lock.lock()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun commit() {
|
fun commit(unlock: Boolean = true) {
|
||||||
if (!_valid) {
|
if (!_valid) {
|
||||||
holder?.container?._validate()
|
holder?.container?._validate()
|
||||||
}
|
}
|
||||||
|
if (unlock) {
|
||||||
lock.unlock()
|
lock.unlock()
|
||||||
|
}
|
||||||
revision++
|
revision++
|
||||||
holder?.container?.apply { revision++ } // increase revision after unlock to prevent deadlock
|
holder?.container?.apply { revision++ } // increase revision after unlock to prevent deadlock
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user