From 5c1d32c9c5a401745afb1cf86b38bc00bfdbdc0e Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Wed, 5 Oct 2022 00:49:53 +0700 Subject: [PATCH] Tritanium Ingots Block as storage Fixes #108 --- .../ru/dbotthepony/mc/otm/datagen/lang/English.kt | 2 ++ .../mc/otm/datagen/recipes/CraftingTableRecipes.kt | 11 +++++++++++ .../kotlin/ru/dbotthepony/mc/otm/datagen/tags/Tags.kt | 6 ++++-- .../dbotthepony/mc/otm/datagen/tags/TagsProvider.kt | 1 - .../kotlin/ru/dbotthepony/mc/otm/registry/MBlocks.kt | 4 ++++ .../kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt | 1 + .../kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt | 1 + .../kotlin/ru/dbotthepony/mc/otm/registry/Tags.kt | 1 + 8 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/English.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/English.kt index e0ab7e1cf..e08003d47 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/English.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/English.kt @@ -319,6 +319,8 @@ private fun blocks(provider: MatteryLanguageProvider) { add(MBlocks.DRIVE_VIEWER, "Drive Viewer") add(MBlocks.BLACK_HOLE, "Local Anomalous Singular Gravitation Field") + add(MBlocks.TRITANIUM_INGOT_BLOCK, "Tritanium Plating Block") + add(MBlocks.ENERGY_COUNTER, "Energy Counter") add(MBlocks.ENERGY_COUNTER, "facing", "Input facing: %s") add(MBlocks.ENERGY_COUNTER, "switch", "Switch input facing") 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 a92649d74..30a48962a 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 @@ -14,6 +14,7 @@ import ru.dbotthepony.mc.otm.registry.MItemTags import ru.dbotthepony.mc.otm.registry.MItems import ru.dbotthepony.mc.otm.registry.MRegistry import ru.dbotthepony.mc.otm.core.registryName +import ru.dbotthepony.mc.otm.datagen.modLocation import java.util.function.Consumer fun addCraftingTableRecipes(consumer: Consumer) { @@ -35,6 +36,16 @@ fun addCraftingTableRecipes(consumer: Consumer) { .save(consumer, "${crate.registryName}_alt") } + ShapelessRecipeBuilder(MItems.TRITANIUM_INGOT_BLOCK, 1) + .requires(Ingredient.of(MItemTags.TRITANIUM_INGOTS), 9) + .unlockedBy(MItemTags.TRITANIUM_INGOTS) + .save(consumer) + + ShapelessRecipeBuilder(MItems.TRITANIUM_INGOT, 9) + .requires(Ingredient.of(MItemTags.TRITANIUM_INGOTS_STORAGE)) + .unlockedBy(MItemTags.TRITANIUM_INGOTS_STORAGE) + .save(consumer, modLocation("tritanium_ingot_from_storage")) + ShapedRecipeBuilder(MRegistry.CARGO_CRATES.item, 1) .define('P', MItemTags.TRITANIUM_PLATES) .define('C', Tags.Items.CHESTS) diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/Tags.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/Tags.kt index 806798600..1c7bf4c75 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/Tags.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/Tags.kt @@ -4,7 +4,6 @@ import net.minecraft.tags.BlockTags import net.minecraft.tags.ItemTags import net.minecraft.world.effect.MobEffects import net.minecraft.world.item.BlockItem -import net.minecraft.world.item.DyeColor import net.minecraft.world.item.Items import net.minecraft.world.item.Tiers import ru.dbotthepony.mc.otm.registry.MBlockTags @@ -12,7 +11,6 @@ import ru.dbotthepony.mc.otm.registry.MBlocks import ru.dbotthepony.mc.otm.registry.MItemTags import ru.dbotthepony.mc.otm.registry.MItems import ru.dbotthepony.mc.otm.registry.MRegistry -import ru.dbotthepony.mc.otm.registry.MSoundEvents fun addTags(tagsProvider: TagsProvider) { tagsProvider.items.forge("pistons").add(Items.PISTON) @@ -25,6 +23,9 @@ fun addTags(tagsProvider: TagsProvider) { tagsProvider.plates.add("iron", MItems.IRON_PLATE) tagsProvider.plates.add("gold", MItems.GOLD_PLATE) + tagsProvider.storageBlocksAsItem.add("tritanium", MItems.TRITANIUM_INGOT_BLOCK) + tagsProvider.storageBlocksAsBlock.add("tritanium", MBlocks.TRITANIUM_INGOT_BLOCK) + tagsProvider.ore("tritanium", MBlocks.TRITANIUM_ORE) tagsProvider.ore("tritanium", MBlocks.DEEPSLATE_TRITANIUM_ORE) tagsProvider.clump("tritanium", MItems.TRITANIUM_ORE_CLUMP, MBlocks.TRITANIUM_RAW_BLOCK) @@ -104,6 +105,7 @@ fun addTags(tagsProvider: TagsProvider) { MBlocks.TRITANIUM_DOOR, MBlocks.TRITANIUM_TRAPDOOR, MBlocks.TRITANIUM_PRESSURE_PLATE, + MBlocks.TRITANIUM_INGOT_BLOCK, ), Tiers.IRON) tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_ORE, Tiers.IRON) diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/TagsProvider.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/TagsProvider.kt index 61740050e..5ac1a7b34 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/TagsProvider.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/TagsProvider.kt @@ -10,7 +10,6 @@ import net.minecraft.world.item.Item import net.minecraft.world.item.Tier import net.minecraft.world.item.Tiers import net.minecraft.world.level.block.Block -import net.minecraft.world.level.gameevent.GameEvent import net.minecraftforge.data.event.GatherDataEvent import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.datagen.DataGen diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlocks.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlocks.kt index a4e3ac840..5b5c67d4f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlocks.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlocks.kt @@ -103,6 +103,10 @@ object MBlocks { UniformInt.of(0, 3) ) } + val TRITANIUM_INGOT_BLOCK: Block by registry.register(MNames.TRITANIUM_INGOT_BLOCK) { + Block(BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_BLUE).explosionResistance(400f).destroyTime(3f).requiresCorrectToolForDrops()) + } + val DEEPSLATE_TRITANIUM_ORE: Block by registry.register(MNames.DEEPSLATE_TRITANIUM_ORE) { DropExperienceBlock( BlockBehaviour.Properties.of(Material.STONE) .strength(4.75f, 6.5f) 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 3e20c5806..4c71f1ee6 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt @@ -124,6 +124,7 @@ object MItems { val TRITANIUM_ORE_CLUMP: Item by registry.register(MNames.TRITANIUM_ORE_CLUMP) { Item(DEFAULT_PROPERTIES) } val TRITANIUM_INGOT: Item by registry.register(MNames.TRITANIUM_INGOT) { Item(DEFAULT_PROPERTIES) } + val TRITANIUM_INGOT_BLOCK: Item by registry.register(MNames.TRITANIUM_INGOT_BLOCK) { BlockItem(MBlocks.TRITANIUM_INGOT_BLOCK, DEFAULT_PROPERTIES) } val TRITANIUM_COMPONENT: ForgeTier = ForgeTier( Tiers.IRON.level, diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt index cd9efc99c..b141fa459 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt @@ -128,6 +128,7 @@ object MNames { // items: crafting components const val TRITANIUM_INGOT = "tritanium_ingot" + const val TRITANIUM_INGOT_BLOCK = "tritanium_ingot_block" const val MATTER_IO_PORT = "matter_io_port" const val MATTER_TRANSFORM_MATRIX = "matter_transform_matrix" diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/Tags.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/Tags.kt index 2e2e75295..aa72e61f4 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/Tags.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/Tags.kt @@ -13,6 +13,7 @@ object MItemTags { val TRITANIUM_ORES: TagKey = ItemTags.create(ResourceLocation("forge", "ores/tritanium")) val TRITANIUM_ORE_CLUMPS: TagKey = ItemTags.create(ResourceLocation("forge", "raw_materials/tritanium")) val TRITANIUM_INGOTS: TagKey = ItemTags.create(ResourceLocation("forge", "ingots/tritanium")) + val TRITANIUM_INGOTS_STORAGE: TagKey = ItemTags.create(ResourceLocation("forge", "storage_blocks/tritanium")) val TRITANIUM_PLATES: TagKey = ItemTags.create(ResourceLocation("forge", "plates/tritanium")) val IRON_PLATES: TagKey = ItemTags.create(ResourceLocation("forge", "plates/iron")) val GOLD_PLATES: TagKey = ItemTags.create(ResourceLocation("forge", "plates/gold"))