diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/EnergyCounterBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/EnergyCounterBlockEntity.kt index 063de299e..aa40dbd3e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/EnergyCounterBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/EnergyCounterBlockEntity.kt @@ -23,7 +23,7 @@ import net.minecraftforge.network.PacketDistributor import ru.dbotthepony.mc.otm.* import ru.dbotthepony.mc.otm.block.EnergyCounterBlock import ru.dbotthepony.mc.otm.capability.* -import ru.dbotthepony.mc.otm.compat.mekanism.MatteryToMekanismEnergyWrapper +import ru.dbotthepony.mc.otm.compat.mekanism.Mattery2MekanismEnergyWrapper import ru.dbotthepony.mc.otm.core.* import ru.dbotthepony.mc.otm.menu.EnergyCounterMenu import ru.dbotthepony.mc.otm.network.MatteryPacket @@ -327,8 +327,8 @@ class EnergyCounterBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mat private var resolverInput = LazyOptional.of { energyInput } private var resolverOutput = LazyOptional.of { energyOutput } - private var resolverInputMekanism = if (isMekanismLoaded) LazyOptional.of { MatteryToMekanismEnergyWrapper(energyInput) } else null - private var resolverOutputMekanism = if (isMekanismLoaded) LazyOptional.of { MatteryToMekanismEnergyWrapper(energyInput) } else null + private var resolverInputMekanism = if (isMekanismLoaded) LazyOptional.of { Mattery2MekanismEnergyWrapper(energyInput) } else null + private var resolverOutputMekanism = if (isMekanismLoaded) LazyOptional.of { Mattery2MekanismEnergyWrapper(energyInput) } else null private var valid = true @@ -348,8 +348,8 @@ class EnergyCounterBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mat resolverOutput = LazyOptional.of { energyOutput } if (isMekanismLoaded) { - resolverInputMekanism = LazyOptional.of { MatteryToMekanismEnergyWrapper(energyInput) } - resolverOutputMekanism = LazyOptional.of { MatteryToMekanismEnergyWrapper(energyInput) } + resolverInputMekanism = LazyOptional.of { Mattery2MekanismEnergyWrapper(energyInput) } + resolverOutputMekanism = LazyOptional.of { Mattery2MekanismEnergyWrapper(energyInput) } } } @@ -368,8 +368,8 @@ class EnergyCounterBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mat resolverOutput = LazyOptional.of { energyOutput } if (isMekanismLoaded) { - resolverInputMekanism = LazyOptional.of { MatteryToMekanismEnergyWrapper(energyInput) } - resolverOutputMekanism = LazyOptional.of { MatteryToMekanismEnergyWrapper(energyInput) } + resolverInputMekanism = LazyOptional.of { Mattery2MekanismEnergyWrapper(energyInput) } + resolverOutputMekanism = LazyOptional.of { Mattery2MekanismEnergyWrapper(energyInput) } } checkSurroundings() diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/EnergyStorageImpl.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/EnergyStorageImpl.kt index d863cc37c..3f7123efe 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/EnergyStorageImpl.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/EnergyStorageImpl.kt @@ -12,7 +12,7 @@ import net.minecraftforge.common.capabilities.ForgeCapabilities import net.minecraftforge.common.capabilities.ICapabilityProvider import net.minecraftforge.common.util.INBTSerializable import net.minecraftforge.common.util.LazyOptional -import ru.dbotthepony.mc.otm.compat.mekanism.MatteryToMekanismEnergyWrapper +import ru.dbotthepony.mc.otm.compat.mekanism.Mattery2MekanismEnergyWrapper import ru.dbotthepony.mc.otm.core.ImpreciseFraction import ru.dbotthepony.mc.otm.core.ifHas import ru.dbotthepony.mc.otm.core.map @@ -38,7 +38,7 @@ sealed class ItemEnergyStorageImpl( protected set private val resolver = LazyOptional.of { this } - private val resolverMekanism = if (isMekanismLoaded) LazyOptional.of { MatteryToMekanismEnergyWrapper(this) } else null + private val resolverMekanism = if (isMekanismLoaded) LazyOptional.of { Mattery2MekanismEnergyWrapper(this) } else null override fun getCapability(cap: Capability, side: Direction?): LazyOptional { if (cap == ForgeCapabilities.ENERGY || cap == MatteryCapability.ENERGY) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/mekanism/Power.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/mekanism/Power.kt index 8791d5cb2..e81dc86c8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/mekanism/Power.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/mekanism/Power.kt @@ -7,7 +7,6 @@ import mekanism.common.config.MekanismConfig import net.minecraft.core.Direction import net.minecraftforge.common.capabilities.ICapabilityProvider import net.minecraftforge.common.util.LazyOptional -import net.minecraftforge.fml.ModList import ru.dbotthepony.mc.otm.capability.IMatteryEnergyStorage import ru.dbotthepony.mc.otm.capability.MatteryCapability import ru.dbotthepony.mc.otm.capability.isMekanismLoaded @@ -37,7 +36,7 @@ private val mekanismJoulesFromFE by lazy { return@lazy ImpreciseFraction.ONE } -class MekanismEnergyWrapper(private val power: IStrictEnergyHandler) : IMatteryEnergyStorage { +class Mekanism2MatteryEnergyWrapper(private val power: IStrictEnergyHandler) : IMatteryEnergyStorage { override fun extractEnergyOuter(howMuch: ImpreciseFraction, simulate: Boolean): ImpreciseFraction { val action = when (simulate) { true -> Action.SIMULATE @@ -87,7 +86,7 @@ class MekanismEnergyWrapper(private val power: IStrictEnergyHandler) : IMatteryE } } -class MatteryToMekanismEnergyWrapper(private val power: IMatteryEnergyStorage) : IStrictEnergyHandler { +class Mattery2MekanismEnergyWrapper(private val power: IMatteryEnergyStorage) : IStrictEnergyHandler { override fun getEnergyContainerCount(): Int = 1 override fun getEnergy(container: Int): FloatingLong { @@ -139,16 +138,16 @@ val ICapabilityProvider.mekanismEnergy: IMatteryEnergyStorage? get() { return null } - return MekanismEnergyWrapper(capability.orElseThrow(::IllegalStateException)) + return Mekanism2MatteryEnergyWrapper(capability.orElseThrow(::IllegalStateException)) } -private val lazyCache by lazy { WeakHashMap, WeakReference>>() } -private val lazyCacheDown by lazy { WeakHashMap, WeakReference>>() } -private val lazyCacheUp by lazy { WeakHashMap, WeakReference>>() } -private val lazyCacheSouth by lazy { WeakHashMap, WeakReference>>() } -private val lazyCacheNorth by lazy { WeakHashMap, WeakReference>>() } -private val lazyCacheEast by lazy { WeakHashMap, WeakReference>>() } -private val lazyCacheWest by lazy { WeakHashMap, WeakReference>>() } +private val lazyCache by lazy { WeakHashMap, WeakReference>>() } +private val lazyCacheDown by lazy { WeakHashMap, WeakReference>>() } +private val lazyCacheUp by lazy { WeakHashMap, WeakReference>>() } +private val lazyCacheSouth by lazy { WeakHashMap, WeakReference>>() } +private val lazyCacheNorth by lazy { WeakHashMap, WeakReference>>() } +private val lazyCacheEast by lazy { WeakHashMap, WeakReference>>() } +private val lazyCacheWest by lazy { WeakHashMap, WeakReference>>() } fun ICapabilityProvider.getMekanismEnergySided(side: Direction? = null): LazyOptional { if (!isMekanismLoaded) { @@ -178,7 +177,7 @@ fun ICapabilityProvider.getMekanismEnergySided(side: Direction? = null): LazyOpt } val resolver = LazyOptional.of { - MekanismEnergyWrapper(lazyOptional.orElseThrow(::IllegalStateException)) + Mekanism2MatteryEnergyWrapper(lazyOptional.orElseThrow(::IllegalStateException)) } val ref = WeakReference(resolver)