Compare commits
2 Commits
83baf5a8a0
...
b65c80d55e
Author | SHA1 | Date | |
---|---|---|---|
b65c80d55e | |||
bc75b61852 |
@ -331,6 +331,7 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc
|
||||
|
||||
init {
|
||||
capabilityCaches.add(this)
|
||||
waitForServerLevel { rebuildCache() }
|
||||
}
|
||||
|
||||
override fun get(): T? {
|
||||
@ -361,6 +362,10 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc
|
||||
// IllegalStateException("Do not call getCapability on an invalid cache or from the invalidation listener!")
|
||||
// what a shame.
|
||||
{ onceServer { if (!isRemoved && creationVersion == currentVersion) listeners.accept(cache?.capability) } })
|
||||
|
||||
onceServer {
|
||||
if (!isRemoved && creationVersion == currentVersion) listeners.accept(cache?.capability)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -376,7 +381,6 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc
|
||||
if (!level.isClientSide) {
|
||||
subscribe()
|
||||
waitForServerLevel.forEach { it.invoke() }
|
||||
capabilityCaches.forEach { it.rebuildCache() }
|
||||
waitForServerLevel.clear()
|
||||
} else {
|
||||
waitForServerLevel.clear()
|
||||
|
@ -1,16 +1,13 @@
|
||||
package ru.dbotthepony.mc.otm.core.util
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap
|
||||
import it.unimi.dsi.fastutil.objects.ObjectAVLTreeSet
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArraySet
|
||||
import org.apache.logging.log4j.LogManager
|
||||
import ru.dbotthepony.mc.otm.core.addSorted
|
||||
import java.util.LinkedList
|
||||
import java.util.PriorityQueue
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
import java.util.*
|
||||
|
||||
class TickList : ITickable {
|
||||
private val tickers = LinkedList<IConditionalTickable>()
|
||||
private val queuedTickers = ArrayList<IConditionalTickable>()
|
||||
private val queuedTickers = ObjectArraySet<IConditionalTickable>()
|
||||
|
||||
private val timers = PriorityQueue<Timer>()
|
||||
private val namedTimers = HashMap<Any?, Timer>()
|
||||
@ -71,6 +68,10 @@ class TickList : ITickable {
|
||||
add(this)
|
||||
} else {
|
||||
queuedTickers.remove(this)
|
||||
|
||||
if (!inTicker) {
|
||||
tickers.remove(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user