Tritanium blocks, crate, vents recipes

This commit is contained in:
DBotThePony 2022-08-28 12:36:00 +07:00
parent 78f959258c
commit d7a444327c
Signed by: DBot
GPG Key ID: DCC23B5715498507
4 changed files with 155 additions and 43 deletions

View File

@ -3,10 +3,14 @@ package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.data.recipes.FinishedRecipe import net.minecraft.data.recipes.FinishedRecipe
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.tags.TagKey
import net.minecraft.world.item.Item
import net.minecraft.world.item.Items
import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.item.crafting.Ingredient
import net.minecraftforge.common.Tags import net.minecraftforge.common.Tags
import net.minecraftforge.common.Tags.Items.COBBLESTONE import net.minecraftforge.common.Tags.Items.COBBLESTONE
import ru.dbotthepony.mc.otm.registry.MItemTags 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.MRegistry
import ru.dbotthepony.mc.otm.registryName import ru.dbotthepony.mc.otm.registryName
import java.util.function.Consumer import java.util.function.Consumer
@ -38,10 +42,71 @@ fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) {
.unlockedBy("has_chest", has(Tags.Items.CHESTS)) .unlockedBy("has_chest", has(Tags.Items.CHESTS))
.save(consumer) .save(consumer)
MatteryRecipe(MRegistry.TRITANIUM_BLOCK.item, 24) for ((color, item) in MRegistry.TRITANIUM_BLOCK.mappedColoredItemsAll) {
.rowB(MItemTags.PLATE_TRITANIUM) MatteryRecipe(item, 24)
.row(MItemTags.PLATE_TRITANIUM, COBBLESTONE, MItemTags.PLATE_TRITANIUM) .rowAB(color?.tag, MItemTags.PLATE_TRITANIUM)
.rowB(MItemTags.PLATE_TRITANIUM) .row(MItemTags.PLATE_TRITANIUM, COBBLESTONE, MItemTags.PLATE_TRITANIUM)
.unlockedBy(MItemTags.PLATE_TRITANIUM) .rowB(MItemTags.PLATE_TRITANIUM)
.build(consumer) .unlockedBy(MItemTags.PLATE_TRITANIUM)
.also { if (color != null) it.unlockedBy(color.tag) }
.build(consumer)
}
for ((color, item) in MRegistry.VENT.mappedColoredItemsAll) {
MatteryRecipe(item, 24)
.rowAB(color?.tag, MItemTags.PLATE_TRITANIUM)
.row(MItemTags.PLATE_TRITANIUM, Items.IRON_BARS, MItemTags.PLATE_TRITANIUM)
.rowB(MItemTags.PLATE_TRITANIUM)
.unlockedBy(MItemTags.PLATE_TRITANIUM)
.also { if (color != null) it.unlockedBy(color.tag) }
.build(consumer)
}
for ((color, item) in MRegistry.VENT_ALTERNATIVE.mappedColoredItemsAll) {
val other = MRegistry.VENT.mappedColoredItemsAll[color]!!
ShapelessRecipeBuilder(item, 1).requires(other).save(consumer)
ShapelessRecipeBuilder(other, 1).requires(item).save(consumer, "${other.registryName!!.path}_from_alt")
}
for ((crate, color) in listOf(
MItems.CRATE_RED to Tags.Items.DYES_RED,
MItems.CRATE_BLUE to Tags.Items.DYES_BLUE,
MItems.CRATE_YELLOW to Tags.Items.DYES_YELLOW,
MItems.CRATE_GREEN to Tags.Items.DYES_GREEN,
MItems.CRATE_BLACK to Tags.Items.DYES_BLACK,
MItems.CRATE_PINK to Tags.Items.DYES_PINK,
MItems.CRATE_PURPLE to Tags.Items.DYES_PURPLE,
)) {
MatteryRecipe(crate, 24)
.rowAB(color, MItemTags.PLATE_IRON)
.row(MItemTags.PLATE_IRON, COBBLESTONE, MItemTags.PLATE_IRON)
.rowB(MItemTags.PLATE_IRON)
.unlockedBy(MItemTags.PLATE_IRON)
.unlockedBy(color)
.build(consumer, crate.registryName!!.path + "_1")
MatteryRecipe(crate, 24)
.rowBC(MItemTags.PLATE_IRON, color)
.row(MItemTags.PLATE_IRON, COBBLESTONE, MItemTags.PLATE_IRON)
.rowB(MItemTags.PLATE_IRON)
.unlockedBy(MItemTags.PLATE_IRON)
.unlockedBy(color)
.build(consumer, crate.registryName!!.path + "_2")
MatteryRecipe(crate, 24)
.rowB(MItemTags.PLATE_IRON)
.row(MItemTags.PLATE_IRON, COBBLESTONE, MItemTags.PLATE_IRON)
.rowAB(color, MItemTags.PLATE_IRON)
.unlockedBy(MItemTags.PLATE_IRON)
.unlockedBy(color)
.build(consumer, crate.registryName!!.path + "_3")
MatteryRecipe(crate, 24)
.rowB(MItemTags.PLATE_IRON)
.row(MItemTags.PLATE_IRON, COBBLESTONE, MItemTags.PLATE_IRON)
.rowBC(MItemTags.PLATE_IRON, color)
.unlockedBy(MItemTags.PLATE_IRON)
.unlockedBy(color)
.build(consumer, crate.registryName!!.path + "_4")
}
} }

