procedural battery energy bar
This commit is contained in:
parent
37974d40b9
commit
30fdd2fd28
@ -15,6 +15,8 @@ import net.minecraftforge.common.capabilities.ICapabilityProvider
|
|||||||
import ru.dbotthepony.mc.otm.capability.FlowDirection
|
import ru.dbotthepony.mc.otm.capability.FlowDirection
|
||||||
import ru.dbotthepony.mc.otm.capability.energy.ItemEnergyStorageImpl
|
import ru.dbotthepony.mc.otm.capability.energy.ItemEnergyStorageImpl
|
||||||
import ru.dbotthepony.mc.otm.capability.energy.batteryLevel
|
import ru.dbotthepony.mc.otm.capability.energy.batteryLevel
|
||||||
|
import ru.dbotthepony.mc.otm.capability.energy.getBarColor
|
||||||
|
import ru.dbotthepony.mc.otm.capability.energy.getBarWidth
|
||||||
import ru.dbotthepony.mc.otm.capability.matteryEnergy
|
import ru.dbotthepony.mc.otm.capability.matteryEnergy
|
||||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||||
import ru.dbotthepony.mc.otm.core.math.Decimal
|
import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||||
@ -47,6 +49,18 @@ class ProceduralBatteryItem : Item(Properties().stacksTo(1)) {
|
|||||||
get() = maxBatteryLevel
|
get() = maxBatteryLevel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun isBarVisible(p_150899_: ItemStack): Boolean {
|
||||||
|
return p_150899_.matteryEnergy != null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getBarWidth(p_150900_: ItemStack): Int {
|
||||||
|
return p_150900_.matteryEnergy?.getBarWidth() ?: super.getBarWidth(p_150900_)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getBarColor(p_150901_: ItemStack): Int {
|
||||||
|
return p_150901_.matteryEnergy?.getBarColor() ?: super.getBarColor(p_150901_)
|
||||||
|
}
|
||||||
|
|
||||||
override fun appendHoverText(p_41421_: ItemStack, p_41422_: Level?, p_41423_: MutableList<Component>, p_41424_: TooltipFlag) {
|
override fun appendHoverText(p_41421_: ItemStack, p_41422_: Level?, p_41423_: MutableList<Component>, p_41424_: TooltipFlag) {
|
||||||
super.appendHoverText(p_41421_, p_41422_, p_41423_, p_41424_)
|
super.appendHoverText(p_41421_, p_41422_, p_41423_, p_41424_)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user