Update datagen to match Mojang's inner schizo

This commit is contained in:
DBotThePony 2023-01-13 18:47:16 +07:00
parent a8a01702ca
commit 3c0f74bc03
Signed by: DBot
GPG Key ID: DCC23B5715498507
12 changed files with 120 additions and 108 deletions

View File

@ -406,7 +406,7 @@ object DataGen {
val lootModifier = LootModifiers(event.generator) val lootModifier = LootModifiers(event.generator)
val languageProvider = MatteryLanguageProvider(event.generator) val languageProvider = MatteryLanguageProvider(event.generator)
val matterData = MatterDataProvider(event) val matterData = MatterDataProvider(event)
val researchProvider = AndroidResearchDataProvider(event.generator, MOD_ID).also { it.exec { addResearchData(it, languageProvider) } } val researchProvider = AndroidResearchDataProvider(event).also { it.exec { addResearchData(it, languageProvider) } }
this.blockModelProvider = blockModelProvider this.blockModelProvider = blockModelProvider
this.blockStateProvider = blockStateProvider this.blockStateProvider = blockStateProvider

View File

@ -1,12 +1,13 @@
package ru.dbotthepony.mc.otm.datagen.advancements package ru.dbotthepony.mc.otm.datagen.advancements
import net.minecraft.advancements.Advancement import net.minecraft.advancements.Advancement
import net.minecraft.core.HolderLookup
import net.minecraftforge.common.data.ExistingFileHelper import net.minecraftforge.common.data.ExistingFileHelper
import net.minecraftforge.data.event.GatherDataEvent import net.minecraftforge.data.event.GatherDataEvent
import java.util.LinkedList import java.util.LinkedList
import java.util.function.Consumer import java.util.function.Consumer
class AdvancementProvider(event: GatherDataEvent) : net.minecraft.data.advancements.AdvancementProvider(event.generator, event.existingFileHelper) { class AdvancementProvider(event: GatherDataEvent) : net.minecraft.data.advancements.AdvancementProvider(event.generator.packOutput, event.lookupProvider, listOf(), event.existingFileHelper) {
private val callbacks = LinkedList<(Consumer<Advancement>, ExistingFileHelper) -> Unit>() private val callbacks = LinkedList<(Consumer<Advancement>, ExistingFileHelper) -> Unit>()
fun exec(callback: (Consumer<Advancement>, ExistingFileHelper) -> Unit) { fun exec(callback: (Consumer<Advancement>, ExistingFileHelper) -> Unit) {
@ -19,7 +20,7 @@ class AdvancementProvider(event: GatherDataEvent) : net.minecraft.data.advanceme
} }
} }
override fun registerAdvancements(consumer: Consumer<Advancement>, fileHelper: ExistingFileHelper) { override fun registerAdvancements(registries: HolderLookup.Provider, consumer: Consumer<Advancement>, fileHelper: ExistingFileHelper) {
for (callback in callbacks) { for (callback in callbacks) {
callback.invoke(consumer, fileHelper) callback.invoke(consumer, fileHelper)
} }

View File

@ -9,6 +9,7 @@ import it.unimi.dsi.fastutil.objects.Reference2ObjectFunction
import net.minecraft.advancements.critereon.StatePropertiesPredicate import net.minecraft.advancements.critereon.StatePropertiesPredicate
import net.minecraft.data.DataGenerator import net.minecraft.data.DataGenerator
import net.minecraft.data.loot.LootTableProvider import net.minecraft.data.loot.LootTableProvider
import net.minecraft.data.loot.LootTableSubProvider
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
import net.minecraft.world.level.ItemLike import net.minecraft.world.level.ItemLike
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
@ -32,11 +33,6 @@ import java.util.function.BiConsumer
import java.util.function.Consumer import java.util.function.Consumer
import java.util.function.Supplier import java.util.function.Supplier
private typealias LootTableSaver = BiConsumer<ResourceLocation, LootTable.Builder>
private typealias LootTableCallback = Consumer<LootTableSaver>
private typealias LootTableCallbackProvider = Supplier<LootTableCallback>
private typealias LootTuple = Pair<LootTableCallbackProvider, LootContextParamSet>
data class NbtCopy(val source: String, val destination: String, val strategy: CopyNbtFunction.MergeStrategy = CopyNbtFunction.MergeStrategy.REPLACE) data class NbtCopy(val source: String, val destination: String, val strategy: CopyNbtFunction.MergeStrategy = CopyNbtFunction.MergeStrategy.REPLACE)
fun TileNbtCopy(source: String, strategy: CopyNbtFunction.MergeStrategy = CopyNbtFunction.MergeStrategy.REPLACE): NbtCopy { fun TileNbtCopy(source: String, strategy: CopyNbtFunction.MergeStrategy = CopyNbtFunction.MergeStrategy.REPLACE): NbtCopy {
@ -65,7 +61,7 @@ private val poweredMatterWorker = arrayOf(
TileNbtCopy(MatteryBlockEntity.MATTER_STORAGE_KEY), TileNbtCopy(MatteryBlockEntity.MATTER_STORAGE_KEY),
) )
class LootTables(generator: DataGenerator) : LootTableProvider(generator) { class LootTables(generator: DataGenerator) : LootTableProvider(generator.packOutput, setOf() /* because we don't fucking validate you fuck */, listOf() /* because we attach everything after class is constructed duh */) {
private val providersTable = Reference2ObjectArrayMap<LootContextParamSet, HashMap<ResourceLocation, () -> LootTable.Builder>>() private val providersTable = Reference2ObjectArrayMap<LootContextParamSet, HashMap<ResourceLocation, () -> LootTable.Builder>>()
fun builder(context: LootContextParamSet, id: ResourceLocation, provider: LootTable.Builder.() -> Unit) { fun builder(context: LootContextParamSet, id: ResourceLocation, provider: LootTable.Builder.() -> Unit) {
@ -80,10 +76,10 @@ class LootTables(generator: DataGenerator) : LootTableProvider(generator) {
.put(id, provider) == null) { "Duplicate loot pool entry for $id" } .put(id, provider) == null) { "Duplicate loot pool entry for $id" }
} }
override fun getTables(): List<LootTuple> { override fun getTables(): List<SubProviderEntry> {
return providersTable.entries.stream().map { entry -> return providersTable.entries.stream().map { entry ->
Pair.of(LootTableCallbackProvider { SubProviderEntry({
LootTableCallback { LootTableSubProvider {
for ((id, callback) in entry.value) { for ((id, callback) in entry.value) {
it.accept(id, callback.invoke()) it.accept(id, callback.invoke())
} }

View File

@ -3,12 +3,12 @@ package ru.dbotthepony.mc.otm.datagen.models
import com.google.gson.JsonArray import com.google.gson.JsonArray
import com.google.gson.JsonObject import com.google.gson.JsonObject
import com.google.gson.JsonPrimitive import com.google.gson.JsonPrimitive
import com.mojang.math.Vector3f
import net.minecraft.client.renderer.block.model.BlockModel import net.minecraft.client.renderer.block.model.BlockModel
import net.minecraft.core.Direction import net.minecraft.core.Direction
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
import net.minecraftforge.client.model.generators.ModelBuilder import net.minecraftforge.client.model.generators.ModelBuilder
import net.minecraftforge.common.data.ExistingFileHelper import net.minecraftforge.common.data.ExistingFileHelper
import org.joml.Vector3f
import ru.dbotthepony.mc.otm.container.set import ru.dbotthepony.mc.otm.container.set
import ru.dbotthepony.mc.otm.core.set import ru.dbotthepony.mc.otm.core.set

View File

@ -1,6 +1,7 @@
package ru.dbotthepony.mc.otm.datagen.recipes package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.data.recipes.FinishedRecipe import net.minecraft.data.recipes.FinishedRecipe
import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.SimpleCookingRecipeBuilder import net.minecraft.data.recipes.SimpleCookingRecipeBuilder
import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.item.crafting.Ingredient
import ru.dbotthepony.mc.otm.datagen.modLocation import ru.dbotthepony.mc.otm.datagen.modLocation
@ -9,8 +10,8 @@ import ru.dbotthepony.mc.otm.registry.MItems
import java.util.function.Consumer import java.util.function.Consumer
fun addBlastingRecipes(consumer: Consumer<FinishedRecipe>) { fun addBlastingRecipes(consumer: Consumer<FinishedRecipe>) {
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItems.MIRROR_COMPOUND), MItems.MIRROR, 0.1f, 100).unlockedBy(MItems.MIRROR_COMPOUND).save(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), MItems.TRITANIUM_INGOT, 0f, 100).unlockedBy(MItemTags.TRITANIUM_PLATES).save(consumer, modLocation("tritanium_ingot_from_plates")) 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), MItems.TRITANIUM_INGOT, 0f, 50).unlockedBy(MItemTags.TRITANIUM_PLATES).save(consumer, modLocation("tritanium_ingot_from_plates_blasting")) 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"))
} }

View File

@ -1,6 +1,7 @@
package ru.dbotthepony.mc.otm.datagen.recipes package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.data.recipes.FinishedRecipe import net.minecraft.data.recipes.FinishedRecipe
import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.ShapelessRecipeBuilder import net.minecraft.data.recipes.ShapelessRecipeBuilder
import net.minecraft.tags.ItemTags import net.minecraft.tags.ItemTags
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
@ -16,36 +17,38 @@ import ru.dbotthepony.mc.otm.datagen.modLocation
import java.util.function.Consumer import java.util.function.Consumer
fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) { fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) {
MatteryRecipe(MRegistry.CARGO_CRATES.item) val machinesCategory = RecipeCategory.DECORATIONS
MatteryRecipe(MRegistry.CARGO_CRATES.item, category = RecipeCategory.DECORATIONS)
.row(MItemTags.TRITANIUM_PLATES, Tags.Items.CHESTS, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, Tags.Items.CHESTS, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItemTags.TRITANIUM_PLATES) .unlockedBy(MItemTags.TRITANIUM_PLATES)
.unlockedBy(Tags.Items.CHESTS) .unlockedBy(Tags.Items.CHESTS)
.build(consumer) .build(consumer)
for ((dye, crate) in MRegistry.CARGO_CRATES.blocks) { for ((dye, crate) in MRegistry.CARGO_CRATES.blocks) {
ShapelessRecipeBuilder(crate, 1) ShapelessRecipeBuilder(RecipeCategory.DECORATIONS, crate, 1)
.requires(Ingredient.of(MRegistry.CARGO_CRATES.allItems.entries.stream().filter { it.key != dye }.map { ItemStack(it.value) })) .requires(Ingredient.of(MRegistry.CARGO_CRATES.allItems.entries.stream().filter { it.key != dye }.map { ItemStack(it.value) }))
.requires(dye.tag) .requires(dye.tag)
.unlockedBy(MRegistry.CARGO_CRATES.allItems.entries.stream().filter { it.key != dye }.map { it.value }) .unlockedBy(MRegistry.CARGO_CRATES.allItems.entries.stream().filter { it.key != dye }.map { it.value })
.save(consumer, "${crate.registryName}_alt") .save(consumer, "${crate.registryName}_alt")
} }
ShapelessRecipeBuilder(MItems.TRITANIUM_INGOT_BLOCK, 1) ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, MItems.TRITANIUM_INGOT_BLOCK, 1)
.requires(Ingredient.of(MItemTags.TRITANIUM_INGOTS), 9) .requires(Ingredient.of(MItemTags.TRITANIUM_INGOTS), 9)
.unlockedBy(MItemTags.TRITANIUM_INGOTS) .unlockedBy(MItemTags.TRITANIUM_INGOTS)
.save(consumer) .save(consumer)
ShapelessRecipeBuilder(MItems.TRITANIUM_INGOT, 9) ShapelessRecipeBuilder(RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 9)
.requires(Ingredient.of(MItemTags.TRITANIUM_INGOTS_STORAGE)) .requires(Ingredient.of(MItemTags.TRITANIUM_INGOTS_STORAGE))
.unlockedBy(MItemTags.TRITANIUM_INGOTS_STORAGE) .unlockedBy(MItemTags.TRITANIUM_INGOTS_STORAGE)
.save(consumer, modLocation("tritanium_ingot_from_storage")) .save(consumer, modLocation("tritanium_ingot_from_storage"))
ShapelessRecipeBuilder(MItems.ENERGY_COUNTER, 1) ShapelessRecipeBuilder(machinesCategory, MItems.ENERGY_COUNTER, 1)
.requires(MItems.ENERGY_COUNTER) .requires(MItems.ENERGY_COUNTER)
.unlockedBy(MItems.ENERGY_COUNTER) .unlockedBy(MItems.ENERGY_COUNTER)
.save(consumer, modLocation("energy_counter_reset")) .save(consumer, modLocation("energy_counter_reset"))
MatteryRecipe(MBlocks.PLATE_PRESS) MatteryRecipe(MBlocks.PLATE_PRESS, category = machinesCategory)
.row(MItems.ELECTRIC_PARTS, MItems.ENERGY_BUS, MItems.ELECTRIC_PARTS) .row(MItems.ELECTRIC_PARTS, MItems.ENERGY_BUS, MItems.ELECTRIC_PARTS)
.row(MItemTags.TRITANIUM_INGOTS, Items.BLAST_FURNACE, MItemTags.TRITANIUM_INGOTS) .row(MItemTags.TRITANIUM_INGOTS, Items.BLAST_FURNACE, MItemTags.TRITANIUM_INGOTS)
.row(MItemTags.PISTONS, MItemTags.TRITANIUM_INGOTS, MItemTags.PISTONS) .row(MItemTags.PISTONS, MItemTags.TRITANIUM_INGOTS, MItemTags.PISTONS)
@ -53,14 +56,14 @@ fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) {
.unlockedBy(MItems.ELECTRIC_PARTS) .unlockedBy(MItems.ELECTRIC_PARTS)
.build(consumer) .build(consumer)
MatteryRecipe(MBlocks.PLATE_PRESS) MatteryRecipe(MBlocks.PLATE_PRESS, category = machinesCategory)
.rowB(MItems.MACHINE_FRAME) .rowB(MItems.MACHINE_FRAME)
.rowAC(MItemTags.PISTONS, MItemTags.PISTONS) .rowAC(MItemTags.PISTONS, MItemTags.PISTONS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS) .unlockedBy(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItems.ELECTRIC_PARTS) .unlockedBy(MItems.ELECTRIC_PARTS)
.build(consumer, "advanced") .build(consumer, "advanced")
MatteryRecipe(MItems.PATTERN_DRIVE_NORMAL) MatteryRecipe(MItems.PATTERN_DRIVE_NORMAL, category = machinesCategory)
.rowAC(MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT) .rowAC(MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT)
.row(MItemTags.ADVANCED_CIRCUIT, MItemTags.TRITANIUM_PLATES, MItemTags.ADVANCED_CIRCUIT) .row(MItemTags.ADVANCED_CIRCUIT, MItemTags.TRITANIUM_PLATES, MItemTags.ADVANCED_CIRCUIT)
.rowAC(MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT) .rowAC(MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT)
@ -68,7 +71,7 @@ fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) {
.build(consumer) .build(consumer)
// Машины // Машины
MatteryRecipe(MItems.MATTER_RECYCLER) MatteryRecipe(MItems.MATTER_RECYCLER, category = machinesCategory)
.row(MItems.MATTER_CAPACITOR_PARTS, Items.HOPPER, MItemTags.BASIC_CIRCUIT) .row(MItems.MATTER_CAPACITOR_PARTS, Items.HOPPER, MItemTags.BASIC_CIRCUIT)
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
.row(MItems.MATTER_CABLE, MItems.MATTER_IO_PORT, MItems.MATTER_CABLE) .row(MItems.MATTER_CABLE, MItems.MATTER_IO_PORT, MItems.MATTER_CABLE)
@ -76,21 +79,21 @@ fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) {
.build(consumer) .build(consumer)
// Блоки // Блоки
MatteryRecipe(MItems.MATTER_CAPACITOR_BANK) MatteryRecipe(MItems.MATTER_CAPACITOR_BANK, category = machinesCategory)
.row(Tags.Items.GLASS, MItemTags.IRON_PLATES, Tags.Items.GLASS) .row(Tags.Items.GLASS, MItemTags.IRON_PLATES, Tags.Items.GLASS)
.row(MItemTags.IRON_PLATES, MItems.MACHINE_FRAME, MItemTags.IRON_PLATES) .row(MItemTags.IRON_PLATES, MItems.MACHINE_FRAME, MItemTags.IRON_PLATES)
.row(MItems.MATTER_CABLE, MItems.MATTER_IO_PORT, MItems.MATTER_CABLE) .row(MItems.MATTER_CABLE, MItems.MATTER_IO_PORT, MItems.MATTER_CABLE)
.unlockedBy(MItems.MATTER_CABLE) .unlockedBy(MItems.MATTER_CABLE)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.BATTERY_BANK) MatteryRecipe(MItems.BATTERY_BANK, category = machinesCategory)
.row(Tags.Items.GLASS, MItemTags.IRON_PLATES, Tags.Items.GLASS) .row(Tags.Items.GLASS, MItemTags.IRON_PLATES, Tags.Items.GLASS)
.row(MItemTags.IRON_PLATES, MItems.MACHINE_FRAME, MItemTags.IRON_PLATES) .row(MItemTags.IRON_PLATES, MItems.MACHINE_FRAME, MItemTags.IRON_PLATES)
.row(MItems.ELECTRIC_PARTS, MItems.ENERGY_BUS, MItems.ELECTRIC_PARTS) .row(MItems.ELECTRIC_PARTS, MItems.ENERGY_BUS, MItems.ELECTRIC_PARTS)
.unlockedBy(MItems.ENERGY_BUS) .unlockedBy(MItems.ENERGY_BUS)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.GRAVITATION_STABILIZER) MatteryRecipe(MItems.GRAVITATION_STABILIZER, category = machinesCategory)
.row(MItemTags.ADVANCED_CIRCUIT, MItems.GRAVITATION_FIELD_SENSOR, MItemTags.ADVANCED_CIRCUIT) .row(MItemTags.ADVANCED_CIRCUIT, MItems.GRAVITATION_FIELD_SENSOR, MItemTags.ADVANCED_CIRCUIT)
.row(MItems.MATTER_TRANSFORM_MATRIX, MItems.MACHINE_FRAME, MItems.MATTER_TRANSFORM_MATRIX) .row(MItems.MATTER_TRANSFORM_MATRIX, MItems.MACHINE_FRAME, MItems.MATTER_TRANSFORM_MATRIX)
.row(MItemTags.TRITANIUM_PLATES, MItems.GRAVITATION_FIELD_LIMITER, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItems.GRAVITATION_FIELD_LIMITER, MItemTags.TRITANIUM_PLATES)
@ -98,7 +101,7 @@ fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) {
.unlockedBy(MItems.GRAVITATION_FIELD_SENSOR) .unlockedBy(MItems.GRAVITATION_FIELD_SENSOR)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.PORTABLE_GRAVITATION_STABILIZER) MatteryRecipe(MItems.PORTABLE_GRAVITATION_STABILIZER, category = RecipeCategory.COMBAT)
.rowB(MItemTags.TRITANIUM_PLATES) .rowB(MItemTags.TRITANIUM_PLATES)
.row(MItemTags.TRITANIUM_PLATES, MItems.GRAVITATION_FIELD_SENSOR, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItems.GRAVITATION_FIELD_SENSOR, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.TRITANIUM_PLATES, MItems.GRAVITATION_FIELD_LIMITER, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItems.GRAVITATION_FIELD_LIMITER, MItemTags.TRITANIUM_PLATES)
@ -106,53 +109,53 @@ fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) {
.unlockedBy(MItems.GRAVITATION_FIELD_SENSOR) .unlockedBy(MItems.GRAVITATION_FIELD_SENSOR)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.GRAVITATION_FIELD_SENSOR) MatteryRecipe(MItems.GRAVITATION_FIELD_SENSOR, category = RecipeCategory.MISC)
.rowB(MItemTags.BASIC_CIRCUIT) .rowB(MItemTags.BASIC_CIRCUIT)
.row(MItemTags.TRITANIUM_PLATES, MItems.ELECTROMAGNET, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItems.ELECTROMAGNET, MItemTags.TRITANIUM_PLATES)
.rowB(MItemTags.IRON_PLATES) .rowB(MItemTags.IRON_PLATES)
.unlockedBy(MItems.ELECTROMAGNET) .unlockedBy(MItems.ELECTROMAGNET)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.GRAVITATION_FIELD_LIMITER) MatteryRecipe(MItems.GRAVITATION_FIELD_LIMITER, category = RecipeCategory.MISC)
.row(Tags.Items.ENDER_PEARLS, MItemTags.ADVANCED_CIRCUIT, Tags.Items.ENDER_PEARLS) .row(Tags.Items.ENDER_PEARLS, MItemTags.ADVANCED_CIRCUIT, Tags.Items.ENDER_PEARLS)
.row(MItemTags.GOLD_WIRES, MItems.QUANTUM_TRANSCEIVER, MItemTags.GOLD_WIRES) .row(MItemTags.GOLD_WIRES, MItems.QUANTUM_TRANSCEIVER, MItemTags.GOLD_WIRES)
.rowB(MItemTags.TRITANIUM_PLATES) .rowB(MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItems.QUANTUM_TRANSCEIVER) .unlockedBy(MItems.QUANTUM_TRANSCEIVER)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.BLACK_HOLE_SCANNER) MatteryRecipe(MItems.BLACK_HOLE_SCANNER, category = RecipeCategory.TOOLS)
.row(MItemTags.IRON_PLATES, Tags.Items.GLASS_PANES_COLORLESS, MItemTags.IRON_PLATES) .row(MItemTags.IRON_PLATES, Tags.Items.GLASS_PANES_COLORLESS, MItemTags.IRON_PLATES)
.row(MItemTags.GOLD_WIRES, MItems.GRAVITATION_FIELD_SENSOR, MItemTags.ADVANCED_CIRCUIT) .row(MItemTags.GOLD_WIRES, MItems.GRAVITATION_FIELD_SENSOR, MItemTags.ADVANCED_CIRCUIT)
.rowAC(Tags.Items.DUSTS_GLOWSTONE, MItemTags.TRITANIUM_PLATES) .rowAC(Tags.Items.DUSTS_GLOWSTONE, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItems.GRAVITATION_FIELD_SENSOR) .unlockedBy(MItems.GRAVITATION_FIELD_SENSOR)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.PHANTOM_ATTRACTOR) MatteryRecipe(MItems.PHANTOM_ATTRACTOR, category = machinesCategory)
.row(Tags.Items.DUSTS_REDSTONE, Tags.Items.GLASS_COLORLESS, Tags.Items.DUSTS_REDSTONE) .row(Tags.Items.DUSTS_REDSTONE, Tags.Items.GLASS_COLORLESS, Tags.Items.DUSTS_REDSTONE)
.row(MItemTags.TRITANIUM_PLATES, MItems.QUANTUM_TRANSCEIVER, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItems.QUANTUM_TRANSCEIVER, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.TRITANIUM_PLATES, ItemTags.BEDS, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, ItemTags.BEDS, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItems.QUANTUM_TRANSCEIVER) .unlockedBy(MItems.QUANTUM_TRANSCEIVER)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.QUANTUM_TRANSCEIVER, 2) MatteryRecipe(MItems.QUANTUM_TRANSCEIVER, 2, category = RecipeCategory.MISC)
.rowAC(MItemTags.COPPER_WIRES, MItemTags.COPPER_WIRES) .rowAC(MItemTags.COPPER_WIRES, MItemTags.COPPER_WIRES)
.row(MItemTags.GOLD_WIRES, Tags.Items.ENDER_PEARLS, MItemTags.GOLD_WIRES) .row(MItemTags.GOLD_WIRES, Tags.Items.ENDER_PEARLS, MItemTags.GOLD_WIRES)
.row(MItemTags.GOLD_WIRES, MItems.ELECTROMAGNET, MItemTags.GOLD_WIRES) .row(MItemTags.GOLD_WIRES, MItems.ELECTROMAGNET, MItemTags.GOLD_WIRES)
.unlockedBy(Tags.Items.ENDER_PEARLS) .unlockedBy(Tags.Items.ENDER_PEARLS)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.ELECTROMAGNET) MatteryRecipe(MItems.ELECTROMAGNET, category = RecipeCategory.MISC)
.row(MItemTags.COPPER_WIRES, Tags.Items.INGOTS_IRON, MItemTags.COPPER_WIRES) .row(MItemTags.COPPER_WIRES, Tags.Items.INGOTS_IRON, MItemTags.COPPER_WIRES)
.unlockedBy(Tags.Items.ENDER_PEARLS) .unlockedBy(Tags.Items.ENDER_PEARLS)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.ENERGY_SERVO) MatteryRecipe(MItems.ENERGY_SERVO, category = RecipeCategory.MISC)
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.TRITANIUM_PLATES, MItems.ENERGY_BUS, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItems.ENERGY_BUS, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItems.ENERGY_BUS) .unlockedBy(MItems.ENERGY_BUS)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.MIRROR_COMPOUND, 3) MatteryRecipe(MItems.MIRROR_COMPOUND, 3, category = RecipeCategory.MISC)
.row(Tags.Items.GLASS_PANES_COLORLESS, Tags.Items.GLASS_PANES_COLORLESS, Tags.Items.GLASS_PANES_COLORLESS) .row(Tags.Items.GLASS_PANES_COLORLESS, Tags.Items.GLASS_PANES_COLORLESS, Tags.Items.GLASS_PANES_COLORLESS)
.row(MItemTags.IRON_PLATES, MItemTags.IRON_PLATES, MItemTags.IRON_PLATES) .row(MItemTags.IRON_PLATES, MItemTags.IRON_PLATES, MItemTags.IRON_PLATES)
.unlockedBy(MItemTags.IRON_PLATES) .unlockedBy(MItemTags.IRON_PLATES)
@ -160,79 +163,79 @@ fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) {
.build(consumer) .build(consumer)
// броня // броня
MatteryRecipe(MItems.TRITANIUM_HELMET) MatteryRecipe(MItems.TRITANIUM_HELMET, category = RecipeCategory.COMBAT)
.row(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.TRITANIUM_PLATES, MItemTags.IRON_PLATES, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItemTags.IRON_PLATES, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItemTags.TRITANIUM_PLATES) .unlockedBy(MItemTags.TRITANIUM_PLATES)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.TRITANIUM_PANTS) MatteryRecipe(MItems.TRITANIUM_PANTS, category = RecipeCategory.COMBAT)
.row(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.TRITANIUM_PLATES, MItemTags.IRON_PLATES, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItemTags.IRON_PLATES, MItemTags.TRITANIUM_PLATES)
.rowAC(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES) .rowAC(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItemTags.TRITANIUM_PLATES) .unlockedBy(MItemTags.TRITANIUM_PLATES)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.TRITANIUM_CHESTPLATE) MatteryRecipe(MItems.TRITANIUM_CHESTPLATE, category = RecipeCategory.COMBAT)
.row(MItemTags.TRITANIUM_PLATES, MItemTags.IRON_PLATES, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItemTags.IRON_PLATES, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItemTags.TRITANIUM_PLATES) .unlockedBy(MItemTags.TRITANIUM_PLATES)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.TRITANIUM_BOOTS) MatteryRecipe(MItems.TRITANIUM_BOOTS, category = RecipeCategory.COMBAT)
.rowAC(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES) .rowAC(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.TRITANIUM_PLATES, MItemTags.IRON_PLATES, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItemTags.IRON_PLATES, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItemTags.TRITANIUM_PLATES) .unlockedBy(MItemTags.TRITANIUM_PLATES)
.build(consumer) .build(consumer)
// простые батарейки // простые батарейки
MatteryRecipe(MItems.BATTERY_CRUDE) MatteryRecipe(MItems.BATTERY_CRUDE, category = RecipeCategory.MISC)
.rowB(Tags.Items.DUSTS_REDSTONE) .rowB(Tags.Items.DUSTS_REDSTONE)
.rowB(Tags.Items.CROPS_POTATO) .rowB(Tags.Items.CROPS_POTATO)
.rowB(Tags.Items.INGOTS_IRON) .rowB(Tags.Items.INGOTS_IRON)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.BATTERY_BASIC) MatteryRecipe(MItems.BATTERY_BASIC, category = RecipeCategory.MISC)
.rowAC(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE) .rowAC(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE)
.rowB(MItems.ELECTRIC_PARTS) .rowB(MItems.ELECTRIC_PARTS)
.rowB(MItemTags.IRON_PLATES) .rowB(MItemTags.IRON_PLATES)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.BATTERY_NORMAL) MatteryRecipe(MItems.BATTERY_NORMAL, category = RecipeCategory.MISC)
.rowB(MItems.ELECTRIC_PARTS) .rowB(MItems.ELECTRIC_PARTS)
.row(MItemTags.COPPER_WIRES, MItemTags.IRON_PLATES, MItemTags.COPPER_WIRES) .row(MItemTags.COPPER_WIRES, MItemTags.IRON_PLATES, MItemTags.COPPER_WIRES)
.row(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE) .row(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.BATTERY_DENSE) MatteryRecipe(MItems.BATTERY_DENSE, category = RecipeCategory.MISC)
.row(Tags.Items.DUSTS_REDSTONE, MItems.ENERGY_BUS, Tags.Items.DUSTS_REDSTONE) .row(Tags.Items.DUSTS_REDSTONE, MItems.ENERGY_BUS, Tags.Items.DUSTS_REDSTONE)
.row(MItemTags.GOLD_WIRES, MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES) .row(MItemTags.GOLD_WIRES, MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES)
.row(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE) .row(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.BATTERY_CAPACITOR) MatteryRecipe(MItems.BATTERY_CAPACITOR, category = RecipeCategory.MISC)
.row(Tags.Items.DUSTS_REDSTONE, MItems.ENERGY_BUS, Tags.Items.DUSTS_REDSTONE) .row(Tags.Items.DUSTS_REDSTONE, MItems.ENERGY_BUS, Tags.Items.DUSTS_REDSTONE)
.row(MItemTags.GOLD_WIRES, MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES) .row(MItemTags.GOLD_WIRES, MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES)
.row(MItemTags.GOLD_WIRES, Tags.Items.DUSTS_REDSTONE, MItemTags.GOLD_WIRES) .row(MItemTags.GOLD_WIRES, Tags.Items.DUSTS_REDSTONE, MItemTags.GOLD_WIRES)
.build(consumer) .build(consumer)
// накопители материи // накопители материи
MatteryRecipe(MItems.MATTER_CAPACITOR_DENSE) MatteryRecipe(MItems.MATTER_CAPACITOR_DENSE, category = RecipeCategory.MISC)
.row(MItems.MATTER_CAPACITOR_PARTS, Tags.Items.GLASS, MItems.MATTER_CAPACITOR_PARTS) .row(MItems.MATTER_CAPACITOR_PARTS, Tags.Items.GLASS, MItems.MATTER_CAPACITOR_PARTS)
.row(MItemTags.TRITANIUM_PLATES, Tags.Items.ENDER_PEARLS, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, Tags.Items.ENDER_PEARLS, MItemTags.TRITANIUM_PLATES)
.rowAC(Tags.Items.GEMS_DIAMOND, Tags.Items.GEMS_DIAMOND) .rowAC(Tags.Items.GEMS_DIAMOND, Tags.Items.GEMS_DIAMOND)
.build(consumer) .build(consumer)
// станция андроида // станция андроида
MatteryRecipe(MItems.ANDROID_STATION) MatteryRecipe(MItems.ANDROID_STATION, category = machinesCategory)
.row(MItems.ELECTRIC_PARTS, MItemTags.ADVANCED_CIRCUIT, MItems.ELECTRIC_PARTS) .row(MItems.ELECTRIC_PARTS, MItemTags.ADVANCED_CIRCUIT, MItems.ELECTRIC_PARTS)
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.TRITANIUM_PLATES, MItems.ELECTRIC_PARTS, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItems.ELECTRIC_PARTS, MItemTags.TRITANIUM_PLATES)
.build(consumer) .build(consumer)
// Энерго меч // Энерго меч
MatteryRecipe(MItems.ENERGY_SWORD) MatteryRecipe(MItems.ENERGY_SWORD, category = RecipeCategory.COMBAT)
.rowBC(MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES) .rowBC(MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES)
.rowBC(MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES) .rowBC(MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES)
.row(MItems.BATTERY_CAPACITOR, MItems.TRITANIUM_SWORD, MItemTags.ADVANCED_CIRCUIT) .row(MItems.BATTERY_CAPACITOR, MItems.TRITANIUM_SWORD, MItemTags.ADVANCED_CIRCUIT)
@ -240,14 +243,14 @@ fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) {
.buildEnergetic(consumer) .buildEnergetic(consumer)
// лампа // лампа
MatteryRecipe(MItems.LABORATORY_LAMP) MatteryRecipe(MItems.LABORATORY_LAMP, category = RecipeCategory.REDSTONE)
.row(MItemTags.IRON_PLATES, MItemTags.HARDENED_GLASS_PANES_COLORLESS, MItemTags.IRON_PLATES) .row(MItemTags.IRON_PLATES, MItemTags.HARDENED_GLASS_PANES_COLORLESS, MItemTags.IRON_PLATES)
.row(MItems.MIRROR, Items.GLOWSTONE, MItems.MIRROR) .row(MItems.MIRROR, Items.GLOWSTONE, MItems.MIRROR)
.row(MItemTags.TRITANIUM_PLATES, Tags.Items.DUSTS_REDSTONE, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, Tags.Items.DUSTS_REDSTONE, MItemTags.TRITANIUM_PLATES)
.build(consumer) .build(consumer)
// апгрейд на сетку крафта // апгрейд на сетку крафта
MatteryRecipe(MItems.ExopackUpgrades.CRAFTING_UPGRADE) MatteryRecipe(MItems.ExopackUpgrades.CRAFTING_UPGRADE, category = RecipeCategory.TOOLS)
.row(MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT) .row(MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT)
.row(MItemTags.CRAFTING_TABLES, MItems.QUANTUM_TRANSCEIVER, MItemTags.CRAFTING_TABLES) .row(MItemTags.CRAFTING_TABLES, MItems.QUANTUM_TRANSCEIVER, MItemTags.CRAFTING_TABLES)
.row(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES)

View File

@ -19,7 +19,7 @@ import ru.dbotthepony.mc.otm.registry.MRegistry
import java.util.function.Consumer import java.util.function.Consumer
private fun stairs(base: ItemLike, result: ItemLike, consumer: Consumer<FinishedRecipe>) { private fun stairs(base: ItemLike, result: ItemLike, consumer: Consumer<FinishedRecipe>) {
MatteryRecipe(result, 4) MatteryRecipe(result, 4, category = RecipeCategory.BUILDING_BLOCKS)
.rowA(base) .rowA(base)
.rowAB(base, base) .rowAB(base, base)
.row(base, base, base) .row(base, base, base)
@ -28,14 +28,14 @@ private fun stairs(base: ItemLike, result: ItemLike, consumer: Consumer<Finished
} }
private fun slab(base: ItemLike, result: ItemLike, consumer: Consumer<FinishedRecipe>) { private fun slab(base: ItemLike, result: ItemLike, consumer: Consumer<FinishedRecipe>) {
MatteryRecipe(result, 6) MatteryRecipe(result, 6, category = RecipeCategory.BUILDING_BLOCKS)
.row(base, base, base) .row(base, base, base)
.unlockedBy(base) .unlockedBy(base)
.build(consumer) .build(consumer)
} }
private fun wall(base: ItemLike, result: ItemLike, consumer: Consumer<FinishedRecipe>) { private fun wall(base: ItemLike, result: ItemLike, consumer: Consumer<FinishedRecipe>) {
MatteryRecipe(result, 6) MatteryRecipe(result, 6, category = RecipeCategory.BUILDING_BLOCKS)
.row(base, base, base) .row(base, base, base)
.row(base, base, base) .row(base, base, base)
.unlockedBy(base) .unlockedBy(base)
@ -44,7 +44,7 @@ private fun wall(base: ItemLike, result: ItemLike, consumer: Consumer<FinishedRe
private fun cut(base: ItemLike, result: ItemLike, amount: Int, consumer: Consumer<FinishedRecipe>) { private fun cut(base: ItemLike, result: ItemLike, amount: Int, consumer: Consumer<FinishedRecipe>) {
SingleItemRecipeBuilder SingleItemRecipeBuilder
.stonecutting(Ingredient.of(base), result, amount) .stonecutting(Ingredient.of(base), RecipeCategory.BUILDING_BLOCKS, result, amount)
.unlockedBy(base) .unlockedBy(base)
.save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "stonecutting/${result.asItem().registryName!!.path}_from_${base.asItem().registryName!!.path}")) .save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "stonecutting/${result.asItem().registryName!!.path}_from_${base.asItem().registryName!!.path}"))
} }
@ -78,6 +78,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
for ((color, refinedItem) in MRegistry.FLOOR_TILES.items) { for ((color, refinedItem) in MRegistry.FLOOR_TILES.items) {
SimpleCookingRecipeBuilder.smelting( SimpleCookingRecipeBuilder.smelting(
Ingredient.of(MRegistry.UNREFINED_FLOOR_TILES.items[color]!!), Ingredient.of(MRegistry.UNREFINED_FLOOR_TILES.items[color]!!),
RecipeCategory.BUILDING_BLOCKS,
refinedItem, refinedItem,
0.15f, 0.15f,
100 100
@ -111,7 +112,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
val original = MRegistry.TRITANIUM_BLOCK.items[base]!! val original = MRegistry.TRITANIUM_BLOCK.items[base]!!
MatteryRecipe(item, 8) MatteryRecipe(item, 8, category = RecipeCategory.BUILDING_BLOCKS)
.row(original, original, original) .row(original, original, original)
.row(original, stripe.tag, original) .row(original, stripe.tag, original)
.row(original, original, original) .row(original, original, original)
@ -119,7 +120,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
.build(consumer) .build(consumer)
} }
MatteryRecipe(MItems.DANGER_STRIPE_BLOCK, 24) MatteryRecipe(MItems.DANGER_STRIPE_BLOCK, 24, category = RecipeCategory.BUILDING_BLOCKS)
.rowAB(Tags.Items.DYES_YELLOW, Tags.Items.INGOTS_IRON) .rowAB(Tags.Items.DYES_YELLOW, Tags.Items.INGOTS_IRON)
.row(Tags.Items.INGOTS_IRON, Tags.Items.COBBLESTONE, Tags.Items.INGOTS_IRON) .row(Tags.Items.INGOTS_IRON, Tags.Items.COBBLESTONE, Tags.Items.INGOTS_IRON)
.rowBC(Tags.Items.INGOTS_IRON, Tags.Items.DYES_BLACK) .rowBC(Tags.Items.INGOTS_IRON, Tags.Items.DYES_BLACK)
@ -127,13 +128,13 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
.unlockedBy(Tags.Items.DYES_BLACK) .unlockedBy(Tags.Items.DYES_BLACK)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.METAL_BEAM, 24) MatteryRecipe(MItems.METAL_BEAM, 24, category = RecipeCategory.BUILDING_BLOCKS)
.rowB(Tags.Items.INGOTS_IRON) .rowB(Tags.Items.INGOTS_IRON)
.row(MItemTags.TRITANIUM_INGOTS, Tags.Items.COBBLESTONE, MItemTags.TRITANIUM_INGOTS) .row(MItemTags.TRITANIUM_INGOTS, Tags.Items.COBBLESTONE, MItemTags.TRITANIUM_INGOTS)
.rowB(Tags.Items.INGOTS_IRON) .rowB(Tags.Items.INGOTS_IRON)
.build(consumer) .build(consumer)
MatteryRecipe(MRegistry.VENT.item, 24) MatteryRecipe(MRegistry.VENT.item, 24, category = RecipeCategory.BUILDING_BLOCKS)
.rowB(MItemTags.TRITANIUM_INGOTS) .rowB(MItemTags.TRITANIUM_INGOTS)
.row(MItemTags.TRITANIUM_INGOTS, Items.IRON_BARS, MItemTags.TRITANIUM_INGOTS) .row(MItemTags.TRITANIUM_INGOTS, Items.IRON_BARS, MItemTags.TRITANIUM_INGOTS)
.rowB(MItemTags.TRITANIUM_INGOTS) .rowB(MItemTags.TRITANIUM_INGOTS)
@ -141,7 +142,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
.build(consumer) .build(consumer)
for ((color, item) in MRegistry.VENT.items) { for ((color, item) in MRegistry.VENT.items) {
MatteryRecipe(item, 8) MatteryRecipe(item, 8, category = RecipeCategory.BUILDING_BLOCKS)
.row(MRegistry.VENT.item, MRegistry.VENT.item, MRegistry.VENT.item) .row(MRegistry.VENT.item, MRegistry.VENT.item, MRegistry.VENT.item)
.row(MRegistry.VENT.item, color.tag, MRegistry.VENT.item) .row(MRegistry.VENT.item, color.tag, MRegistry.VENT.item)
.row(MRegistry.VENT.item, MRegistry.VENT.item, MRegistry.VENT.item) .row(MRegistry.VENT.item, MRegistry.VENT.item, MRegistry.VENT.item)
@ -152,12 +153,12 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
for ((color, item) in MRegistry.VENT_ALTERNATIVE.allItems) { for ((color, item) in MRegistry.VENT_ALTERNATIVE.allItems) {
val other = MRegistry.VENT.allItems[color]!! val other = MRegistry.VENT.allItems[color]!!
ShapelessRecipeBuilder(item, 1).requires(other).unlockedBy(item).save(consumer) ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, item, 1).requires(other).unlockedBy(item).save(consumer)
ShapelessRecipeBuilder(other, 1).requires(item).unlockedBy(other).save(consumer, ResourceLocation( ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, other, 1).requires(item).unlockedBy(other).save(consumer, ResourceLocation(
OverdriveThatMatters.MOD_ID, "${other.registryName!!.path}_from_alt")) OverdriveThatMatters.MOD_ID, "${other.registryName!!.path}_from_alt"))
} }
MatteryRecipe(MRegistry.DECORATIVE_CRATE.item, 24) MatteryRecipe(MRegistry.DECORATIVE_CRATE.item, 24, category = RecipeCategory.BUILDING_BLOCKS)
.rowB(Tags.Items.INGOTS_IRON) .rowB(Tags.Items.INGOTS_IRON)
.row(Tags.Items.INGOTS_IRON, Tags.Items.COBBLESTONE, Tags.Items.INGOTS_IRON) .row(Tags.Items.INGOTS_IRON, Tags.Items.COBBLESTONE, Tags.Items.INGOTS_IRON)
.rowB(Tags.Items.INGOTS_IRON) .rowB(Tags.Items.INGOTS_IRON)
@ -165,7 +166,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
.build(consumer) .build(consumer)
for ((color, crate) in MRegistry.DECORATIVE_CRATE.items) { for ((color, crate) in MRegistry.DECORATIVE_CRATE.items) {
MatteryRecipe(crate, 8) MatteryRecipe(crate, 8, category = RecipeCategory.BUILDING_BLOCKS)
.row(MRegistry.DECORATIVE_CRATE.item, MRegistry.DECORATIVE_CRATE.item, MRegistry.DECORATIVE_CRATE.item) .row(MRegistry.DECORATIVE_CRATE.item, MRegistry.DECORATIVE_CRATE.item, MRegistry.DECORATIVE_CRATE.item)
.row(MRegistry.DECORATIVE_CRATE.item, color.tag, MRegistry.DECORATIVE_CRATE.item) .row(MRegistry.DECORATIVE_CRATE.item, color.tag, MRegistry.DECORATIVE_CRATE.item)
.row(MRegistry.DECORATIVE_CRATE.item, MRegistry.DECORATIVE_CRATE.item, MRegistry.DECORATIVE_CRATE.item) .row(MRegistry.DECORATIVE_CRATE.item, MRegistry.DECORATIVE_CRATE.item, MRegistry.DECORATIVE_CRATE.item)
@ -174,7 +175,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
} }
for ((color, item) in MRegistry.TRITANIUM_BLOCK.items) { for ((color, item) in MRegistry.TRITANIUM_BLOCK.items) {
MatteryRecipe(item, 8) MatteryRecipe(item, 8, category = RecipeCategory.BUILDING_BLOCKS)
.row(MRegistry.TRITANIUM_BLOCK.item, MRegistry.TRITANIUM_BLOCK.item, MRegistry.TRITANIUM_BLOCK.item) .row(MRegistry.TRITANIUM_BLOCK.item, MRegistry.TRITANIUM_BLOCK.item, MRegistry.TRITANIUM_BLOCK.item)
.row(MRegistry.TRITANIUM_BLOCK.item, color.tag, MRegistry.TRITANIUM_BLOCK.item) .row(MRegistry.TRITANIUM_BLOCK.item, color.tag, MRegistry.TRITANIUM_BLOCK.item)
.row(MRegistry.TRITANIUM_BLOCK.item, MRegistry.TRITANIUM_BLOCK.item, MRegistry.TRITANIUM_BLOCK.item) .row(MRegistry.TRITANIUM_BLOCK.item, MRegistry.TRITANIUM_BLOCK.item, MRegistry.TRITANIUM_BLOCK.item)
@ -183,14 +184,14 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
.build(consumer) .build(consumer)
} }
ShapelessRecipeBuilder(MRegistry.INDUSTRIAL_GLASS.item, 8) ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, MRegistry.INDUSTRIAL_GLASS.item, 8)
.requires(Items.GLASS, 8) .requires(Items.GLASS, 8)
.requires(MItemTags.TRITANIUM_PLATES) .requires(MItemTags.TRITANIUM_PLATES)
.unlockedBy("has_plate", has(MItemTags.TRITANIUM_PLATES)) .unlockedBy("has_plate", has(MItemTags.TRITANIUM_PLATES))
.unlockedBy("has_glass", has(Items.GLASS)) .unlockedBy("has_glass", has(Items.GLASS))
.save(consumer) .save(consumer)
ShapedRecipeBuilder(MRegistry.INDUSTRIAL_GLASS_PANE.item, 16) ShapedRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, MRegistry.INDUSTRIAL_GLASS_PANE.item, 16)
.define('#', MRegistry.INDUSTRIAL_GLASS.item) .define('#', MRegistry.INDUSTRIAL_GLASS.item)
.pattern("###").pattern("###") .pattern("###").pattern("###")
.unlockedBy("has_tritanium_glass", has(MRegistry.INDUSTRIAL_GLASS.item)) .unlockedBy("has_tritanium_glass", has(MRegistry.INDUSTRIAL_GLASS.item))
@ -221,44 +222,44 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
val mappedVanilla = mappingUpgradeVanilla[color]!! val mappedVanilla = mappingUpgradeVanilla[color]!!
// обычная покраска // обычная покраска
ShapelessRecipeBuilder(item, 8) ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, item, 8)
.requires(MRegistry.INDUSTRIAL_GLASS.item, 8) .requires(MRegistry.INDUSTRIAL_GLASS.item, 8)
.requires(color.tag) .requires(color.tag)
.unlockedBy("has_tritanium_glass", has(MRegistry.INDUSTRIAL_GLASS.item)) .unlockedBy("has_tritanium_glass", has(MRegistry.INDUSTRIAL_GLASS.item))
.save(consumer) .save(consumer)
// апгрейд ванильного крашенного стекла // апгрейд ванильного крашенного стекла
ShapelessRecipeBuilder(item, 8) ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, item, 8)
.requires(mappedVanilla, 8) .requires(mappedVanilla, 8)
.requires(MItemTags.TRITANIUM_PLATES) .requires(MItemTags.TRITANIUM_PLATES)
.unlockedBy("has_plate", has(MItemTags.TRITANIUM_PLATES)) .unlockedBy("has_plate", has(MItemTags.TRITANIUM_PLATES))
.unlockedBy("has_colored_glass", has(mappedVanilla)) .unlockedBy("has_colored_glass", has(mappedVanilla))
.save(consumer, ResourceLocation(DataGen.MOD_ID, "${item.registryName!!.path}_upgrade")) .save(consumer, ResourceLocation(DataGen.MOD_ID, "${item.registryName!!.path}_upgrade"))
ShapelessRecipeBuilder(paneItem, 8) ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, paneItem, 8)
.requires(MRegistry.INDUSTRIAL_GLASS_PANE.item, 8) .requires(MRegistry.INDUSTRIAL_GLASS_PANE.item, 8)
.requires(color.tag) .requires(color.tag)
.unlockedBy("has_tritanium_glass_pane", has(MRegistry.INDUSTRIAL_GLASS_PANE.item)) .unlockedBy("has_tritanium_glass_pane", has(MRegistry.INDUSTRIAL_GLASS_PANE.item))
.save(consumer) .save(consumer)
ShapedRecipeBuilder(paneItem, 16) ShapedRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, paneItem, 16)
.define('#', item) .define('#', item)
.pattern("###").pattern("###") .pattern("###").pattern("###")
.unlockedBy("has_colored_tritanium_glass", has(paneItem)) .unlockedBy("has_colored_tritanium_glass", has(paneItem))
.save(consumer, ResourceLocation(DataGen.MOD_ID, "${paneItem.registryName!!.path}_alt")) .save(consumer, ResourceLocation(DataGen.MOD_ID, "${paneItem.registryName!!.path}_alt"))
} }
ShapelessRecipeBuilder(MItems.LABORATORY_LAMP, 1) ShapelessRecipeBuilder(RecipeCategory.REDSTONE, MItems.LABORATORY_LAMP, 1)
.requires(MItems.LABORATORY_LAMP_INVERTED) .requires(MItems.LABORATORY_LAMP_INVERTED)
.unlockedBy(MItems.LABORATORY_LAMP_INVERTED) .unlockedBy(MItems.LABORATORY_LAMP_INVERTED)
.save(consumer, MItems.LABORATORY_LAMP.registryName!!.toString() + "_inv") .save(consumer, MItems.LABORATORY_LAMP.registryName!!.toString() + "_inv")
ShapelessRecipeBuilder(MItems.LABORATORY_LAMP_INVERTED, 1) ShapelessRecipeBuilder(RecipeCategory.REDSTONE, MItems.LABORATORY_LAMP_INVERTED, 1)
.requires(MItems.LABORATORY_LAMP) .requires(MItems.LABORATORY_LAMP)
.unlockedBy(MItems.LABORATORY_LAMP) .unlockedBy(MItems.LABORATORY_LAMP)
.save(consumer, MItems.LABORATORY_LAMP_INVERTED.registryName!!.toString() + "_inv") .save(consumer, MItems.LABORATORY_LAMP_INVERTED.registryName!!.toString() + "_inv")
MatteryRecipe(MBlocks.TRITANIUM_STRIPED_BLOCK, 24) MatteryRecipe(MBlocks.TRITANIUM_STRIPED_BLOCK, 24, category = RecipeCategory.BUILDING_BLOCKS)
.rowB(MItemTags.TRITANIUM_INGOTS) .rowB(MItemTags.TRITANIUM_INGOTS)
.row(MItemTags.TRITANIUM_INGOTS, Tags.Items.COBBLESTONE, MItemTags.TRITANIUM_INGOTS) .row(MItemTags.TRITANIUM_INGOTS, Tags.Items.COBBLESTONE, MItemTags.TRITANIUM_INGOTS)
.rowAB(Tags.Items.DYES_YELLOW, MItemTags.TRITANIUM_INGOTS) .rowAB(Tags.Items.DYES_YELLOW, MItemTags.TRITANIUM_INGOTS)
@ -266,14 +267,14 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
.unlockedBy(Tags.Items.DYES_YELLOW) .unlockedBy(Tags.Items.DYES_YELLOW)
.build(consumer) .build(consumer)
MatteryRecipe(MRegistry.TRITANIUM_BLOCK.item, 24) MatteryRecipe(MRegistry.TRITANIUM_BLOCK.item, 24, category = RecipeCategory.BUILDING_BLOCKS)
.rowB(MItemTags.TRITANIUM_INGOTS) .rowB(MItemTags.TRITANIUM_INGOTS)
.row(MItemTags.TRITANIUM_INGOTS, Tags.Items.COBBLESTONE, MItemTags.TRITANIUM_INGOTS) .row(MItemTags.TRITANIUM_INGOTS, Tags.Items.COBBLESTONE, MItemTags.TRITANIUM_INGOTS)
.rowB(MItemTags.TRITANIUM_INGOTS) .rowB(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS) .unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer) .build(consumer)
MatteryRecipe(MBlocks.TRITANIUM_DOOR[null]!!, 3) MatteryRecipe(MBlocks.TRITANIUM_DOOR[null]!!, 3, category = RecipeCategory.REDSTONE)
.rowAB(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS) .rowAB(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.rowAB(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS) .rowAB(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.rowAB(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS) .rowAB(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
@ -281,34 +282,34 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
.build(consumer) .build(consumer)
for (color in DyeColor.values()) { for (color in DyeColor.values()) {
ShapelessRecipeBuilder.shapeless(MItems.TRITANIUM_DOOR[color]!!, 1) ShapelessRecipeBuilder.shapeless(RecipeCategory.REDSTONE, MItems.TRITANIUM_DOOR[color]!!, 1)
.requires(Ingredient.of(MItems.TRITANIUM_DOOR.entries.stream().filter { it.key != color }.map { ItemStack(it.value) })) .requires(Ingredient.of(MItems.TRITANIUM_DOOR.entries.stream().filter { it.key != color }.map { ItemStack(it.value) }))
.requires(color.tag) .requires(color.tag)
.unlockedBy(MItems.TRITANIUM_DOOR.entries.stream().filter { it.key != color }.map { it.value }) .unlockedBy(MItems.TRITANIUM_DOOR.entries.stream().filter { it.key != color }.map { it.value })
.save(consumer) .save(consumer)
} }
MatteryRecipe(MBlocks.TRITANIUM_TRAPDOOR[null]!!) MatteryRecipe(MBlocks.TRITANIUM_TRAPDOOR[null]!!, category = RecipeCategory.REDSTONE)
.rowAB(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS) .rowAB(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.rowAB(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS) .rowAB(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS) .unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer) .build(consumer)
for (color in DyeColor.values()) { for (color in DyeColor.values()) {
ShapelessRecipeBuilder.shapeless(MItems.TRITANIUM_TRAPDOOR[color]!!, 1) ShapelessRecipeBuilder.shapeless(RecipeCategory.REDSTONE, MItems.TRITANIUM_TRAPDOOR[color]!!, 1)
.requires(Ingredient.of(MItems.TRITANIUM_TRAPDOOR.entries.stream().filter { it.key != color }.map { ItemStack(it.value) })) .requires(Ingredient.of(MItems.TRITANIUM_TRAPDOOR.entries.stream().filter { it.key != color }.map { ItemStack(it.value) }))
.requires(color.tag) .requires(color.tag)
.unlockedBy(MItems.TRITANIUM_TRAPDOOR.entries.stream().filter { it.key != color }.map { it.value }) .unlockedBy(MItems.TRITANIUM_TRAPDOOR.entries.stream().filter { it.key != color }.map { it.value })
.save(consumer) .save(consumer)
} }
MatteryRecipe(MRegistry.TRITANIUM_PRESSURE_PLATE.item) MatteryRecipe(MRegistry.TRITANIUM_PRESSURE_PLATE.item, category = RecipeCategory.REDSTONE)
.row(MItemTags.TRITANIUM_PLATES, MItemTags.BASIC_CIRCUIT, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItemTags.BASIC_CIRCUIT, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItemTags.TRITANIUM_PLATES) .unlockedBy(MItemTags.TRITANIUM_PLATES)
.build(consumer) .build(consumer)
for (dye in DyeColor.values()) { for (dye in DyeColor.values()) {
ShapelessRecipeBuilder(MRegistry.TRITANIUM_PRESSURE_PLATE.getItem(dye), 1) ShapelessRecipeBuilder(RecipeCategory.REDSTONE, MRegistry.TRITANIUM_PRESSURE_PLATE.getItem(dye), 1)
.requires(Ingredient.of(MRegistry.TRITANIUM_PRESSURE_PLATE.allItems.entries.stream().filter { it.key != dye }.map { ItemStack(it.value) })) .requires(Ingredient.of(MRegistry.TRITANIUM_PRESSURE_PLATE.allItems.entries.stream().filter { it.key != dye }.map { ItemStack(it.value) }))
.requires(dye.tag) .requires(dye.tag)
.unlockedBy(MItemTags.TRITANIUM_PLATES) .unlockedBy(MItemTags.TRITANIUM_PLATES)

View File

@ -5,6 +5,7 @@ import com.google.common.collect.ImmutableList
import net.minecraft.advancements.CriterionTriggerInstance import net.minecraft.advancements.CriterionTriggerInstance
import net.minecraft.data.recipes.FinishedRecipe import net.minecraft.data.recipes.FinishedRecipe
import net.minecraft.data.recipes.RecipeBuilder import net.minecraft.data.recipes.RecipeBuilder
import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.ShapedRecipeBuilder import net.minecraft.data.recipes.ShapedRecipeBuilder
import net.minecraft.data.recipes.ShapelessRecipeBuilder import net.minecraft.data.recipes.ShapelessRecipeBuilder
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
@ -55,7 +56,7 @@ private data class RecipeRow(
* [ShapedRecipeBuilder] that doesn't suck * [ShapedRecipeBuilder] that doesn't suck
*/ */
@Suppress("unused") @Suppress("unused")
class MatteryRecipe(val result: ItemLike, val count: Int = 1) { class MatteryRecipe(val result: ItemLike, val count: Int = 1, val category: RecipeCategory = RecipeCategory.MISC) {
private val rows = arrayOfNulls<RecipeRow>(3) private val rows = arrayOfNulls<RecipeRow>(3)
private var index = 0 private var index = 0
@ -120,7 +121,7 @@ class MatteryRecipe(val result: ItemLike, val count: Int = 1) {
throw NoSuchElementException("No recipe rows were defined") throw NoSuchElementException("No recipe rows were defined")
} }
val builder = ShapedRecipeBuilder(result, count) val builder = ShapedRecipeBuilder(category, result, count)
val pairs = ArrayList<Pair<Char, RecipeCell>>() val pairs = ArrayList<Pair<Char, RecipeCell>>()
val iterator = charlist.iterator() val iterator = charlist.iterator()

View File

@ -63,7 +63,7 @@ fun <T : RecipeBuilder> T.unlockedBy(item: TagKey<Item>): T {
return this return this
} }
class MatteryRecipeProvider(generatorIn: DataGenerator) : RecipeProvider(generatorIn) { class MatteryRecipeProvider(generatorIn: DataGenerator) : RecipeProvider(generatorIn.packOutput) {
private val callbacks = LinkedList<RecipeBuilderCallback>() private val callbacks = LinkedList<RecipeBuilderCallback>()
fun exec(callback: RecipeBuilderCallback): MatteryRecipeProvider { fun exec(callback: RecipeBuilderCallback): MatteryRecipeProvider {
@ -71,7 +71,7 @@ class MatteryRecipeProvider(generatorIn: DataGenerator) : RecipeProvider(generat
return this return this
} }
override fun buildCraftingRecipes(callback: Consumer<FinishedRecipe>) { override fun buildRecipes(callback: Consumer<FinishedRecipe>) {
for (lambda in callbacks) { for (lambda in callbacks) {
lambda(this, callback) lambda(this, callback)
} }

View File

@ -1,6 +1,7 @@
package ru.dbotthepony.mc.otm.datagen.recipes package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.data.recipes.FinishedRecipe import net.minecraft.data.recipes.FinishedRecipe
import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.SimpleCookingRecipeBuilder import net.minecraft.data.recipes.SimpleCookingRecipeBuilder
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.item.crafting.Ingredient
@ -10,12 +11,12 @@ import ru.dbotthepony.mc.otm.registry.MItems
import java.util.function.Consumer import java.util.function.Consumer
fun addOreSmeltingRecipes(consumer: Consumer<FinishedRecipe>) { fun addOreSmeltingRecipes(consumer: Consumer<FinishedRecipe>) {
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_ORES), MItems.TRITANIUM_INGOT, 1f, 100).unlockedBy(MItemTags.TRITANIUM_ORES).save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "smelting/tritanium_ingot_from_ore_block")) SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_ORES), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 100).unlockedBy(MItemTags.TRITANIUM_ORES).save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "smelting/tritanium_ingot_from_ore_block"))
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_ORES), MItems.TRITANIUM_INGOT, 1f, 200).unlockedBy(MItemTags.TRITANIUM_ORES).save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "blasting/tritanium_ingot_from_ore_block")) SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_ORES), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 200).unlockedBy(MItemTags.TRITANIUM_ORES).save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "blasting/tritanium_ingot_from_ore_block"))
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_ORE_CLUMPS), MItems.TRITANIUM_INGOT, 1f, 100).unlockedBy(MItemTags.TRITANIUM_ORE_CLUMPS).save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "smelting/tritanium_ingot_from_raw_ore")) SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_ORE_CLUMPS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 100).unlockedBy(MItemTags.TRITANIUM_ORE_CLUMPS).save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "smelting/tritanium_ingot_from_raw_ore"))
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_ORE_CLUMPS), MItems.TRITANIUM_INGOT, 1f, 200).unlockedBy(MItemTags.TRITANIUM_ORE_CLUMPS).save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "blasting/tritanium_ingot_from_raw_ore")) SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_ORE_CLUMPS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 200).unlockedBy(MItemTags.TRITANIUM_ORE_CLUMPS).save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "blasting/tritanium_ingot_from_raw_ore"))
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_DUSTS), MItems.TRITANIUM_INGOT, 0f, 100).unlockedBy(MItemTags.TRITANIUM_DUSTS).save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "smelting/tritanium_ingot_from_dust")) SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_DUSTS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 0f, 100).unlockedBy(MItemTags.TRITANIUM_DUSTS).save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "smelting/tritanium_ingot_from_dust"))
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_DUSTS), MItems.TRITANIUM_INGOT, 0f, 200).unlockedBy(MItemTags.TRITANIUM_DUSTS).save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "blasting/tritanium_ingot_from_dust")) SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_DUSTS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 0f, 200).unlockedBy(MItemTags.TRITANIUM_DUSTS).save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "blasting/tritanium_ingot_from_dust"))
} }

