also move ticker interfaces
This commit is contained in:
parent
b0c845e0f9
commit
7b478d485a
@ -12,6 +12,8 @@ import net.minecraftforge.event.server.ServerAboutToStartEvent
|
||||
import net.minecraftforge.event.server.ServerStoppedEvent
|
||||
import net.minecraftforge.event.server.ServerStoppingEvent
|
||||
import org.apache.logging.log4j.LogManager
|
||||
import ru.dbotthepony.mc.otm.core.IConditionalTickable
|
||||
import ru.dbotthepony.mc.otm.core.ITickable
|
||||
import ru.dbotthepony.mc.otm.core.TickList
|
||||
import java.util.*
|
||||
|
||||
@ -168,19 +170,6 @@ var SERVER_IS_DYING = true
|
||||
|
||||
private val LOGGER = LogManager.getLogger()
|
||||
|
||||
fun interface ITickable {
|
||||
fun tick()
|
||||
}
|
||||
|
||||
interface IConditionalTickable : ITickable {
|
||||
/**
|
||||
* Once this returns false, it should stay false.
|
||||
*
|
||||
* If it suddenly turns true after being false, result is undefined.
|
||||
*/
|
||||
val canTick: Boolean
|
||||
}
|
||||
|
||||
fun onServerTick(event: ServerTickEvent) {
|
||||
if (event.phase === TickEvent.Phase.START) {
|
||||
preServerTickTimers.tick()
|
||||
|
@ -1,7 +1,5 @@
|
||||
package ru.dbotthepony.mc.otm.compat.mekanism
|
||||
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectAVLTreeMap
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectAVLTreeMap
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectFunction
|
||||
import mekanism.common.content.qio.QIOFrequency
|
||||
@ -17,14 +15,12 @@ import net.minecraftforge.common.capabilities.ICapabilityProvider
|
||||
import net.minecraftforge.common.util.LazyOptional
|
||||
import net.minecraftforge.event.AttachCapabilitiesEvent
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent
|
||||
import ru.dbotthepony.mc.otm.ITickable
|
||||
import ru.dbotthepony.mc.otm.core.ITickable
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.addPostServerTickerOnce
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryCapability
|
||||
import ru.dbotthepony.mc.otm.capability.isMekanismLoaded
|
||||
import ru.dbotthepony.mc.otm.core.ImpreciseFraction
|
||||
import ru.dbotthepony.mc.otm.core.isPositive
|
||||
import ru.dbotthepony.mc.otm.core.toImpreciseFraction
|
||||
import ru.dbotthepony.mc.otm.graph.storage.BasicStorageGraphNode
|
||||
import ru.dbotthepony.mc.otm.graph.storage.StorageNetworkGraph
|
||||
import ru.dbotthepony.mc.otm.storage.*
|
||||
|
@ -1,7 +1,5 @@
|
||||
package ru.dbotthepony.mc.otm.core
|
||||
|
||||
import ru.dbotthepony.mc.otm.IConditionalTickable
|
||||
import ru.dbotthepony.mc.otm.ITickable
|
||||
import java.util.*
|
||||
import kotlin.ConcurrentModificationException
|
||||
|
||||
@ -70,4 +68,17 @@ class TickList {
|
||||
conditional.clear()
|
||||
once.clear()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun interface ITickable {
|
||||
fun tick()
|
||||
}
|
||||
|
||||
interface IConditionalTickable : ITickable {
|
||||
/**
|
||||
* Once this returns false, it should stay false.
|
||||
*
|
||||
* If it suddenly turns true after being false, result is undefined.
|
||||
*/
|
||||
val canTick: Boolean
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import net.minecraft.core.Direction
|
||||
import net.minecraft.core.SectionPos
|
||||
import net.minecraft.server.level.ServerLevel
|
||||
import net.minecraft.world.level.block.entity.BlockEntity
|
||||
import ru.dbotthepony.mc.otm.IConditionalTickable
|
||||
import ru.dbotthepony.mc.otm.core.IConditionalTickable
|
||||
import ru.dbotthepony.mc.otm.addPreWorldTicker
|
||||
import ru.dbotthepony.mc.otm.core.plus
|
||||
import java.util.*
|
||||
|
@ -1,8 +1,8 @@
|
||||
package ru.dbotthepony.mc.otm.graph
|
||||
|
||||
import net.minecraft.core.Direction
|
||||
import ru.dbotthepony.mc.otm.IConditionalTickable
|
||||
import ru.dbotthepony.mc.otm.ITickable
|
||||
import ru.dbotthepony.mc.otm.core.IConditionalTickable
|
||||
import ru.dbotthepony.mc.otm.core.ITickable
|
||||
import ru.dbotthepony.mc.otm.SERVER_IS_DYING
|
||||
|
||||
interface GraphNodeListener {
|
||||
|
Loading…
Reference in New Issue
Block a user