Actually expose fluid handler of essence storage

This commit is contained in:
DBotThePony 2024-01-03 15:00:50 +07:00
parent 6e16364491
commit e08c81520f
Signed by: DBot
GPG Key ID: DCC23B5715498507
3 changed files with 7 additions and 3 deletions

View File

@ -61,6 +61,8 @@ class EssenceStorageBlockEntity(blockPos: BlockPos, blockState: BlockState) : Ma
)
)
val fluidConfig = ConfigurableFluidHandler(this)
override fun getTanks(): Int {
return 1
}
@ -69,10 +71,10 @@ class EssenceStorageBlockEntity(blockPos: BlockPos, blockState: BlockState) : Ma
if (tank != 0)
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, experienceStored.toInt())
return FluidStack(MFluids.LIQUID_XP, (experienceStored * XP_TO_LIQUID_RATIO).toInt())
}
override fun getTankCapacity(tank: Int): Int {

View File

@ -273,7 +273,7 @@ class EssenceStorageScreen(menu: EssenceStorageMenu, inventory: Inventory, title
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
}

View File

@ -14,6 +14,7 @@ import ru.dbotthepony.mc.otm.item.EssenceServoItem
import ru.dbotthepony.mc.otm.menu.MatteryMenu
import ru.dbotthepony.mc.otm.menu.MatterySlot
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.registry.MItems
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 redstoneConfig = EnumInputWithFeedback<RedstoneSetting>(this)
val itemConfig = ItemConfigPlayerInput(this, tile?.itemConfig)
val fluidConfig = FluidConfigPlayerInput(this, tile?.fluidConfig)
val capsuleSlot = object : MatterySlot(tile?.capsuleContainer ?: SimpleContainer(1), 0) {
override fun mayPlace(itemStack: ItemStack): Boolean {