View File

@ -1,6 +1,7 @@
package ru.dbotthepony.mc.otm.datagen.recipes package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.data.recipes.FinishedRecipe import net.minecraft.data.recipes.FinishedRecipe
import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.ShapelessRecipeBuilder import net.minecraft.data.recipes.ShapelessRecipeBuilder
import net.minecraft.world.item.DyeColor import net.minecraft.world.item.DyeColor
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
@ -15,21 +16,21 @@ import java.util.function.Consumer
fun addShapelessRecipes(consumer: Consumer<FinishedRecipe>) { fun addShapelessRecipes(consumer: Consumer<FinishedRecipe>) {
for (color in DyeColor.values()) { for (color in DyeColor.values()) {
ShapelessRecipeBuilder(MItems.CARGO_CRATE_MINECARTS[color]!!, 1) ShapelessRecipeBuilder(RecipeCategory.TRANSPORTATION, MItems.CARGO_CRATE_MINECARTS[color]!!, 1)
.requires(Items.MINECART) .requires(Items.MINECART)
.requires(MRegistry.CARGO_CRATES.items[color]!!) .requires(MRegistry.CARGO_CRATES.items[color]!!)
.unlockedBy(Items.MINECART) .unlockedBy(Items.MINECART)
.unlockedBy(MRegistry.CARGO_CRATES.items[color]!!) .unlockedBy(MRegistry.CARGO_CRATES.items[color]!!)
.save(consumer) .save(consumer)
ShapelessRecipeBuilder(MItems.CARGO_CRATE_MINECARTS[color]!!, 1) ShapelessRecipeBuilder(RecipeCategory.TRANSPORTATION, MItems.CARGO_CRATE_MINECARTS[color]!!, 1)
.requires(Ingredient.of(MItems.CARGO_CRATE_MINECARTS.entries.stream().filter { it.key != color }.map { ItemStack(it.value) })) .requires(Ingredient.of(MItems.CARGO_CRATE_MINECARTS.entries.stream().filter { it.key != color }.map { ItemStack(it.value) }))
.requires(color.tag) .requires(color.tag)
.unlockedBy(MItems.CARGO_CRATE_MINECARTS.entries.stream().filter { it.key != color }.map { it.value }) .unlockedBy(MItems.CARGO_CRATE_MINECARTS.entries.stream().filter { it.key != color }.map { it.value })
.save(consumer, modLocation(MItems.CARGO_CRATE_MINECARTS[color]!!.registryName!!.path + "_alt")) .save(consumer, modLocation(MItems.CARGO_CRATE_MINECARTS[color]!!.registryName!!.path + "_alt"))
} }
ShapelessRecipeBuilder(MItems.CARGO_CRATE_MINECARTS[null]!!, 1) ShapelessRecipeBuilder(RecipeCategory.TRANSPORTATION, MItems.CARGO_CRATE_MINECARTS[null]!!, 1)
.requires(Items.MINECART) .requires(Items.MINECART)
.requires(MRegistry.CARGO_CRATES.item) .requires(MRegistry.CARGO_CRATES.item)
.unlockedBy(Items.MINECART) .unlockedBy(Items.MINECART)

View File

@ -1,7 +1,11 @@
package ru.dbotthepony.mc.otm.datagen.tags package ru.dbotthepony.mc.otm.datagen.tags
import it.unimi.dsi.fastutil.objects.ObjectArraySet import it.unimi.dsi.fastutil.objects.ObjectArraySet
import net.minecraft.core.HolderLookup
import net.minecraft.core.Registry import net.minecraft.core.Registry
import net.minecraft.core.registries.BuiltInRegistries
import net.minecraft.core.registries.Registries
import net.minecraft.resources.ResourceKey
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
import net.minecraft.tags.BlockTags import net.minecraft.tags.BlockTags
import net.minecraft.tags.GameEventTags import net.minecraft.tags.GameEventTags
@ -11,6 +15,7 @@ import net.minecraft.world.item.Tier
import net.minecraft.world.item.Tiers import net.minecraft.world.item.Tiers
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
import net.minecraftforge.data.event.GatherDataEvent import net.minecraftforge.data.event.GatherDataEvent
import net.minecraftforge.registries.ForgeRegistries
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.datagen.DataGen
import java.util.stream.Stream import java.util.stream.Stream
@ -58,22 +63,24 @@ interface ForgeTagAppender<T> : MTagAppender<T> {
class TagsProvider( class TagsProvider(
private val event: GatherDataEvent private val event: GatherDataEvent
) { ) {
inner class Delegate<T>(registry: Registry<T>) : MinecraftTagsProvider<T>(event.generator, registry, DataGen.MOD_ID, event.existingFileHelper) { inner class Delegate<T>(registry: ResourceKey<Registry<T>>) : MinecraftTagsProvider<T>(event.generator.packOutput, registry, event.lookupProvider, DataGen.MOD_ID, event.existingFileHelper) {
init { init {
event.generator.addProvider(true, this) event.generator.addProvider(true, this)
} }
private val tags = HashMap<TagKey<T>, ObjectArraySet<T>>() private val tags = HashMap<TagKey<T>, ObjectArraySet<T>>()
override fun addTags() { override fun addTags(provider: HolderLookup.Provider) {
if (tags.isEmpty()) { if (tags.isEmpty()) {
return return
} }
val registry = (BuiltInRegistries.REGISTRY.get(registryKey.location()) ?: throw NoSuchElementException("No such registry $registryKey")) as Registry<T>
for ((tag, values) in tags) { for ((tag, values) in tags) {
tag(tag).also { tag(tag).also {
for (value in values) { for (value in values) {
it.add(value) it.add(ResourceKey.create(registryKey, registry.getKey(value) ?: throw NoSuchElementException("$value is missing from $registry")))
} }
} }
} }
@ -83,7 +90,7 @@ class TagsProvider(
return tags.computeIfAbsent(tag) { ObjectArraySet() } return tags.computeIfAbsent(tag) { ObjectArraySet() }
} }
fun getSet(location: ResourceLocation) = getSet(TagKey.create(registry.key(), location)) fun getSet(location: ResourceLocation) = getSet(TagKey.create(registryKey, location))
fun appender(tag: TagKey<T>, message: ((T) -> Any) = { "$it is already in $tag" }): MTagAppender<T> { fun appender(tag: TagKey<T>, message: ((T) -> Any) = { "$it is already in $tag" }): MTagAppender<T> {
val list = getSet(tag) val list = getSet(tag)
@ -118,7 +125,7 @@ class TagsProvider(
return object : ForgeTagAppender<T> { return object : ForgeTagAppender<T> {
override fun add(key: String, value: T): MTagAppender<T> { override fun add(key: String, value: T): MTagAppender<T> {
val tag = TagKey.create(registry.key(), ResourceLocation("forge", "$path/$key")) val tag = TagKey.create(registryKey, ResourceLocation("forge", "$path/$key"))
if (!getSet(tag).add(value)) { if (!getSet(tag).add(value)) {
throw IllegalStateException("$value is already in $tag") throw IllegalStateException("$value is already in $tag")
@ -128,7 +135,7 @@ class TagsProvider(
} }
override fun addSafe(key: String, value: T): Boolean { override fun addSafe(key: String, value: T): Boolean {
val tag = TagKey.create(registry.key(), ResourceLocation("forge", "$path/$key")) val tag = TagKey.create(registryKey, ResourceLocation("forge", "$path/$key"))
return getSet(tag).add(value) return getSet(tag).add(value)
} }
@ -161,17 +168,17 @@ class TagsProvider(
} }
fun appender(location: ResourceLocation): MTagAppender<T> { fun appender(location: ResourceLocation): MTagAppender<T> {
return appender(TagKey.create(registry.key(), location)) return appender(TagKey.create(registryKey, location))
} }
fun appender(location: ResourceLocation, message: (T) -> Any): MTagAppender<T> { fun appender(location: ResourceLocation, message: (T) -> Any): MTagAppender<T> {
return appender(TagKey.create(registry.key(), location), message) return appender(TagKey.create(registryKey, location), message)
} }
} }
val blocks = Delegate(Registry.BLOCK) val blocks = Delegate(Registries.BLOCK)
val items = Delegate(Registry.ITEM) val items = Delegate(Registries.ITEM)
val mobEffects = Delegate(Registry.MOB_EFFECT) val mobEffects = Delegate(Registries.MOB_EFFECT)
val androidImmuneEffects = mobEffects.appender(MatteryPlayerCapability.ANDROID_IMMUNE_EFFECTS) val androidImmuneEffects = mobEffects.appender(MatteryPlayerCapability.ANDROID_IMMUNE_EFFECTS)
@ -189,8 +196,8 @@ class TagsProvider(
fun ore(key: String, block: Block): TagsProvider { fun ore(key: String, block: Block): TagsProvider {
val forgeKey = ResourceLocation("forge", "ores/$key") val forgeKey = ResourceLocation("forge", "ores/$key")
val b = TagKey.create(Registry.BLOCK_REGISTRY, forgeKey) val b = TagKey.create(Registries.BLOCK, forgeKey)
val i = TagKey.create(Registry.ITEM_REGISTRY, forgeKey) val i = TagKey.create(Registries.ITEM, forgeKey)
items.getSet(i).add(block.asItem()) items.getSet(i).add(block.asItem())
itemOres.add(block.asItem()) itemOres.add(block.asItem())
@ -230,7 +237,7 @@ class TagsProvider(
val rawMaterials = items.forge("raw_materials") val rawMaterials = items.forge("raw_materials")
val wires = items.forge("wires") val wires = items.forge("wires")
val gameEvents = Delegate(Registry.GAME_EVENT) val gameEvents = Delegate(Registries.GAME_EVENT)
val vibrations = gameEvents.appender(GameEventTags.VIBRATIONS) val vibrations = gameEvents.appender(GameEventTags.VIBRATIONS)
fun requiresPickaxe(block: Block, tier: Tier? = null): TagsProvider { fun requiresPickaxe(block: Block, tier: Tier? = null): TagsProvider {