From 0f77ed34c2d7fbd58ce8ef6d1097aae6d6d6704c Mon Sep 17 00:00:00 2001 From: YuRaNnNzZZ Date: Tue, 12 Nov 2024 06:04:01 +0300 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B5=D1=86=D0=B5=D0=BF=D1=82=D1=8B=20?= =?UTF-8?q?=D0=B8=20=D1=82=D1=83=D0=BB=D1=82=D0=B8=D0=BF=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D1=8D=D0=BD=D0=B5=D1=80=D0=B3=D0=B5=D1=82=D0=B8=D1=87?= =?UTF-8?q?=D0=B5=D1=81=D0=BA=D0=B8=D1=85=20=D0=BA=D0=B0=D0=B1=D0=B5=D0=BB?= =?UTF-8?q?=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Konstantin Linev, [6:01] Konstantin Linev, [6:02] Но имеет смысл --- .../datagen/recipes/CraftingTableRecipes.kt | 24 +++++++++++++++++ .../mc/otm/item/block/EnergyCableItem.kt | 26 +++++++++++++++++++ .../ru/dbotthepony/mc/otm/registry/MItems.kt | 3 ++- 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/main/kotlin/ru/dbotthepony/mc/otm/item/block/EnergyCableItem.kt diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/CraftingTableRecipes.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/CraftingTableRecipes.kt index a27622ee5..01c57d443 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/CraftingTableRecipes.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/CraftingTableRecipes.kt @@ -10,6 +10,7 @@ import net.minecraft.world.item.Items import net.minecraft.world.item.crafting.Ingredient import net.neoforged.neoforge.common.Tags import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity +import ru.dbotthepony.mc.otm.config.CablesConfig import ru.dbotthepony.mc.otm.registry.MBlocks import ru.dbotthepony.mc.otm.registry.MItemTags import ru.dbotthepony.mc.otm.registry.MItems @@ -469,4 +470,27 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) { .unlockedBy(Tags.Items.BARRELS_WOODEN) .unlockedBy(MItemTags.CARGO_CRATES) .build(consumer) + + MatteryRecipe(MItems.ENERGY_CABLES[CablesConfig.E.CRUDE]!!.asItem(), category = machinesCategory, count = 8) + .row(MItemTags.IRON_PLATES, Items.REDSTONE, MItemTags.IRON_PLATES) + .unlockedBy(Items.REDSTONE) + .build(consumer) + + MatteryRecipe(MItems.ENERGY_CABLES[CablesConfig.E.REGULAR]!!.asItem(), category = machinesCategory, count = 16) + .row(MItemTags.IRON_PLATES, MItemTags.IRON_PLATES, MItemTags.IRON_PLATES) + .row(MItemTags.COPPER_WIRES, Items.REDSTONE, MItemTags.COPPER_WIRES) + .row(MItemTags.IRON_PLATES, MItemTags.IRON_PLATES, MItemTags.IRON_PLATES) + .build(consumer) + + MatteryRecipe(MItems.ENERGY_CABLES[CablesConfig.E.ADVANCED]!!.asItem(), category = machinesCategory, count = 16) + .row(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES) + .row(MItemTags.GOLD_WIRES, Items.REDSTONE, MItemTags.GOLD_WIRES) + .row(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES) + .build(consumer) + + MatteryRecipe(MItems.ENERGY_CABLES[CablesConfig.E.SUPERCONDUCTOR]!!.asItem(), category = machinesCategory) + .row(MItemTags.REINFORCED_TRITANIUM_PLATES, MItems.ELECTROMAGNET, MItemTags.REINFORCED_TRITANIUM_PLATES) + .row(Tags.Items.INGOTS_GOLD, Tags.Items.INGOTS_GOLD, Tags.Items.INGOTS_GOLD) + .row(MItemTags.REINFORCED_TRITANIUM_PLATES, Items.BLUE_ICE, MItemTags.REINFORCED_TRITANIUM_PLATES) + .build(consumer) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/block/EnergyCableItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/block/EnergyCableItem.kt new file mode 100644 index 000000000..4edebdec6 --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/block/EnergyCableItem.kt @@ -0,0 +1,26 @@ +package ru.dbotthepony.mc.otm.item.block + +import net.minecraft.ChatFormatting +import net.minecraft.network.chat.Component +import net.minecraft.world.item.BlockItem +import net.minecraft.world.item.ItemStack +import net.minecraft.world.item.TooltipFlag +import ru.dbotthepony.mc.otm.config.CablesConfig +import ru.dbotthepony.mc.otm.core.util.formatPower +import ru.dbotthepony.mc.otm.registry.MBlocks + +class EnergyCableItem(val conf: CablesConfig.E, properties: Properties) : BlockItem(MBlocks.ENERGY_CABLES[conf]!!, properties) { + override fun appendHoverText( + stack: ItemStack, + context: TooltipContext, + tooltip: MutableList, + flag: TooltipFlag + ) { + super.appendHoverText(stack, context, tooltip, flag) + + tooltip.add( + Component.translatable("otm.item.power.throughput_mono", conf.throughput.formatPower()) + .withStyle(ChatFormatting.GRAY)) + } + +} 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 364476925..f27eb70ca 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt @@ -58,6 +58,7 @@ import ru.dbotthepony.mc.otm.item.ZPMItem import ru.dbotthepony.mc.otm.item.addSimpleDescription import ru.dbotthepony.mc.otm.item.armor.PortableGravitationStabilizerItem import ru.dbotthepony.mc.otm.item.armor.TritaniumArmorItem +import ru.dbotthepony.mc.otm.item.block.EnergyCableItem import ru.dbotthepony.mc.otm.item.exopack.ExopackProbeItem import ru.dbotthepony.mc.otm.item.exopack.ExopackSlotUpgradeItem import ru.dbotthepony.mc.otm.item.exopack.ExopackUpgradeItem @@ -84,7 +85,7 @@ object MItems { } val ENERGY_CABLES: Map = SupplierMap(CablesConfig.E.entries.map { conf -> - conf to registry.register("${conf.name.lowercase()}_energy_cable") { BlockItem(MBlocks.ENERGY_CABLES[conf]!!, DEFAULT_PROPERTIES) } + conf to registry.register("${conf.name.lowercase()}_energy_cable") { EnergyCableItem(conf, DEFAULT_PROPERTIES) } }) val ANDROID_STATION = register(MNames.ANDROID_STATION, MBlocks.ANDROID_STATION)