Prioritize IMatteryEnergyStorage over anything else
This commit is contained in:
parent
d8e9909ca1
commit
4371ca4f26
@ -106,12 +106,18 @@ val ICapabilityProvider.matteryEnergy: IMatteryEnergyStorage? get() {
|
||||
/**
|
||||
* Shortcut for getting [LazyOptional] with [IEnergyStorage], including wrappers for it
|
||||
*/
|
||||
fun ICapabilityProvider.getEnergySided(side: Direction? = null): LazyOptional<IEnergyStorage> {
|
||||
fun ICapabilityProvider.getEnergySided(side: Direction? = null): LazyOptional<out IEnergyStorage> {
|
||||
val mattery = getCapability(MatteryCapability.ENERGY, side)
|
||||
|
||||
if (mattery.isPresent) {
|
||||
return mattery
|
||||
}
|
||||
|
||||
if (isMekanismLoaded) {
|
||||
val mekanismEnergy = getMekanismEnergySided(side)
|
||||
|
||||
if (mekanismEnergy.isPresent) {
|
||||
return mekanismEnergy.cast()
|
||||
return mekanismEnergy
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,7 +127,13 @@ fun ICapabilityProvider.getEnergySided(side: Direction? = null): LazyOptional<IE
|
||||
/**
|
||||
* Shortcut for getting [LazyOptional] with [IMatteryEnergyStorage], including wrappers for it
|
||||
*/
|
||||
fun ICapabilityProvider.getMatteryEnergySided(side: Direction? = null): LazyOptional<IMatteryEnergyStorage> {
|
||||
fun ICapabilityProvider.getMatteryEnergySided(side: Direction? = null): LazyOptional<out IMatteryEnergyStorage> {
|
||||
val mattery = getCapability(MatteryCapability.ENERGY, side)
|
||||
|
||||
if (mattery.isPresent) {
|
||||
return mattery
|
||||
}
|
||||
|
||||
if (isMekanismLoaded) {
|
||||
val mekanismEnergy = getMekanismEnergySided(side)
|
||||
|
||||
@ -130,7 +142,7 @@ fun ICapabilityProvider.getMatteryEnergySided(side: Direction? = null): LazyOpti
|
||||
}
|
||||
}
|
||||
|
||||
return getCapability(MatteryCapability.ENERGY, side)
|
||||
return LazyOptional.empty()
|
||||
}
|
||||
|
||||
fun Player.extendedItemIterator(): MutableIterator<ItemStack> {
|
||||
|
Loading…
Reference in New Issue
Block a user