Actually expose fluid handler of essence storage
This commit is contained in:
parent
6e16364491
commit
e08c81520f
src/main/kotlin/ru/dbotthepony/mc/otm
block/entity/tech
client/screen/tech
menu/tech
@ -61,6 +61,8 @@ class EssenceStorageBlockEntity(blockPos: BlockPos, blockState: BlockState) : Ma
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val fluidConfig = ConfigurableFluidHandler(this)
|
||||||
|
|
||||||
override fun getTanks(): Int {
|
override fun getTanks(): Int {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
@ -69,10 +71,10 @@ class EssenceStorageBlockEntity(blockPos: BlockPos, blockState: BlockState) : Ma
|
|||||||
if (tank != 0)
|
if (tank != 0)
|
||||||
return FluidStack.EMPTY
|
return FluidStack.EMPTY
|
||||||
|
|
||||||
if (experienceStored >= 2_000_000_000L)
|
if ((experienceStored * XP_TO_LIQUID_RATIO) >= 2_000_000_000L)
|
||||||
return FluidStack(MFluids.LIQUID_XP, 2_000_000_000)
|
return FluidStack(MFluids.LIQUID_XP, 2_000_000_000)
|
||||||
|
|
||||||
return FluidStack(MFluids.LIQUID_XP, experienceStored.toInt())
|
return FluidStack(MFluids.LIQUID_XP, (experienceStored * XP_TO_LIQUID_RATIO).toInt())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getTankCapacity(tank: Int): Int {
|
override fun getTankCapacity(tank: Int): Int {
|
||||||
|
@ -273,7 +273,7 @@ class EssenceStorageScreen(menu: EssenceStorageMenu, inventory: Inventory, title
|
|||||||
it.tooltips.add(Enchantments.MENDING.getFullname(1).copy().withStyle(ChatFormatting.GRAY))
|
it.tooltips.add(Enchantments.MENDING.getFullname(1).copy().withStyle(ChatFormatting.GRAY))
|
||||||
}
|
}
|
||||||
|
|
||||||
makeDeviceControls(this, frame, redstoneConfig = menu.redstoneConfig, itemConfig = menu.itemConfig)
|
makeDeviceControls(this, frame, redstoneConfig = menu.redstoneConfig, itemConfig = menu.itemConfig, fluidConfig = menu.fluidConfig)
|
||||||
|
|
||||||
return frame
|
return frame
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import ru.dbotthepony.mc.otm.item.EssenceServoItem
|
|||||||
import ru.dbotthepony.mc.otm.menu.MatteryMenu
|
import ru.dbotthepony.mc.otm.menu.MatteryMenu
|
||||||
import ru.dbotthepony.mc.otm.menu.MatterySlot
|
import ru.dbotthepony.mc.otm.menu.MatterySlot
|
||||||
import ru.dbotthepony.mc.otm.menu.input.EnumInputWithFeedback
|
import ru.dbotthepony.mc.otm.menu.input.EnumInputWithFeedback
|
||||||
|
import ru.dbotthepony.mc.otm.menu.input.FluidConfigPlayerInput
|
||||||
import ru.dbotthepony.mc.otm.menu.input.ItemConfigPlayerInput
|
import ru.dbotthepony.mc.otm.menu.input.ItemConfigPlayerInput
|
||||||
import ru.dbotthepony.mc.otm.registry.MItems
|
import ru.dbotthepony.mc.otm.registry.MItems
|
||||||
import ru.dbotthepony.mc.otm.registry.MMenus
|
import ru.dbotthepony.mc.otm.registry.MMenus
|
||||||
@ -26,6 +27,7 @@ class EssenceStorageMenu @JvmOverloads constructor(
|
|||||||
val experienceStored by mSynchronizer.ComputedLongField(getter = { tile?.experienceStored ?: 0L }).property
|
val experienceStored by mSynchronizer.ComputedLongField(getter = { tile?.experienceStored ?: 0L }).property
|
||||||
val redstoneConfig = EnumInputWithFeedback<RedstoneSetting>(this)
|
val redstoneConfig = EnumInputWithFeedback<RedstoneSetting>(this)
|
||||||
val itemConfig = ItemConfigPlayerInput(this, tile?.itemConfig)
|
val itemConfig = ItemConfigPlayerInput(this, tile?.itemConfig)
|
||||||
|
val fluidConfig = FluidConfigPlayerInput(this, tile?.fluidConfig)
|
||||||
|
|
||||||
val capsuleSlot = object : MatterySlot(tile?.capsuleContainer ?: SimpleContainer(1), 0) {
|
val capsuleSlot = object : MatterySlot(tile?.capsuleContainer ?: SimpleContainer(1), 0) {
|
||||||
override fun mayPlace(itemStack: ItemStack): Boolean {
|
override fun mayPlace(itemStack: ItemStack): Boolean {
|
||||||
|
Loading…
Reference in New Issue
Block a user