Use immutableMap provided by kommons

This commit is contained in:
DBotThePony 2025-03-30 18:42:42 +07:00
parent 118f5e1b5c
commit 3cbcd9e280
Signed by: DBot
GPG Key ID: DCC23B5715498507
8 changed files with 7 additions and 19 deletions

View File

@ -32,7 +32,7 @@ import ru.dbotthepony.mc.otm.capability.moveEnergy
import ru.dbotthepony.mc.otm.capability.moveFluid
import ru.dbotthepony.mc.otm.util.TextComponent
import ru.dbotthepony.mc.otm.util.getValue
import ru.dbotthepony.mc.otm.util.immutableMap
import ru.dbotthepony.kommons.guava.immutableMap
import ru.dbotthepony.mc.otm.util.math.Decimal
import ru.dbotthepony.mc.otm.util.math.RelativeSide
import ru.dbotthepony.mc.otm.util.ITickable

View File

@ -21,7 +21,7 @@ import ru.dbotthepony.mc.otm.block.entity.MatteryDeviceBlockEntity
import ru.dbotthepony.mc.otm.container.slotted.ContainerSlot
import ru.dbotthepony.mc.otm.container.slotted.SlottedContainer
import ru.dbotthepony.kommons.guava.immutableList
import ru.dbotthepony.mc.otm.util.immutableMap
import ru.dbotthepony.kommons.guava.immutableMap
import ru.dbotthepony.mc.otm.util.isNotEmpty
import ru.dbotthepony.mc.otm.util.mapPresent
import ru.dbotthepony.mc.otm.util.set

View File

@ -2,7 +2,7 @@ package ru.dbotthepony.mc.otm.client.render
import ru.dbotthepony.mc.otm.block.entity.MatteryDeviceBlockEntity
import ru.dbotthepony.mc.otm.capability.FlowDirection
import ru.dbotthepony.mc.otm.util.immutableMap
import ru.dbotthepony.kommons.guava.immutableMap
import ru.dbotthepony.mc.otm.util.math.RelativeSide
object Widgets18 {

View File

@ -36,7 +36,7 @@ import ru.dbotthepony.mc.otm.container.get
import ru.dbotthepony.mc.otm.util.TranslatableComponent
import ru.dbotthepony.mc.otm.util.collect.any
import ru.dbotthepony.kommons.guava.immutableList
import ru.dbotthepony.mc.otm.util.immutableMap
import ru.dbotthepony.kommons.guava.immutableMap
import ru.dbotthepony.mc.otm.util.isNotEmpty
import ru.dbotthepony.mc.otm.registry.CapabilitiesRegisterListener
import java.util.function.IntSupplier

View File

@ -4,7 +4,7 @@ import ru.dbotthepony.kommons.util.getValue
import ru.dbotthepony.kommons.util.setValue
import ru.dbotthepony.mc.otm.block.entity.MatteryDeviceBlockEntity
import ru.dbotthepony.mc.otm.capability.FlowDirection
import ru.dbotthepony.mc.otm.util.immutableMap
import ru.dbotthepony.kommons.guava.immutableMap
import ru.dbotthepony.mc.otm.util.math.RelativeSide
import ru.dbotthepony.mc.otm.menu.MatteryMenu

View File

@ -4,7 +4,7 @@ import ru.dbotthepony.kommons.util.getValue
import ru.dbotthepony.kommons.util.setValue
import ru.dbotthepony.mc.otm.block.entity.MatteryDeviceBlockEntity
import ru.dbotthepony.mc.otm.capability.FlowDirection
import ru.dbotthepony.mc.otm.util.immutableMap
import ru.dbotthepony.kommons.guava.immutableMap
import ru.dbotthepony.mc.otm.util.math.RelativeSide
import ru.dbotthepony.mc.otm.menu.MatteryMenu

View File

@ -3,7 +3,7 @@ package ru.dbotthepony.mc.otm.menu.input
import ru.dbotthepony.kommons.util.getValue
import ru.dbotthepony.kommons.util.setValue
import ru.dbotthepony.mc.otm.block.entity.MatteryDeviceBlockEntity
import ru.dbotthepony.mc.otm.util.immutableMap
import ru.dbotthepony.kommons.guava.immutableMap
import ru.dbotthepony.mc.otm.util.math.RelativeSide
import ru.dbotthepony.mc.otm.menu.MatteryMenu

View File

@ -155,18 +155,6 @@ inline var Entity.position: Vec3
get() = position()
set(value) { setPos(value) }
inline fun <K : Any, V : Any> immutableMap(initializer: ImmutableMap.Builder<K, V>.() -> Unit): ImmutableMap<K, V> {
val builder = ImmutableMap.Builder<K, V>()
initializer.invoke(builder)
return builder.build()
}
inline fun <K : Any, V : Any> immutableMultimap(initializer: ImmutableMultimap.Builder<K, V>.() -> Unit): ImmutableMultimap<K, V> {
val builder = ImmutableMultimap.Builder<K, V>()
initializer.invoke(builder)
return builder.build()
}
inline fun itemAttributes(builder: ItemAttributeModifiers.Builder.() -> Unit): ItemAttributeModifiers {
val value = ItemAttributeModifiers.builder()
builder(value)