:sip:
This commit is contained in:
parent
5b1d52489e
commit
2b4a8ec2c4
@ -21,7 +21,6 @@ class ContainerHandler @JvmOverloads internal constructor(
|
|||||||
if (localStack.isEmpty) {
|
if (localStack.isEmpty) {
|
||||||
if (!simulate) {
|
if (!simulate) {
|
||||||
val copy = stack.copy()
|
val copy = stack.copy()
|
||||||
container.setChanged(slot, copy, ItemStack.EMPTY)
|
|
||||||
container.setItem(slot, copy)
|
container.setItem(slot, copy)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ open class MatteryContainer(protected val watcher: Runnable, private val size: I
|
|||||||
require(size >= 0) { "Invalid container size $size" }
|
require(size >= 0) { "Invalid container size $size" }
|
||||||
}
|
}
|
||||||
|
|
||||||
private var ignoreChangeNotifications = 0
|
|
||||||
protected val slots: Array<ItemStack> = Array(size) { ItemStack.EMPTY }
|
protected val slots: Array<ItemStack> = Array(size) { ItemStack.EMPTY }
|
||||||
private val trackedSlots: Array<ItemStack> = Array(size) { ItemStack.EMPTY }
|
private val trackedSlots: Array<ItemStack> = Array(size) { ItemStack.EMPTY }
|
||||||
private val filters: Array<Item?> = arrayOfNulls(size)
|
private val filters: Array<Item?> = arrayOfNulls(size)
|
||||||
@ -103,19 +102,6 @@ open class MatteryContainer(protected val watcher: Runnable, private val size: I
|
|||||||
}
|
}
|
||||||
|
|
||||||
final override fun getContainerSize() = size
|
final override fun getContainerSize() = size
|
||||||
|
|
||||||
fun startIgnoreUpdates() {
|
|
||||||
if (++ignoreChangeNotifications == 1) {
|
|
||||||
startedIgnoringUpdates()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun stopIgnoreUpdates() {
|
|
||||||
if (--ignoreChangeNotifications == 0) {
|
|
||||||
stoppedIgnoringUpdates()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected open fun startedIgnoringUpdates() {}
|
protected open fun startedIgnoringUpdates() {}
|
||||||
protected open fun stoppedIgnoringUpdates() {}
|
protected open fun stoppedIgnoringUpdates() {}
|
||||||
|
|
||||||
@ -187,7 +173,7 @@ open class MatteryContainer(protected val watcher: Runnable, private val size: I
|
|||||||
}
|
}
|
||||||
|
|
||||||
open fun setChanged(slot: Int, new: ItemStack, old: ItemStack) {
|
open fun setChanged(slot: Int, new: ItemStack, old: ItemStack) {
|
||||||
if (ignoreChangeNotifications == 0) watcher.run()
|
watcher.run()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun serializeNBT(): CompoundTag {
|
override fun serializeNBT(): CompoundTag {
|
||||||
|
Loading…
Reference in New Issue
Block a user