Structurize decorative recipes

This commit is contained in:
DBotThePony 2023-03-24 23:53:51 +07:00
parent d2da3535c1
commit 013fc649b2
Signed by: DBot
GPG Key ID: DCC23B5715498507
3 changed files with 51 additions and 41 deletions

View File

@ -55,7 +55,7 @@ import ru.dbotthepony.mc.otm.registry.objects.ColoredDecorativeBlock
import ru.dbotthepony.mc.otm.registry.objects.DecorativeBlock
import kotlin.properties.Delegates
fun modLocation(string: String) = ResourceLocation(DataGen.MOD_ID, string)
internal fun modLocation(string: String) = ResourceLocation(DataGen.MOD_ID, string)
@Mod.EventBusSubscriber(modid = DataGen.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
object DataGen {

View File

@ -25,14 +25,14 @@ private fun stairs(base: ItemLike, result: ItemLike, consumer: Consumer<Finished
.rowAB(base, base)
.row(base, base, base)
.unlockedBy(base)
.build(consumer)
.build(consumer, modLocation("decorative/stairs/${base.asItem().registryName!!.path}"))
}
private fun slab(base: ItemLike, result: ItemLike, consumer: Consumer<FinishedRecipe>) {
MatteryRecipe(result, 6, category = RecipeCategory.BUILDING_BLOCKS)
.row(base, base, base)
.unlockedBy(base)
.build(consumer)
.build(consumer, modLocation("decorative/slabs/${base.asItem().registryName!!.path}"))
}
private fun wall(base: ItemLike, result: ItemLike, consumer: Consumer<FinishedRecipe>) {
@ -40,7 +40,7 @@ private fun wall(base: ItemLike, result: ItemLike, consumer: Consumer<FinishedRe
.row(base, base, base)
.row(base, base, base)
.unlockedBy(base)
.build(consumer)
.build(consumer, modLocation("decorative/walls/${base.asItem().registryName!!.path}"))
}
private fun cut(base: ItemLike, result: ItemLike, amount: Int, consumer: Consumer<FinishedRecipe>) {
@ -73,14 +73,14 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
.row(Items.SAND, color.tag, Items.SAND)
.row(Items.CLAY, Items.SAND, Items.CLAY)
.unlockedBy(Items.CLAY)
.build(consumer)
.build(consumer, modLocation("decorative/floor_tiles/unrefined/${color.name.lowercase()}"))
if (color != DyeColor.WHITE)
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, unrefinedItem, 8)
.requires(Ingredient.of(MRegistry.UNREFINED_FLOOR_TILES.getItem(DyeColor.WHITE)), 8)
.requires(color.tag)
.unlockedBy(MRegistry.UNREFINED_FLOOR_TILES.getItem(DyeColor.WHITE))
.save(consumer, modLocation("white_tiles_unrefined/${unrefinedItem.registryName!!.path}"))
.save(consumer, modLocation("decorative/floor_tiles/unrefined/recolor/${unrefinedItem.registryName!!.path}"))
}
for ((color, refinedItem) in MRegistry.FLOOR_TILES.items) {
@ -90,14 +90,15 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
refinedItem,
0.15f,
100
).unlockedBy("has_unrefined_block", has(MRegistry.UNREFINED_FLOOR_TILES.items[color]!!)).save(consumer)
).unlockedBy("has_unrefined_block", has(MRegistry.UNREFINED_FLOOR_TILES.items[color]!!))
.save(consumer, modLocation("decorative/floor_tiles/refined/${color.name.lowercase()}"))
if (color != DyeColor.WHITE)
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, refinedItem, 8)
.requires(Ingredient.of(MRegistry.FLOOR_TILES.getItem(DyeColor.WHITE)), 8)
.requires(color.tag)
.unlockedBy(MRegistry.FLOOR_TILES.getItem(DyeColor.WHITE))
.save(consumer, modLocation("white_tiles_refined/${refinedItem.registryName!!.path}"))
.save(consumer, modLocation("decorative/floor_tiles/refined/recolor/${color.name.lowercase()}"))
}
for ((color, item) in MRegistry.TRITANIUM_BLOCK.allItems) {
@ -132,7 +133,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
.row(original, stripe.tag, original)
.row(original, original, original)
.unlockedBy(original)
.build(consumer)
.build(consumer, modLocation("decorative/tritanium/striped/${base.name.lowercase()}_${stripe.name.lowercase()}"))
}
MatteryRecipe(MItems.DANGER_STRIPE_BLOCK, 24, category = RecipeCategory.BUILDING_BLOCKS)
@ -141,20 +142,20 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
.rowBC(Tags.Items.INGOTS_IRON, Tags.Items.DYES_BLACK)
.unlockedBy(Tags.Items.INGOTS_IRON)
.unlockedBy(Tags.Items.DYES_BLACK)
.build(consumer)
.build(consumer, modLocation("decorative/danger_stripe"))
MatteryRecipe(MItems.METAL_BEAM, 24, category = RecipeCategory.BUILDING_BLOCKS)
.rowB(Tags.Items.INGOTS_IRON)
.row(MItemTags.TRITANIUM_INGOTS, Tags.Items.COBBLESTONE, MItemTags.TRITANIUM_INGOTS)
.rowB(Tags.Items.INGOTS_IRON)
.build(consumer)
.build(consumer, modLocation("decorative/metal_beam"))
MatteryRecipe(MRegistry.VENT.item, 24, category = RecipeCategory.BUILDING_BLOCKS)
.rowB(MItemTags.TRITANIUM_INGOTS)
.row(MItemTags.TRITANIUM_INGOTS, Items.IRON_BARS, MItemTags.TRITANIUM_INGOTS)
.rowB(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer)
.build(consumer, modLocation("decorative/vent/default"))
for ((color, item) in MRegistry.VENT.items) {
MatteryRecipe(item, 8, category = RecipeCategory.BUILDING_BLOCKS)
@ -163,14 +164,19 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
.row(MRegistry.VENT.item, MRegistry.VENT.item, MRegistry.VENT.item)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(color.tag)
.build(consumer)
.build(consumer, modLocation("decorative/vent/${color.name.lowercase()}"))
}
for ((color, item) in MRegistry.VENT_ALTERNATIVE.allItems) {
val other = MRegistry.VENT.allItems[color]!!
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, item, 1).requires(other).unlockedBy(item).save(consumer)
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, other, 1).requires(item).unlockedBy(other).save(consumer, ResourceLocation(
OverdriveThatMatters.MOD_ID, "${other.registryName!!.path}_from_alt"))
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, item, 1).requires(other)
.unlockedBy(item)
.save(consumer, modLocation("decorative/vent/to_alt/${color?.name?.lowercase() ?: "default"}"))
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, other, 1).requires(item)
.unlockedBy(other)
.save(consumer, modLocation("decorative/vent/from_alt/${color?.name?.lowercase() ?: "default"}"))
}
MatteryRecipe(MRegistry.DECORATIVE_CRATE.item, 24, category = RecipeCategory.BUILDING_BLOCKS)
@ -178,7 +184,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
.row(Tags.Items.INGOTS_IRON, Tags.Items.COBBLESTONE, Tags.Items.INGOTS_IRON)
.rowB(Tags.Items.INGOTS_IRON)
.unlockedBy(Tags.Items.INGOTS_IRON)
.build(consumer)
.build(consumer, modLocation("decorative/crate/rusty"))
for ((color, crate) in MRegistry.DECORATIVE_CRATE.items) {
MatteryRecipe(crate, 8, category = RecipeCategory.BUILDING_BLOCKS)
@ -186,7 +192,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
.row(MRegistry.DECORATIVE_CRATE.item, color.tag, MRegistry.DECORATIVE_CRATE.item)
.row(MRegistry.DECORATIVE_CRATE.item, MRegistry.DECORATIVE_CRATE.item, MRegistry.DECORATIVE_CRATE.item)
.unlockedBy(MRegistry.DECORATIVE_CRATE.item)
.build(consumer)
.build(consumer, modLocation("decorative/crate/${color.name.lowercase()}"))
}
for ((color, item) in MRegistry.TRITANIUM_BLOCK.items) {
@ -196,7 +202,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
.row(MRegistry.TRITANIUM_BLOCK.item, MRegistry.TRITANIUM_BLOCK.item, MRegistry.TRITANIUM_BLOCK.item)
.unlockedBy(MRegistry.TRITANIUM_BLOCK.item)
.unlockedBy(color.tag)
.build(consumer)
.build(consumer, modLocation("decorative/tritanium/default/${color.name.lowercase()}"))
}
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, MRegistry.INDUSTRIAL_GLASS.item, 8)
@ -204,7 +210,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
.requires(MItemTags.TRITANIUM_PLATES)
.unlockedBy("has_plate", has(MItemTags.TRITANIUM_PLATES))
.unlockedBy("has_glass", has(Items.GLASS))
.save(consumer)
.save(consumer, modLocation("decorative/industrial_glass/default"))
ShapedRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, MRegistry.INDUSTRIAL_GLASS_PANE.item, 16)
.define('#', MRegistry.INDUSTRIAL_GLASS.item)
@ -241,7 +247,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
.requires(MRegistry.INDUSTRIAL_GLASS.item, 8)
.requires(color.tag)
.unlockedBy("has_tritanium_glass", has(MRegistry.INDUSTRIAL_GLASS.item))
.save(consumer)
.save(consumer, modLocation("decorative/industrial_glass/recolor/${color.name.lowercase()}"))
// апгрейд ванильного крашенного стекла
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, item, 8)
@ -249,19 +255,19 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
.requires(MItemTags.TRITANIUM_PLATES)
.unlockedBy("has_plate", has(MItemTags.TRITANIUM_PLATES))
.unlockedBy("has_colored_glass", has(mappedVanilla))
.save(consumer, ResourceLocation(DataGen.MOD_ID, "${item.registryName!!.path}_upgrade"))
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, paneItem, 8)
.requires(MRegistry.INDUSTRIAL_GLASS_PANE.item, 8)
.requires(color.tag)
.unlockedBy("has_tritanium_glass_pane", has(MRegistry.INDUSTRIAL_GLASS_PANE.item))
.save(consumer)
.save(consumer, modLocation("decorative/industrial_glass/upgrade/${color.name.lowercase()}"))
ShapedRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, paneItem, 16)
.define('#', item)
.pattern("###").pattern("###")
.unlockedBy("has_colored_tritanium_glass", has(paneItem))
.save(consumer, ResourceLocation(DataGen.MOD_ID, "${paneItem.registryName!!.path}_alt"))
.save(consumer, modLocation("decorative/industrial_glass_pane/${color.name.lowercase()}"))
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, paneItem, 8)
.requires(MRegistry.INDUSTRIAL_GLASS_PANE.item, 8)
.requires(color.tag)
.unlockedBy("has_tritanium_glass_pane", has(MRegistry.INDUSTRIAL_GLASS_PANE.item))
.save(consumer, modLocation("decorative/industrial_glass_pane/recolor/${color.name.lowercase()}"))
}
ShapelessRecipeBuilder(RecipeCategory.REDSTONE, MItems.LABORATORY_LAMP, 1)
@ -280,55 +286,55 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
.rowAB(Tags.Items.DYES_YELLOW, MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(Tags.Items.DYES_YELLOW)
.build(consumer)
.build(consumer, modLocation("decorative/blocks/striped_default"))
MatteryRecipe(MRegistry.TRITANIUM_BLOCK.item, 24, category = RecipeCategory.BUILDING_BLOCKS)
.rowB(MItemTags.TRITANIUM_INGOTS)
.row(MItemTags.TRITANIUM_INGOTS, Tags.Items.COBBLESTONE, MItemTags.TRITANIUM_INGOTS)
.rowB(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer)
.build(consumer, modLocation("decorative/blocks/default"))
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)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer)
.build(consumer, modLocation("decorative/doors/default"))
for (color in DyeColor.values()) {
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(color.tag)
.unlockedBy(MItems.TRITANIUM_DOOR.entries.stream().filter { it.key != color }.map { it.value })
.save(consumer)
.save(consumer, modLocation("decorative/doors/${color.name.lowercase()}"))
}
MatteryRecipe(MBlocks.TRITANIUM_TRAPDOOR[null]!!, category = RecipeCategory.REDSTONE)
.rowAB(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.rowAB(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer)
.build(consumer, modLocation("decorative/trapdoors/default"))
for (color in DyeColor.values()) {
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(color.tag)
.unlockedBy(MItems.TRITANIUM_TRAPDOOR.entries.stream().filter { it.key != color }.map { it.value })
.save(consumer)
.save(consumer, modLocation("decorative/trapdoors/${color.name.lowercase()}"))
}
MatteryRecipe(MRegistry.TRITANIUM_PRESSURE_PLATE.item, category = RecipeCategory.REDSTONE)
.row(MItemTags.TRITANIUM_PLATES, MItemTags.BASIC_CIRCUIT, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItemTags.TRITANIUM_PLATES)
.build(consumer)
.build(consumer, modLocation("pressure_plates/default"))
for (dye in DyeColor.values()) {
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(dye.tag)
.unlockedBy(MItemTags.TRITANIUM_PLATES)
.save(consumer)
.save(consumer, modLocation("pressure_plates/${dye.name.lowercase()}"))
}
MatteryRecipe(MItems.ENGINE, count = 9, category = RecipeCategory.BUILDING_BLOCKS)
@ -337,26 +343,26 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<Fi
.row(MItemTags.TRITANIUM_INGOTS, MItems.MATTER_CABLE, MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(Items.FLINT_AND_STEEL)
.build(consumer)
.build(consumer, modLocation("decorative/engine"))
// лампа
MatteryRecipe(MItems.LABORATORY_LAMP, category = RecipeCategory.REDSTONE)
.row(MItemTags.IRON_PLATES, MItemTags.HARDENED_GLASS_PANES_COLORLESS, MItemTags.IRON_PLATES)
.row(MItems.MIRROR, Items.GLOWSTONE, MItems.MIRROR)
.row(MItemTags.TRITANIUM_PLATES, Tags.Items.DUSTS_REDSTONE, MItemTags.TRITANIUM_PLATES)
.build(consumer)
.build(consumer, modLocation("decorative/lamp"))
// Голо табличка
MatteryRecipe(MItems.HOLO_SIGN, category = RecipeCategory.DECORATIONS)
.row(MItemTags.BASIC_CIRCUIT, MItemTags.TRITANIUM_PLATES, MItemTags.HARDENED_GLASS_PANES_COLORLESS)
.rowAB(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_GLOWSTONE)
.rowBC(MItemTags.TRITANIUM_PLATES, MItemTags.HARDENED_GLASS_PANES_COLORLESS)
.build(consumer)
.build(consumer, modLocation("decorative/holo_sign"))
MatteryRecipe(MItems.TRITANIUM_BARS, category = RecipeCategory.DECORATIONS, count = 16)
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.build(consumer)
.build(consumer, modLocation("decorative/tritanium_bars"))
MatteryRecipe(MItems.TRITANIUM_ANVIL[0], category = RecipeCategory.DECORATIONS)
.row(MItemTags.TRITANIUM_INGOTS_STORAGE, MItemTags.TRITANIUM_INGOTS_STORAGE, MItemTags.TRITANIUM_INGOTS_STORAGE)

View File

@ -200,6 +200,10 @@ class MatteryRecipe(val result: ItemLike, val count: Int = 1, val category: Reci
}
}
fun build(consumer: Consumer<FinishedRecipe>, name: ResourceLocation) {
buildRegular().save(filter(consumer), name)
}
fun buildEnergetic(consumer: Consumer<FinishedRecipe>, name: String? = null) {
build({
consumer.accept(object : FinishedRecipe by it {