diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/items/ItemModels.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/items/ItemModels.kt index 69ab5482e..874a4d749 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/items/ItemModels.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/items/ItemModels.kt @@ -85,7 +85,7 @@ fun addItemModels(provider: MatteryItemModelProvider) { provider.generated(MItems.EXOPACK_PROBE) - provider.handheld(MItems.TRITANIUM_TOOLS.filter { it != MItems.TRITANIUM_SHIELD }) + provider.handheld(MItems.TRITANIUM_TOOLS) provider.generated(MItems.TRITANIUM_ARMOR) provider.generated(MItems.SIMPLE_TRITANIUM_ARMOR) diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/BlastingRecipes.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/BlastingRecipes.kt index 30479a59e..db672b619 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/BlastingRecipes.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/BlastingRecipes.kt @@ -1,34 +1,50 @@ package ru.dbotthepony.mc.otm.datagen.recipes +import com.google.common.collect.Lists import net.minecraft.data.recipes.FinishedRecipe import net.minecraft.data.recipes.RecipeCategory import net.minecraft.data.recipes.SimpleCookingRecipeBuilder +import net.minecraft.world.item.Item +import net.minecraft.world.item.ItemStack import net.minecraft.world.item.crafting.Ingredient -import ru.dbotthepony.mc.otm.core.registryName +import net.minecraft.world.level.ItemLike import ru.dbotthepony.mc.otm.datagen.modLocation import ru.dbotthepony.mc.otm.registry.MItemTags import ru.dbotthepony.mc.otm.registry.MItems +import java.util.* import java.util.function.Consumer +private fun Consumer.addRecyclingRecipe(inputs: Collection, result: Item, name: String) { + val inputStacks: LinkedList = Lists.newLinkedList() + inputs.forEach { inputStacks.add(ItemStack(it)) } + + val smelting = SimpleCookingRecipeBuilder.smelting( + Ingredient.of(inputStacks.stream()), + RecipeCategory.MISC, + result, + 0f, + 200 + ) + inputs.forEach { smelting.unlockedBy(it) } + smelting.save(this, modLocation("smelting/${name}")) + + val blasting = SimpleCookingRecipeBuilder.blasting( + Ingredient.of(inputStacks.stream()), + RecipeCategory.MISC, + result, + 0f, + 100 + ) + inputs.forEach { blasting.unlockedBy(it) } + blasting.save(this, modLocation("blasting/${name}")) +} + fun addBlastingRecipes(consumer: Consumer) { SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItems.MIRROR_COMPOUND), RecipeCategory.MISC, MItems.MIRROR, 0.1f, 100).unlockedBy(MItems.MIRROR_COMPOUND).save(consumer) SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_PLATES), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 0f, 100).unlockedBy(MItemTags.TRITANIUM_PLATES).save(consumer, modLocation("tritanium_ingot_from_plates")) SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_PLATES), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 0f, 50).unlockedBy(MItemTags.TRITANIUM_PLATES).save(consumer, modLocation("tritanium_ingot_from_plates_blasting")) - for (tool in MItems.TRITANIUM_TOOLS) { - SimpleCookingRecipeBuilder.smelting( - Ingredient.of(tool), - RecipeCategory.MISC, - MItems.TRITANIUM_NUGGET, - 0f, 200 - ).unlockedBy(MItems.TRITANIUM_NUGGET).save(consumer, modLocation("smelting/tritanium_nugget_from_${tool.registryName!!.path}")) - - SimpleCookingRecipeBuilder.blasting( - Ingredient.of(tool), - RecipeCategory.MISC, - MItems.TRITANIUM_NUGGET, - 0f, 100 - ).unlockedBy(MItems.TRITANIUM_NUGGET).save(consumer, modLocation("blasting/tritanium_nugget_from_${tool.registryName!!.path}")) - } + consumer.addRecyclingRecipe(MItems.TRITANIUM_TOOLS, MItems.TRITANIUM_NUGGET, "tritanium_nugget_from_tools") + consumer.addRecyclingRecipe(MItems.SIMPLE_TRITANIUM_ARMOR, MItems.TRITANIUM_NUGGET, "tritanium_nugger_from_armor") } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MCreativeTabs.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MCreativeTabs.kt index fd2df678e..26cd6e470 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MCreativeTabs.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MCreativeTabs.kt @@ -148,6 +148,7 @@ private fun addMainCreativeTabItems(consumer: CreativeModeTab.Output) { accept(MItems.TRITANIUM_INGOT_BLOCK) accept(MItems.TRITANIUM_TOOLS) + accept(MItems.TRITANIUM_SHIELD) accept(MItems.SIMPLE_TRITANIUM_ARMOR) accept(MItems.TRITANIUM_ARMOR) 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 f24e37f4d..5e916a1ef 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt @@ -215,7 +215,6 @@ object MItems { ::TRITANIUM_PICKAXE, ::TRITANIUM_HOE, ::TRITANIUM_SHEARS, - ::TRITANIUM_SHIELD, ) val TRITANIUM_HELMET: TritaniumArmorItem by registry.register(MNames.TRITANIUM_HELMET) { TritaniumArmorItem(ArmorItem.Type.HELMET) }