View File

@ -4,10 +4,12 @@ package ru.dbotthepony.mc.otm.datagen.recipes
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.ShapedRecipeBuilder import net.minecraft.data.recipes.ShapedRecipeBuilder
import net.minecraft.resources.ResourceLocation
import net.minecraft.tags.TagKey import net.minecraft.tags.TagKey
import net.minecraft.world.item.Item import net.minecraft.world.item.Item
import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.item.crafting.Ingredient
import net.minecraft.world.level.ItemLike import net.minecraft.world.level.ItemLike
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.registryName import ru.dbotthepony.mc.otm.registryName
import java.util.function.Consumer import java.util.function.Consumer
@ -129,7 +131,7 @@ class MatteryRecipe(val result: ItemLike, val count: Int = 1) {
} }
if (name != null) { if (name != null) {
builder.save(consumer, name) builder.save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, name))
} else { } else {
builder.save(consumer) builder.save(consumer)
} }
@ -415,147 +417,147 @@ class MatteryRecipe(val result: ItemLike, val count: Int = 1) {
return this return this
} }
fun rowA(a: Ingredient): MatteryRecipe { fun rowA(a: Ingredient?): MatteryRecipe {
return this.row(a, null as Ingredient?, null as Ingredient?) return this.row(a, null as Ingredient?, null as Ingredient?)
} }
fun rowA(a: ItemLike): MatteryRecipe { fun rowA(a: ItemLike?): MatteryRecipe {
return this.row(a, null as ItemLike?, null as ItemLike?) return this.row(a, null as ItemLike?, null as ItemLike?)
} }
fun rowA(a: TagKey<Item>): MatteryRecipe { fun rowA(a: TagKey<Item>?): MatteryRecipe {
return this.row(a, null as TagKey<Item>?, null as TagKey<Item>?) return this.row(a, null as TagKey<Item>?, null as TagKey<Item>?)
} }
fun rowB(b: Ingredient): MatteryRecipe { fun rowB(b: Ingredient?): MatteryRecipe {
return this.row(null as Ingredient?, b, null as Ingredient?) return this.row(null as Ingredient?, b, null as Ingredient?)
} }
fun rowB(b: ItemLike): MatteryRecipe { fun rowB(b: ItemLike?): MatteryRecipe {
return this.row(null as ItemLike?, b, null as ItemLike?) return this.row(null as ItemLike?, b, null as ItemLike?)
} }
fun rowB(b: TagKey<Item>): MatteryRecipe { fun rowB(b: TagKey<Item>?): MatteryRecipe {
return this.row(null as TagKey<Item>?, b, null as TagKey<Item>?) return this.row(null as TagKey<Item>?, b, null as TagKey<Item>?)
} }
fun rowC(c: Ingredient): MatteryRecipe { fun rowC(c: Ingredient?): MatteryRecipe {
return this.row(null as Ingredient?, null as Ingredient?, c) return this.row(null as Ingredient?, null as Ingredient?, c)
} }
fun rowC(c: ItemLike): MatteryRecipe { fun rowC(c: ItemLike?): MatteryRecipe {
return this.row(null as ItemLike?, null as ItemLike?, c) return this.row(null as ItemLike?, null as ItemLike?, c)
} }
fun rowC(c: TagKey<Item>): MatteryRecipe { fun rowC(c: TagKey<Item>?): MatteryRecipe {
return this.row(null as TagKey<Item>?, null as TagKey<Item>?, c) return this.row(null as TagKey<Item>?, null as TagKey<Item>?, c)
} }
fun rowAB(a: Ingredient, b: Ingredient): MatteryRecipe { fun rowAB(a: Ingredient?, b: Ingredient?): MatteryRecipe {
return this.row(a, b, null as Ingredient?) return this.row(a, b, null as Ingredient?)
} }
fun rowAB(a: Ingredient, b: ItemLike): MatteryRecipe { fun rowAB(a: Ingredient?, b: ItemLike?): MatteryRecipe {
return this.row(a, b, null as Ingredient?) return this.row(a, b, null as Ingredient?)
} }
fun rowAB(a: Ingredient, b: TagKey<Item>): MatteryRecipe { fun rowAB(a: Ingredient?, b: TagKey<Item>?): MatteryRecipe {
return this.row(a, b, null as Ingredient?) return this.row(a, b, null as Ingredient?)
} }
fun rowAB(a: ItemLike, b: Ingredient): MatteryRecipe { fun rowAB(a: ItemLike?, b: Ingredient?): MatteryRecipe {
return this.row(a, b, null as ItemLike?) return this.row(a, b, null as ItemLike?)
} }
fun rowAB(a: ItemLike, b: ItemLike): MatteryRecipe { fun rowAB(a: ItemLike?, b: ItemLike?): MatteryRecipe {
return this.row(a, b, null as ItemLike?) return this.row(a, b, null as ItemLike?)
} }
fun rowAB(a: ItemLike, b: TagKey<Item>): MatteryRecipe { fun rowAB(a: ItemLike?, b: TagKey<Item>?): MatteryRecipe {
return this.row(a, b, null as ItemLike?) return this.row(a, b, null as ItemLike?)
} }
fun rowAB(a: TagKey<Item>, b: Ingredient): MatteryRecipe { fun rowAB(a: TagKey<Item>?, b: Ingredient?): MatteryRecipe {
return this.row(a, b, null as TagKey<Item>?) return this.row(a, b, null as TagKey<Item>?)
} }
fun rowAB(a: TagKey<Item>, b: ItemLike): MatteryRecipe { fun rowAB(a: TagKey<Item>?, b: ItemLike?): MatteryRecipe {
return this.row(a, b, null as TagKey<Item>?) return this.row(a, b, null as TagKey<Item>?)
} }
fun rowAB(a: TagKey<Item>, b: TagKey<Item>): MatteryRecipe { fun rowAB(a: TagKey<Item>?, b: TagKey<Item>?): MatteryRecipe {
return this.row(a, b, null as TagKey<Item>?) return this.row(a, b, null as TagKey<Item>?)
} }
fun rowAC(a: Ingredient, c: Ingredient): MatteryRecipe { fun rowAC(a: Ingredient?, c: Ingredient?): MatteryRecipe {
return this.row(a, null as Ingredient?, c) return this.row(a, null as Ingredient?, c)
} }
fun rowAC(a: Ingredient, c: ItemLike): MatteryRecipe { fun rowAC(a: Ingredient?, c: ItemLike?): MatteryRecipe {
return this.row(a, null as Ingredient?, c) return this.row(a, null as Ingredient?, c)
} }
fun rowAC(a: Ingredient, c: TagKey<Item>): MatteryRecipe { fun rowAC(a: Ingredient?, c: TagKey<Item>?): MatteryRecipe {
return this.row(a, null as Ingredient?, c) return this.row(a, null as Ingredient?, c)
} }
fun rowAC(a: ItemLike, c: Ingredient): MatteryRecipe { fun rowAC(a: ItemLike?, c: Ingredient?): MatteryRecipe {
return this.row(a, null as ItemLike?, c) return this.row(a, null as ItemLike?, c)
} }
fun rowAC(a: ItemLike, c: ItemLike): MatteryRecipe { fun rowAC(a: ItemLike?, c: ItemLike?): MatteryRecipe {
return this.row(a, null as ItemLike?, c) return this.row(a, null as ItemLike?, c)
} }
fun rowAC(a: ItemLike, c: TagKey<Item>): MatteryRecipe { fun rowAC(a: ItemLike?, c: TagKey<Item>?): MatteryRecipe {
return this.row(a, null as ItemLike?, c) return this.row(a, null as ItemLike?, c)
} }
fun rowAC(a: TagKey<Item>, c: Ingredient): MatteryRecipe { fun rowAC(a: TagKey<Item>?, c: Ingredient?): MatteryRecipe {
return this.row(a, null as TagKey<Item>?, c) return this.row(a, null as TagKey<Item>?, c)
} }
fun rowAC(a: TagKey<Item>, c: ItemLike): MatteryRecipe { fun rowAC(a: TagKey<Item>?, c: ItemLike?): MatteryRecipe {
return this.row(a, null as TagKey<Item>?, c) return this.row(a, null as TagKey<Item>?, c)
} }
fun rowAC(a: TagKey<Item>, c: TagKey<Item>): MatteryRecipe { fun rowAC(a: TagKey<Item>?, c: TagKey<Item>?): MatteryRecipe {
return this.row(a, null as TagKey<Item>?, c) return this.row(a, null as TagKey<Item>?, c)
} }
fun rowBC(b: Ingredient, c: Ingredient): MatteryRecipe { fun rowBC(b: Ingredient?, c: Ingredient?): MatteryRecipe {
return this.row(null as Ingredient?, b, c) return this.row(null as Ingredient?, b, c)
} }
fun rowBC(b: Ingredient, c: ItemLike): MatteryRecipe { fun rowBC(b: Ingredient?, c: ItemLike?): MatteryRecipe {
return this.row(null as Ingredient?, b, c) return this.row(null as Ingredient?, b, c)
} }
fun rowBC(b: Ingredient, c: TagKey<Item>): MatteryRecipe { fun rowBC(b: Ingredient?, c: TagKey<Item>?): MatteryRecipe {
return this.row(null as Ingredient?, b, c) return this.row(null as Ingredient?, b, c)
} }
fun rowBC(b: ItemLike, c: Ingredient): MatteryRecipe { fun rowBC(b: ItemLike?, c: Ingredient?): MatteryRecipe {
return this.row(null as ItemLike?, b, c) return this.row(null as ItemLike?, b, c)
} }
fun rowBC(b: ItemLike, c: ItemLike): MatteryRecipe { fun rowBC(b: ItemLike?, c: ItemLike?): MatteryRecipe {
return this.row(null as ItemLike?, b, c) return this.row(null as ItemLike?, b, c)
} }
fun rowBC(b: ItemLike, c: TagKey<Item>): MatteryRecipe { fun rowBC(b: ItemLike?, c: TagKey<Item>?): MatteryRecipe {
return this.row(null as ItemLike?, b, c) return this.row(null as ItemLike?, b, c)
} }
fun rowBC(b: TagKey<Item>, c: Ingredient): MatteryRecipe { fun rowBC(b: TagKey<Item>?, c: Ingredient?): MatteryRecipe {
return this.row(null as TagKey<Item>?, b, c) return this.row(null as TagKey<Item>?, b, c)
} }
fun rowBC(b: TagKey<Item>, c: ItemLike): MatteryRecipe { fun rowBC(b: TagKey<Item>?, c: ItemLike?): MatteryRecipe {
return this.row(null as TagKey<Item>?, b, c) return this.row(null as TagKey<Item>?, b, c)
} }
fun rowBC(b: TagKey<Item>, c: TagKey<Item>): MatteryRecipe { fun rowBC(b: TagKey<Item>?, c: TagKey<Item>?): MatteryRecipe {
return this.row(null as TagKey<Item>?, b, c) return this.row(null as TagKey<Item>?, b, c)
} }
} }

