Fix mekanism energy getting above potential IMatteryEnergyStorage

This commit is contained in:
DBotThePony 2023-07-21 21:40:15 +07:00
parent ca32929f3c
commit b2e50a6c1b
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -49,6 +49,7 @@ import ru.dbotthepony.mc.otm.core.collect.SupplierList
import ru.dbotthepony.mc.otm.core.collect.WeakHashSet
import ru.dbotthepony.mc.otm.core.forValidRefs
import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.core.ifPresentK
import ru.dbotthepony.mc.otm.core.immutableList
import ru.dbotthepony.mc.otm.core.math.BlockRotation
import ru.dbotthepony.mc.otm.core.math.RelativeSide
@ -273,7 +274,9 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc
}
override fun get(): LazyOptional<IEnergyStorage> {
return actualMekanism ?: regular.get()
val get = regular.get()
get.ifPresentK { if (it is IMatteryEnergyStorage) return get }
return actualMekanism ?: get
}
}
}