Merge branch '1.19.3' of https://git.dbotthepony.ru/DBot/overdrive_that_matters into 1.19.2
This commit is contained in:
commit
59d69367dc
@ -22,8 +22,8 @@ import kotlin.reflect.KProperty
|
||||
/**
|
||||
* DeferredRegister which allows parallel initialization
|
||||
*/
|
||||
class MDeferredRegister<R : Any>(val registry: ResourceKey<out Registry<R>>, val modId: String = OverdriveThatMatters.MOD_ID) {
|
||||
constructor(registry: IForgeRegistry<R>, modId: String = OverdriveThatMatters.MOD_ID) : this(registry.registryKey, modId)
|
||||
class MDeferredRegister<R : Any>(val registry: ResourceKey<out Registry<R>>, val modId: String = OverdriveThatMatters.MOD_ID, val allowParallel: Boolean = false) {
|
||||
constructor(registry: IForgeRegistry<R>, modId: String = OverdriveThatMatters.MOD_ID, allowParallel: Boolean = false) : this(registry.registryKey, modId, allowParallel)
|
||||
|
||||
private val entries = Object2ObjectLinkedOpenHashMap<String, Entry<R>>()
|
||||
private var allowRegistration = true
|
||||
@ -74,8 +74,10 @@ class MDeferredRegister<R : Any>(val registry: ResourceKey<out Registry<R>>, val
|
||||
check(allowRegistration) { "Unable to register new entries after RegisterEvent has been fired" }
|
||||
require(entries.put(name, this) == null) { "Duplicate entry $name for registry $registry" }
|
||||
|
||||
if (stages.isEmpty() || stages.last().serial != serial) {
|
||||
val stage = RegistrationStage(serial)
|
||||
val actualSerial = if (allowParallel) serial else true
|
||||
|
||||
if (stages.isEmpty() || stages.last().serial != actualSerial) {
|
||||
val stage = RegistrationStage(actualSerial)
|
||||
stage.add(this)
|
||||
stages.add(stage)
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user