View File

@ -348,6 +348,50 @@ class DecorativeBlock(
val block: Block get() = _block.get() val block: Block get() = _block.get()
val item: Item get() = _item.get() val item: Item get() = _item.get()
val mappedColoredBlocksAll: Map<DyeColor?, Block> by lazy {
LazyMap(
null to _block::get,
DyeColor.WHITE to _whiteBlock::get,
DyeColor.ORANGE to _orangeBlock::get,
DyeColor.MAGENTA to _magentaBlock::get,
DyeColor.LIGHT_BLUE to _lightBlueBlock::get,
DyeColor.YELLOW to _yellowBlock::get,
DyeColor.LIME to _limeBlock::get,
DyeColor.PINK to _pinkBlock::get,
DyeColor.GRAY to _grayBlock::get,
DyeColor.LIGHT_GRAY to _lightGrayBlock::get,
DyeColor.CYAN to _cyanBlock::get,
DyeColor.PURPLE to _purpleBlock::get,
DyeColor.BLUE to _blueBlock::get,
DyeColor.BROWN to _brownBlock::get,
DyeColor.GREEN to _greenBlock::get,
DyeColor.RED to _redBlock::get,
DyeColor.BLACK to _blackBlock::get,
)
}
val mappedColoredItemsAll: Map<DyeColor?, Item> by lazy {
LazyMap(
null to _item::get,
DyeColor.WHITE to _whiteItem::get,
DyeColor.ORANGE to _orangeItem::get,
DyeColor.MAGENTA to _magentaItem::get,
DyeColor.LIGHT_BLUE to _lightBlueItem::get,
DyeColor.YELLOW to _yellowItem::get,
DyeColor.LIME to _limeItem::get,
DyeColor.PINK to _pinkItem::get,
DyeColor.GRAY to _grayItem::get,
DyeColor.LIGHT_GRAY to _lightGrayItem::get,
DyeColor.CYAN to _cyanItem::get,
DyeColor.PURPLE to _purpleItem::get,
DyeColor.BLUE to _blueItem::get,
DyeColor.BROWN to _brownItem::get,
DyeColor.GREEN to _greenItem::get,
DyeColor.RED to _redItem::get,
DyeColor.BLACK to _blackItem::get,
)
}
val blocks: List<Block> by lazy { val blocks: List<Block> by lazy {
LazyList( LazyList(
_block::get, _block::get,

View File

@ -9,6 +9,7 @@ import ru.dbotthepony.mc.otm.OverdriveThatMatters
object MItemTags { object MItemTags {
val INGOT_TRITANIUM: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "ingots/tritanium")) val INGOT_TRITANIUM: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "ingots/tritanium"))
val PLATE_TRITANIUM: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "plates/tritanium")) val PLATE_TRITANIUM: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "plates/tritanium"))
val PLATE_IRON: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "plates/iron"))
val TRITANIUM_CRATES: TagKey<Item> = ItemTags.create(ResourceLocation(OverdriveThatMatters.MOD_ID, "tritanium_crates")) val TRITANIUM_CRATES: TagKey<Item> = ItemTags.create(ResourceLocation(OverdriveThatMatters.MOD_ID, "tritanium_crates"))
val INDUSTRIAL_GLASS: TagKey<Item> = ItemTags.create(ResourceLocation(OverdriveThatMatters.MOD_ID, "industrial_glass")) val INDUSTRIAL_GLASS: TagKey<Item> = ItemTags.create(ResourceLocation(OverdriveThatMatters.MOD_ID, "industrial_glass"))
} }