From e08c81520f28c77434740d268f311786db716e20 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Wed, 3 Jan 2024 15:00:50 +0700 Subject: [PATCH] Actually expose fluid handler of essence storage --- .../mc/otm/block/entity/tech/EssenceStorageBlockEntity.kt | 6 ++++-- .../mc/otm/client/screen/tech/EssenceStorageScreen.kt | 2 +- .../ru/dbotthepony/mc/otm/menu/tech/EssenceStorageMenu.kt | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/EssenceStorageBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/EssenceStorageBlockEntity.kt index 5acf1f262..58a1d287c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/EssenceStorageBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/EssenceStorageBlockEntity.kt @@ -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 { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EssenceStorageScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EssenceStorageScreen.kt index ae05cd7f8..011dc31de 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EssenceStorageScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EssenceStorageScreen.kt @@ -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 } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/tech/EssenceStorageMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/tech/EssenceStorageMenu.kt index e4acd946a..c5f0cc91b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/tech/EssenceStorageMenu.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/tech/EssenceStorageMenu.kt @@ -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(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 {