Rename lazymap/list to correct suppliermap/list
This commit is contained in:
parent
b518fd3141
commit
c563a301dc
62
src/main/kotlin/ru/dbotthepony/mc/otm/core/ConditionalSet.kt
Normal file
62
src/main/kotlin/ru/dbotthepony/mc/otm/core/ConditionalSet.kt
Normal file
@ -0,0 +1,62 @@
|
||||
package ru.dbotthepony.mc.otm.core
|
||||
|
||||
class ConditionalSet<T> : AbstractSet<T> {
|
||||
// method without boxing
|
||||
fun interface Condition {
|
||||
fun check(): Boolean
|
||||
}
|
||||
|
||||
private val getters: Array<Pair<Condition, T>>
|
||||
|
||||
constructor(vararg getters: Pair<Condition, T>) : super() {
|
||||
this.getters = Array(getters.size) { getters[it] }
|
||||
}
|
||||
|
||||
constructor(getters: List<Pair<Condition, T>>) : super() {
|
||||
this.getters = Array(getters.size) { getters[it] }
|
||||
}
|
||||
|
||||
override val size: Int get() {
|
||||
var i = 0
|
||||
|
||||
for (pair in getters) {
|
||||
if (pair.first.check()) {
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
return i
|
||||
}
|
||||
|
||||
override fun iterator(): Iterator<T> {
|
||||
return object : Iterator<T> {
|
||||
val parent = getters.iterator()
|
||||
private var pair: Pair<Condition, T>? = null
|
||||
|
||||
private fun search() {
|
||||
for (pair in parent) {
|
||||
if (pair.first.check()) {
|
||||
this.pair = pair
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
this.pair = null
|
||||
}
|
||||
|
||||
init {
|
||||
search()
|
||||
}
|
||||
|
||||
override fun hasNext(): Boolean {
|
||||
return pair != null
|
||||
}
|
||||
|
||||
override fun next(): T {
|
||||
val pair = pair ?: throw NoSuchElementException()
|
||||
search()
|
||||
return pair.second
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package ru.dbotthepony.mc.otm.core
|
||||
|
||||
class ConditionalSupplierSet<T> : AbstractSet<T> {
|
||||
// method without boxing
|
||||
fun interface Condition {
|
||||
fun check(): Boolean
|
||||
}
|
||||
|
||||
private val getters: Array<Pair<Condition, () -> T>>
|
||||
|
||||
constructor(vararg getters: Pair<Condition, () -> T>) : super() {
|
||||
this.getters = Array(getters.size) { getters[it] }
|
||||
}
|
||||
|
||||
constructor(getters: List<Pair<Condition, () -> T>>) : super() {
|
||||
this.getters = Array(getters.size) { getters[it] }
|
||||
}
|
||||
|
||||
override val size: Int get() {
|
||||
var i = 0
|
||||
|
||||
for (pair in getters) {
|
||||
if (pair.first.check()) {
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
return i
|
||||
}
|
||||
|
||||
override fun iterator(): Iterator<T> {
|
||||
return object : Iterator<T> {
|
||||
val parent = getters.iterator()
|
||||
private var pair: Pair<Condition, () -> T>? = null
|
||||
|
||||
private fun search() {
|
||||
for (pair in parent) {
|
||||
if (pair.first.check()) {
|
||||
this.pair = pair
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
this.pair = null
|
||||
}
|
||||
|
||||
init {
|
||||
search()
|
||||
}
|
||||
|
||||
override fun hasNext(): Boolean {
|
||||
return pair != null
|
||||
}
|
||||
|
||||
override fun next(): T {
|
||||
val pair = pair ?: throw NoSuchElementException()
|
||||
search()
|
||||
return pair.second.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
24
src/main/kotlin/ru/dbotthepony/mc/otm/core/SupplierList.kt
Normal file
24
src/main/kotlin/ru/dbotthepony/mc/otm/core/SupplierList.kt
Normal file
@ -0,0 +1,24 @@
|
||||
package ru.dbotthepony.mc.otm.core
|
||||
|
||||
class SupplierList<T> : AbstractList<T> {
|
||||
private val getters: Array<() -> T>
|
||||
|
||||
constructor(vararg getters: () -> T) : super() {
|
||||
this.getters = Array(getters.size) { getters[it] }
|
||||
}
|
||||
|
||||
constructor(getters: List<() -> T>) : super() {
|
||||
this.getters = Array(getters.size) { getters[it] }
|
||||
}
|
||||
|
||||
constructor(size: Int, provider: (Int) -> () -> T) {
|
||||
this.getters = Array(size, provider)
|
||||
}
|
||||
|
||||
override val size: Int
|
||||
get() = getters.size
|
||||
|
||||
override fun get(index: Int): T {
|
||||
return getters[index].invoke()
|
||||
}
|
||||
}
|
27
src/main/kotlin/ru/dbotthepony/mc/otm/core/SupplierMap.kt
Normal file
27
src/main/kotlin/ru/dbotthepony/mc/otm/core/SupplierMap.kt
Normal file
@ -0,0 +1,27 @@
|
||||
package ru.dbotthepony.mc.otm.core
|
||||
|
||||
import com.google.common.collect.ImmutableSet
|
||||
|
||||
class SupplierMap<K, T> : AbstractMap<K, T> {
|
||||
override val entries: Set<Map.Entry<K, T>>
|
||||
|
||||
constructor(vararg mValues: Pair<K, () -> T>) : super() {
|
||||
entries = ImmutableSet.copyOf(mValues.map { Entry(it.first, it.second) })
|
||||
}
|
||||
|
||||
constructor(mValues: Collection<Pair<K, () -> T>>) : super() {
|
||||
entries = ImmutableSet.copyOf(mValues.map { Entry(it.first, it.second) })
|
||||
}
|
||||
|
||||
constructor(mValues: Map<K, () -> T>) : super() {
|
||||
entries = ImmutableSet.copyOf(mValues.map { Entry(it.key, it.value) })
|
||||
}
|
||||
|
||||
private inner class Entry(
|
||||
override val key: K,
|
||||
private val getter: () -> T
|
||||
) : Map.Entry<K, T> {
|
||||
override val value: T
|
||||
get() = getter.invoke()
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@ package ru.dbotthepony.mc.otm.registry
|
||||
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraftforge.registries.DeferredRegister
|
||||
import ru.dbotthepony.mc.otm.item.MinecartCargoCrateItem
|
||||
import ru.dbotthepony.mc.otm.core.SupplierMap
|
||||
|
||||
private fun <T> DeferredRegister<T>.doColored(prefix: String, factory: (color: DyeColor, name: String) -> T): MutableCollection<Pair<DyeColor, () -> T>> {
|
||||
return mutableListOf(
|
||||
@ -26,10 +26,10 @@ private fun <T> DeferredRegister<T>.doColored(prefix: String, factory: (color: D
|
||||
}
|
||||
|
||||
fun <T> DeferredRegister<T>.colored(prefix: String, factory: (color: DyeColor, name: String) -> T): Map<DyeColor, T> {
|
||||
return LazyMap(doColored(prefix, factory))
|
||||
return SupplierMap(doColored(prefix, factory))
|
||||
}
|
||||
|
||||
@Suppress("unchecked_cast")
|
||||
fun <T> DeferredRegister<T>.allColored(prefix: String, factory: (color: DyeColor?, name: String) -> T): Map<DyeColor?, T> {
|
||||
return LazyMap(doColored(prefix, factory).also { (it as MutableCollection<Pair<DyeColor?, () -> T>>).add((null as DyeColor?) to register(prefix) { factory.invoke(null, prefix) }::get) })
|
||||
return SupplierMap(doColored(prefix, factory).also { (it as MutableCollection<Pair<DyeColor?, () -> T>>).add((null as DyeColor?) to register(prefix) { factory.invoke(null, prefix) }::get) })
|
||||
}
|
||||
|
@ -1,186 +0,0 @@
|
||||
package ru.dbotthepony.mc.otm.registry
|
||||
|
||||
import com.google.common.collect.ImmutableList
|
||||
import com.google.common.collect.ImmutableSet
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraftforge.registries.RegistryObject
|
||||
|
||||
class LazyList<T> : AbstractList<T> {
|
||||
private val getters: Array<() -> T>
|
||||
|
||||
constructor(vararg getters: () -> T) : super() {
|
||||
this.getters = Array(getters.size) { getters[it] }
|
||||
}
|
||||
|
||||
constructor(getters: List<() -> T>) : super() {
|
||||
this.getters = Array(getters.size) { getters[it] }
|
||||
}
|
||||
|
||||
constructor(size: Int, provider: (Int) -> () -> T) {
|
||||
this.getters = Array(size, provider)
|
||||
}
|
||||
|
||||
override val size: Int
|
||||
get() = getters.size
|
||||
|
||||
override fun get(index: Int): T {
|
||||
return getters[index].invoke()
|
||||
}
|
||||
}
|
||||
|
||||
class ConditionalSet<T> : AbstractSet<T> {
|
||||
// method without boxing
|
||||
fun interface Condition {
|
||||
fun check(): Boolean
|
||||
}
|
||||
|
||||
private val getters: Array<Pair<Condition, T>>
|
||||
|
||||
constructor(vararg getters: Pair<Condition, T>) : super() {
|
||||
this.getters = Array(getters.size) { getters[it] }
|
||||
}
|
||||
|
||||
constructor(getters: List<Pair<Condition, T>>) : super() {
|
||||
this.getters = Array(getters.size) { getters[it] }
|
||||
}
|
||||
|
||||
override val size: Int get() {
|
||||
var i = 0
|
||||
|
||||
for (pair in getters) {
|
||||
if (pair.first.check()) {
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
return i
|
||||
}
|
||||
|
||||
override fun iterator(): Iterator<T> {
|
||||
return object : Iterator<T> {
|
||||
val parent = getters.iterator()
|
||||
private var pair: Pair<Condition, T>? = null
|
||||
|
||||
private fun search() {
|
||||
for (pair in parent) {
|
||||
if (pair.first.check()) {
|
||||
this.pair = pair
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
this.pair = null
|
||||
}
|
||||
|
||||
init {
|
||||
search()
|
||||
}
|
||||
|
||||
override fun hasNext(): Boolean {
|
||||
return pair != null
|
||||
}
|
||||
|
||||
override fun next(): T {
|
||||
val pair = pair ?: throw NoSuchElementException()
|
||||
search()
|
||||
return pair.second
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ConditionalLazySet<T> : AbstractSet<T> {
|
||||
// method without boxing
|
||||
fun interface Condition {
|
||||
fun check(): Boolean
|
||||
}
|
||||
|
||||
private val getters: Array<Pair<Condition, () -> T>>
|
||||
|
||||
constructor(vararg getters: Pair<Condition, () -> T>) : super() {
|
||||
this.getters = Array(getters.size) { getters[it] }
|
||||
}
|
||||
|
||||
constructor(getters: List<Pair<Condition, () -> T>>) : super() {
|
||||
this.getters = Array(getters.size) { getters[it] }
|
||||
}
|
||||
|
||||
override val size: Int get() {
|
||||
var i = 0
|
||||
|
||||
for (pair in getters) {
|
||||
if (pair.first.check()) {
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
return i
|
||||
}
|
||||
|
||||
override fun iterator(): Iterator<T> {
|
||||
return object : Iterator<T> {
|
||||
val parent = getters.iterator()
|
||||
private var pair: Pair<Condition, () -> T>? = null
|
||||
|
||||
private fun search() {
|
||||
for (pair in parent) {
|
||||
if (pair.first.check()) {
|
||||
this.pair = pair
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
this.pair = null
|
||||
}
|
||||
|
||||
init {
|
||||
search()
|
||||
}
|
||||
|
||||
override fun hasNext(): Boolean {
|
||||
return pair != null
|
||||
}
|
||||
|
||||
override fun next(): T {
|
||||
val pair = pair ?: throw NoSuchElementException()
|
||||
search()
|
||||
return pair.second.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class LazyMap<K, T> : AbstractMap<K, T> {
|
||||
override val entries: Set<Map.Entry<K, T>>
|
||||
|
||||
constructor(vararg mValues: Pair<K, () -> T>) : super() {
|
||||
entries = ImmutableSet.copyOf(mValues.map { Entry(it.first, it.second) })
|
||||
}
|
||||
|
||||
constructor(mValues: Collection<Pair<K, () -> T>>) : super() {
|
||||
entries = ImmutableSet.copyOf(mValues.map { Entry(it.first, it.second) })
|
||||
}
|
||||
|
||||
constructor(mValues: Map<K, () -> T>) : super() {
|
||||
entries = ImmutableSet.copyOf(mValues.map { Entry(it.key, it.value) })
|
||||
}
|
||||
|
||||
private inner class Entry(
|
||||
override val key: K,
|
||||
private val getter: () -> T
|
||||
) : Map.Entry<K, T> {
|
||||
override val value: T
|
||||
get() = getter.invoke()
|
||||
}
|
||||
}
|
||||
|
||||
class RegistryObjectList<T>(private vararg val getters: RegistryObject<T>) : AbstractList<T>() {
|
||||
constructor(getters: Collection<RegistryObject<T>>) : this(*getters.toTypedArray())
|
||||
|
||||
override val size: Int
|
||||
get() = getters.size
|
||||
|
||||
override fun get(index: Int): T {
|
||||
return getters[index].get()
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
|
||||
package ru.dbotthepony.mc.otm.registry
|
||||
|
||||
import com.google.common.collect.Streams
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.tags.BlockTags
|
||||
@ -16,14 +15,10 @@ import net.minecraftforge.registries.DeferredRegister
|
||||
import net.minecraftforge.registries.ForgeRegistries
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.ServerConfig
|
||||
import ru.dbotthepony.mc.otm.core.SupplierList
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.ImpreciseFraction
|
||||
import ru.dbotthepony.mc.otm.core.toUUID
|
||||
import ru.dbotthepony.mc.otm.item.*
|
||||
import ru.dbotthepony.mc.otm.item.weapon.PlasmaRifleItem
|
||||
import java.util.*
|
||||
import java.util.stream.Stream
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
object MItems {
|
||||
private val DEFAULT_PROPERTIES = Item.Properties().stacksTo(64).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)
|
||||
@ -111,7 +106,7 @@ object MItems {
|
||||
}
|
||||
}
|
||||
|
||||
val MACHINES = LazyList(
|
||||
val MACHINES = SupplierList(
|
||||
::ANDROID_STATION, ::BATTERY_BANK, ::MATTER_DECOMPOSER, ::MATTER_CAPACITOR_BANK, ::MATTER_CABLE, ::PATTERN_STORAGE,
|
||||
::MATTER_SCANNER, ::MATTER_PANEL, ::MATTER_REPLICATOR, ::MATTER_BOTTLER, ::ENERGY_COUNTER, ::CHEMICAL_GENERATOR,
|
||||
::PLATE_PRESS, ::MATTER_RECYCLER, ::STORAGE_BUS, ::STORAGE_IMPORTER, ::STORAGE_EXPORTER, ::DRIVE_VIEWER,
|
||||
@ -146,7 +141,7 @@ object MItems {
|
||||
val TRITANIUM_PICKAXE: Item by registry.register(MNames.TRITANIUM_PICKAXE) { PickaxeItem(TRITANIUM_COMPONENT, 2, -2.8f, TOOLS_PROPRTIES) }
|
||||
val TRITANIUM_HOE: Item by registry.register(MNames.TRITANIUM_HOE) { HoeItem(TRITANIUM_COMPONENT, 0, -3.4f, TOOLS_PROPRTIES) }
|
||||
|
||||
val TRITANIUM_TOOLS = LazyList(
|
||||
val TRITANIUM_TOOLS = SupplierList(
|
||||
{ TRITANIUM_SWORD },
|
||||
{ TRITANIUM_SHOVEL },
|
||||
{ TRITANIUM_AXE },
|
||||
@ -159,7 +154,7 @@ object MItems {
|
||||
val TRITANIUM_PANTS: Item by registry.register(MNames.TRITANIUM_PANTS) { ItemTritaniumArmor(EquipmentSlot.LEGS) }
|
||||
val TRITANIUM_BOOTS: Item by registry.register(MNames.TRITANIUM_BOOTS) { ItemTritaniumArmor(EquipmentSlot.FEET) }
|
||||
|
||||
val TRITANIUM_ARMOR = LazyList(
|
||||
val TRITANIUM_ARMOR = SupplierList(
|
||||
{ TRITANIUM_HELMET },
|
||||
{ TRITANIUM_CHESTPLATE },
|
||||
{ TRITANIUM_PANTS },
|
||||
@ -209,7 +204,7 @@ object MItems {
|
||||
val QUANTUM_BATTERY_CREATIVE: Item by registry.register(MNames.QUANTUM_BATTERY_CREATIVE) { QuantumBatteryItem(MNames.QUANTUM_BATTERY_CREATIVE) }
|
||||
val ZPM_BATTERY: Item by registry.register(MNames.ZPM_BATTERY) { ZPMItem() }
|
||||
|
||||
val BATTERIES = LazyList(
|
||||
val BATTERIES = SupplierList(
|
||||
{ BATTERY_CRUDE },
|
||||
{ BATTERY_BASIC },
|
||||
{ BATTERY_NORMAL },
|
||||
@ -277,7 +272,7 @@ object MItems {
|
||||
}
|
||||
} }
|
||||
|
||||
val DATAGEN_COMPONENTS = LazyList(
|
||||
val DATAGEN_COMPONENTS = SupplierList(
|
||||
{ ENERGY_BUS },
|
||||
{ ELECTRIC_PARTS },
|
||||
{ TRITANIUM_PLATE },
|
||||
@ -305,7 +300,7 @@ object MItems {
|
||||
val INVENTORY_UPGRADE_CREATIVE: Item by registry.register("exosuit_inventory_upgrade_creative") { ExoSuitSlotUpgradeItem(null, 27, Rarity.EPIC) }
|
||||
val CRAFTING_UPGRADE: Item by registry.register("exosuit_crafting_upgrade", ::ExoSuitCraftingUpgradeItem)
|
||||
|
||||
val INVENTORY_UPGRADES = LazyList(8) {
|
||||
val INVENTORY_UPGRADES = SupplierList(8) {
|
||||
registry.register("exosuit_inventory_upgrade_$it") { ExoSuitSlotUpgradeItem(18, Rarity.COMMON) }::get
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,7 @@ import net.minecraft.world.level.block.state.BlockBehaviour
|
||||
import net.minecraftforge.registries.DeferredRegister
|
||||
import net.minecraftforge.registries.RegistryObject
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.registry.LazyMap
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistry
|
||||
import ru.dbotthepony.mc.otm.core.SupplierMap
|
||||
import java.util.EnumMap
|
||||
|
||||
/**
|
||||
@ -81,12 +80,12 @@ open class ColoredDecorativeBlock(
|
||||
|
||||
val blocks: Map<DyeColor, Block> by lazy {
|
||||
check(registeredBlocks) { "Didn't register blocks yet" }
|
||||
LazyMap(blockMap.map { it.key to it.value::get })
|
||||
SupplierMap(blockMap.map { it.key to it.value::get })
|
||||
}
|
||||
|
||||
val items: Map<DyeColor, Item> by lazy {
|
||||
check(registeredItems) { "Didn't register items yet" }
|
||||
LazyMap(itemMap.map { it.key to it.value::get })
|
||||
SupplierMap(itemMap.map { it.key to it.value::get })
|
||||
}
|
||||
|
||||
open fun registerBlocks(registry: DeferredRegister<Block>) {
|
||||
@ -145,4 +144,4 @@ open class ColoredDecorativeBlock(
|
||||
}, itemGroup)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import net.minecraft.world.level.block.state.BlockBehaviour
|
||||
import net.minecraftforge.registries.DeferredRegister
|
||||
import net.minecraftforge.registries.RegistryObject
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.registry.LazyMap
|
||||
import ru.dbotthepony.mc.otm.core.SupplierMap
|
||||
import ru.dbotthepony.mc.otm.registry.WriteOnce
|
||||
|
||||
/**
|
||||
@ -29,12 +29,12 @@ class DecorativeBlock(
|
||||
|
||||
val allBlocks: Map<DyeColor?, Block> by lazy {
|
||||
check(registeredBlocks) { "Didn't register items yet" }
|
||||
LazyMap(blockMap.map { it.key to it.value::get }.toMutableList().also { it.add(null to _block::get) })
|
||||
SupplierMap(blockMap.map { it.key to it.value::get }.toMutableList().also { it.add(null to _block::get) })
|
||||
}
|
||||
|
||||
val allItems: Map<DyeColor?, Item> by lazy {
|
||||
check(registeredItems) { "Didn't register items yet" }
|
||||
LazyMap(itemMap.map { it.key to it.value::get }.toMutableList().also { it.add(null to _item::get) })
|
||||
SupplierMap(itemMap.map { it.key to it.value::get }.toMutableList().also { it.add(null to _item::get) })
|
||||
}
|
||||
|
||||
override fun registerBlocks(registry: DeferredRegister<Block>) {
|
||||
@ -54,4 +54,4 @@ class DecorativeBlock(
|
||||
}, itemGroup)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ import net.minecraft.world.level.block.Block
|
||||
import net.minecraftforge.registries.DeferredRegister
|
||||
import net.minecraftforge.registries.RegistryObject
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.registry.LazyList
|
||||
import ru.dbotthepony.mc.otm.registry.LazyMap
|
||||
import ru.dbotthepony.mc.otm.core.SupplierList
|
||||
import ru.dbotthepony.mc.otm.core.SupplierMap
|
||||
import java.util.EnumMap
|
||||
|
||||
@Suppress("PropertyName", "unused", "ReplaceGetOrSet", "ReplacePutWithAssignment")
|
||||
@ -55,7 +55,7 @@ class StripedColoredDecorativeBlock(
|
||||
val builder = ImmutableMap.Builder<DyeColor, Map<DyeColor, Item>>()
|
||||
|
||||
for ((base, children) in mapItems) {
|
||||
builder.put(base, LazyMap(children.map { it.key to it.value::get }))
|
||||
builder.put(base, SupplierMap(children.map { it.key to it.value::get }))
|
||||
}
|
||||
|
||||
builder.build()
|
||||
@ -66,7 +66,7 @@ class StripedColoredDecorativeBlock(
|
||||
val builder = ImmutableMap.Builder<DyeColor, Map<DyeColor, Block>>()
|
||||
|
||||
for ((base, children) in mapBlocks) {
|
||||
builder.put(base, LazyMap(children.map { it.key to it.value::get }))
|
||||
builder.put(base, SupplierMap(children.map { it.key to it.value::get }))
|
||||
}
|
||||
|
||||
builder.build()
|
||||
@ -74,12 +74,12 @@ class StripedColoredDecorativeBlock(
|
||||
|
||||
val flatItems: List<Item> by lazy {
|
||||
check(registeredItems) { "Didn't register items yet" }
|
||||
LazyList(mapItems.flatMap { it.value.values }.map { it::get })
|
||||
SupplierList(mapItems.flatMap { it.value.values }.map { it::get })
|
||||
}
|
||||
|
||||
val flatBlocks: List<Block> by lazy {
|
||||
check(registeredBlocks) { "Didn't register items yet" }
|
||||
LazyList(mapBlocks.flatMap { it.value.values }.map { it::get })
|
||||
SupplierList(mapBlocks.flatMap { it.value.values }.map { it::get })
|
||||
}
|
||||
|
||||
fun registerItems(registry: DeferredRegister<Item>) {
|
||||
@ -125,7 +125,7 @@ class StripedColoredDecorativeBlock(
|
||||
}
|
||||
}
|
||||
|
||||
LazyList(build.build())
|
||||
SupplierList(build.build())
|
||||
}
|
||||
|
||||
val itemsWithColor: List<Pair<Item, Pair<DyeColor, DyeColor>>> by lazy {
|
||||
@ -141,6 +141,6 @@ class StripedColoredDecorativeBlock(
|
||||
}
|
||||
}
|
||||
|
||||
LazyList(build.build())
|
||||
SupplierList(build.build())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user