From 13a78290160ac321a89c33bf635e0f28fc5dc977 Mon Sep 17 00:00:00 2001 From: YuRaNnNzZZ Date: Tue, 12 Nov 2024 06:11:19 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=B5=20=D0=BD=D1=83=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B7=20=D1=83=D0=B6=20=D1=8F=20=D0=BD=D0=B0=D1=87=D0=B0=D0=BB?= =?UTF-8?q?=20=D0=B7=D0=B0=D0=BA=D0=B8=D0=B4=D1=8B=D0=B2=D0=B0=D1=82=D1=8C?= =?UTF-8?q?=20=D0=B8=D1=82=D0=B5=D0=BC=D0=B1=D0=BB=D0=BE=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=B2=20.block=20=D1=82=D0=BE=D0=B3=D0=B4=D0=B0=20=D0=B8=20?= =?UTF-8?q?=D1=8D=D1=82=D0=BE=D1=82=20=D1=82=D1=83=D0=B4=D0=B0=20=D0=B6?= =?UTF-8?q?=D0=B5=20=D0=BB=D0=BE=D0=B3=D0=B8=D1=87=D0=BD=D0=BE=3F=20=D0=BB?= =?UTF-8?q?=D0=BE=D0=B3=D0=B8=D1=87=D0=BD=D0=BE.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mc/otm/item/{ => block}/FluidTankItem.kt | 16 +++++++++++++--- .../ru/dbotthepony/mc/otm/registry/MItems.kt | 5 ++--- 2 files changed, 15 insertions(+), 6 deletions(-) rename src/main/kotlin/ru/dbotthepony/mc/otm/item/{ => block}/FluidTankItem.kt (87%) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/FluidTankItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/block/FluidTankItem.kt similarity index 87% rename from src/main/kotlin/ru/dbotthepony/mc/otm/item/FluidTankItem.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/item/block/FluidTankItem.kt index 1474eafd9..1052cde34 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/FluidTankItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/block/FluidTankItem.kt @@ -1,4 +1,4 @@ -package ru.dbotthepony.mc.otm.item +package ru.dbotthepony.mc.otm.item.block import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer import net.minecraft.network.chat.Component @@ -16,6 +16,7 @@ import ru.dbotthepony.mc.otm.capability.fluid.BlockMatteryFluidHandler import ru.dbotthepony.mc.otm.client.render.blockentity.FluidTankRenderer import ru.dbotthepony.mc.otm.core.TooltipList import ru.dbotthepony.mc.otm.core.TranslatableComponent +import ru.dbotthepony.mc.otm.item.FluidCapsuleItem import ru.dbotthepony.mc.otm.registry.CapabilitiesRegisterListener import java.util.function.Consumer import java.util.function.IntSupplier @@ -36,9 +37,18 @@ class FluidTankItem(block: FluidTankBlock, properties: Properties, val capacity: if (pContext.player?.isCrouching == true) return InteractionResult.PASS - val context = FluidCapsuleItem.Context(pContext.clickedPos, pContext.level.getBlockState(pContext.clickedPos), pContext.clickedFace) + val context = FluidCapsuleItem.Context( + pContext.clickedPos, + pContext.level.getBlockState(pContext.clickedPos), + pContext.clickedFace + ) - if (FluidCapsuleItem.canInteract(pContext.itemInHand, pContext.player ?: return InteractionResult.FAIL, context)) + if (FluidCapsuleItem.canInteract( + pContext.itemInHand, + pContext.player ?: return InteractionResult.FAIL, + context + ) + ) return FluidCapsuleItem.interact(pContext.itemInHand, pContext.player!!, context) return super.onItemUseFirst(stack, pContext) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt index f27eb70ca..ec2c208ae 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt @@ -25,7 +25,6 @@ import net.minecraft.world.item.Tiers import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.level.block.Block import net.neoforged.bus.api.IEventBus -import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent import net.neoforged.neoforge.common.SimpleTier import ru.dbotthepony.mc.otm.capability.ITieredUpgradeSet import ru.dbotthepony.mc.otm.capability.MatteryPlayer @@ -43,7 +42,7 @@ import ru.dbotthepony.mc.otm.item.CrudeBatteryItem import ru.dbotthepony.mc.otm.item.EssenceCapsuleItem import ru.dbotthepony.mc.otm.item.EssenceServoItem import ru.dbotthepony.mc.otm.item.FluidCapsuleItem -import ru.dbotthepony.mc.otm.item.FluidTankItem +import ru.dbotthepony.mc.otm.item.block.FluidTankItem import ru.dbotthepony.mc.otm.item.GravitationalDisruptorItem import ru.dbotthepony.mc.otm.item.HealPillItem import ru.dbotthepony.mc.otm.item.MatteryItem @@ -324,7 +323,7 @@ object MItems { val ESSENCE_DRIVE: EssenceCapsuleItem by registry.register("essence_drive") { EssenceCapsuleItem(true) } val FLUID_CAPSULE: FluidCapsuleItem by registry.register("fluid_capsule") { FluidCapsuleItem(ItemsConfig::FLUID_CAPSULE_CAPACITY) } - val FLUID_TANK: FluidTankItem by registry.register(MNames.FLUID_TANK) { FluidTankItem(MBlocks.FLUID_TANK, Item.Properties().stacksTo(1), ItemsConfig::FLUID_TANK_CAPACITY) } + val FLUID_TANK: FluidTankItem by registry.register(MNames.FLUID_TANK) { FluidTankItem(MBlocks.FLUID_TANK, Properties().stacksTo(1), ItemsConfig::FLUID_TANK_CAPACITY) } val LIQUID_XP_BUCKET: BucketItem by registry.register("liquid_xp_bucket") { BucketItem(MFluids.LIQUID_XP, Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON)) } val TRITANIUM_COMPONENT: SimpleTier = SimpleTier(