Housekeep remaining tags, correct recipes
This commit is contained in:
parent
c91e3b0bc6
commit
b4b0afa9d5
@ -4,6 +4,7 @@ import net.minecraft.data.recipes.FinishedRecipe
|
||||
import net.minecraft.data.recipes.ShapedRecipeBuilder
|
||||
import net.minecraft.data.recipes.ShapelessRecipeBuilder
|
||||
import net.minecraft.tags.ItemTags
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.Items
|
||||
import net.minecraft.world.item.crafting.Ingredient
|
||||
import net.minecraftforge.common.Tags
|
||||
@ -28,9 +29,9 @@ fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) {
|
||||
.save(consumer)
|
||||
|
||||
ShapelessRecipeBuilder(crate, 1)
|
||||
.requires(Ingredient.of(MItemTags.CARGO_CRATES), 1)
|
||||
.requires(Ingredient.of(dye.tag), 1)
|
||||
.unlockedBy("has_tritanium_crate", has(MItemTags.CARGO_CRATES))
|
||||
.requires(Ingredient.of(MRegistry.CARGO_CRATES.allItems.entries.stream().filter { it.key != dye }.map { ItemStack(it.value) }))
|
||||
.requires(dye.tag)
|
||||
.unlockedBy(MRegistry.CARGO_CRATES.allItems.entries.stream().filter { it.key != dye }.map { it.value })
|
||||
.save(consumer, "${crate.registryName}_alt")
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ import ru.dbotthepony.mc.otm.datagen.DataGen
|
||||
import ru.dbotthepony.mc.otm.recipe.PlatePressRecipe
|
||||
import java.util.LinkedList
|
||||
import java.util.function.Consumer
|
||||
import java.util.stream.Stream
|
||||
|
||||
private typealias RecipeBuilderCallback = (MatteryRecipeProvider, consumer: Consumer<FinishedRecipe>) -> Unit
|
||||
|
||||
@ -43,13 +44,23 @@ fun inventoryTrigger(vararg p_126012_: ItemPredicate): InventoryChangeTrigger.Tr
|
||||
)
|
||||
}
|
||||
|
||||
fun RecipeBuilder.unlockedBy(item: ItemLike): RecipeBuilder {
|
||||
fun <T : RecipeBuilder> T.unlockedBy(item: ItemLike): T {
|
||||
val location = item.asItem().registryName!!
|
||||
return unlockedBy("has_${location.namespace}_${location.path}", has(item))
|
||||
unlockedBy("has_${location.namespace}_${location.path}", has(item))
|
||||
return this
|
||||
}
|
||||
|
||||
fun RecipeBuilder.unlockedBy(item: TagKey<Item>): RecipeBuilder {
|
||||
return unlockedBy("has_${item.location.namespace}_${item.location.path}", has(item))
|
||||
fun <T : RecipeBuilder> T.unlockedBy(item: Stream<out ItemLike>): T {
|
||||
for (value in item) {
|
||||
unlockedBy(value)
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
fun <T : RecipeBuilder> T.unlockedBy(item: TagKey<Item>): T {
|
||||
unlockedBy("has_${item.location.namespace}_${item.location.path}", has(item))
|
||||
return this
|
||||
}
|
||||
|
||||
class MatteryRecipeProvider(generatorIn: DataGenerator) : RecipeProvider(generatorIn) {
|
||||
|
@ -3,7 +3,9 @@ package ru.dbotthepony.mc.otm.datagen.recipes
|
||||
import net.minecraft.data.recipes.FinishedRecipe
|
||||
import net.minecraft.data.recipes.ShapelessRecipeBuilder
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.Items
|
||||
import net.minecraft.world.item.crafting.Ingredient
|
||||
import ru.dbotthepony.mc.otm.core.registryName
|
||||
import ru.dbotthepony.mc.otm.datagen.modLocation
|
||||
import ru.dbotthepony.mc.otm.registry.MItemTags
|
||||
@ -21,9 +23,9 @@ fun addShapelessRecipes(consumer: Consumer<FinishedRecipe>) {
|
||||
.save(consumer)
|
||||
|
||||
ShapelessRecipeBuilder(MItems.CARGO_CRATE_MINECARTS[color]!!, 1)
|
||||
.requires(MItemTags.MINECART_CARGO_CRATES)
|
||||
.requires(Ingredient.of(MItems.CARGO_CRATE_MINECARTS.entries.stream().filter { it.key != color }.map { ItemStack(it.value) }))
|
||||
.requires(color.tag)
|
||||
.unlockedBy(MItemTags.MINECART_CARGO_CRATES)
|
||||
.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"))
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import net.minecraft.world.effect.MobEffects
|
||||
import net.minecraft.world.item.DyeColor
|
||||
import net.minecraft.world.item.Items
|
||||
import net.minecraft.world.item.Tiers
|
||||
import ru.dbotthepony.mc.otm.registry.MBlockTags
|
||||
import ru.dbotthepony.mc.otm.registry.MBlocks
|
||||
import ru.dbotthepony.mc.otm.registry.MItemTags
|
||||
import ru.dbotthepony.mc.otm.registry.MItems
|
||||
@ -57,6 +58,10 @@ fun addTags(tagsProvider: TagsProvider) {
|
||||
MRegistry.INDUSTRIAL_GLASS.forEachBlock { s, _, block -> tagsProvider.blocks.forge("hardened_glass/$s").add(block) }
|
||||
MRegistry.INDUSTRIAL_GLASS_PANE.forEachBlock { s, _, block -> tagsProvider.blocks.forge("hardened_glass_panes/$s").add(block) }
|
||||
|
||||
tagsProvider.items.appender(MItemTags.INDUSTRIAL_GLASS).add(MRegistry.INDUSTRIAL_GLASS.allItems.values)
|
||||
tagsProvider.blocks.appender(MBlockTags.INDUSTRIAL_GLASS).add(MRegistry.INDUSTRIAL_GLASS.allBlocks.values)
|
||||
tagsProvider.blocks.appender(MBlockTags.CARGO_CRATES).add(MRegistry.CARGO_CRATES.allBlocks.values)
|
||||
|
||||
tagsProvider.requiresPickaxe(listOf(
|
||||
MBlocks.ANDROID_STATION,
|
||||
MBlocks.BATTERY_BANK,
|
||||
|
@ -1,9 +1,11 @@
|
||||
package ru.dbotthepony.mc.otm.registry
|
||||
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.tags.BlockTags
|
||||
import net.minecraft.tags.ItemTags
|
||||
import net.minecraft.tags.TagKey
|
||||
import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.level.block.Block
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
|
||||
@Suppress("unused")
|
||||
@ -62,3 +64,47 @@ object MItemTags {
|
||||
val HARDENED_GLASS_WHITE: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass/white"))
|
||||
val HARDENED_GLASS_YELLOW: TagKey<Item> = ItemTags.create(ResourceLocation("forge", "hardened_glass/yellow"))
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
object MBlockTags {
|
||||
val CARGO_CRATES: TagKey<Block> = BlockTags.create(ResourceLocation(OverdriveThatMatters.MOD_ID, "cargo_crates"))
|
||||
val INDUSTRIAL_GLASS: TagKey<Block> = BlockTags.create(ResourceLocation(OverdriveThatMatters.MOD_ID, "industrial_glass"))
|
||||
|
||||
val HARDENED_GLASS_PANES: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes"))
|
||||
val HARDENED_GLASS_PANES_BLACK: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/black"))
|
||||
val HARDENED_GLASS_PANES_BLUE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/blue"))
|
||||
val HARDENED_GLASS_PANES_BROWN: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/brown"))
|
||||
val HARDENED_GLASS_PANES_COLORLESS: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/colorless"))
|
||||
val HARDENED_GLASS_PANES_CYAN: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/cyan"))
|
||||
val HARDENED_GLASS_PANES_GRAY: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/gray"))
|
||||
val HARDENED_GLASS_PANES_GREEN: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/green"))
|
||||
val HARDENED_GLASS_PANES_LIGHT_BLUE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/light_blue"))
|
||||
val HARDENED_GLASS_PANES_LIGHT_GRAY: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/light_gray"))
|
||||
val HARDENED_GLASS_PANES_LIME: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/lime"))
|
||||
val HARDENED_GLASS_PANES_MAGENTA: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/magenta"))
|
||||
val HARDENED_GLASS_PANES_ORANGE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/orange"))
|
||||
val HARDENED_GLASS_PANES_PINK: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/pink"))
|
||||
val HARDENED_GLASS_PANES_PURPLE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/purple"))
|
||||
val HARDENED_GLASS_PANES_RED: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/red"))
|
||||
val HARDENED_GLASS_PANES_WHITE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/white"))
|
||||
val HARDENED_GLASS_PANES_YELLOW: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass_panes/yellow"))
|
||||
|
||||
val HARDENED_GLASS: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass"))
|
||||
val HARDENED_GLASS_BLACK: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/black"))
|
||||
val HARDENED_GLASS_BLUE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/blue"))
|
||||
val HARDENED_GLASS_BROWN: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/brown"))
|
||||
val HARDENED_GLASS_COLORLESS: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/colorless"))
|
||||
val HARDENED_GLASS_CYAN: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/cyan"))
|
||||
val HARDENED_GLASS_GRAY: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/gray"))
|
||||
val HARDENED_GLASS_GREEN: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/green"))
|
||||
val HARDENED_GLASS_LIGHT_BLUE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/light_blue"))
|
||||
val HARDENED_GLASS_LIGHT_GRAY: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/light_gray"))
|
||||
val HARDENED_GLASS_LIME: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/lime"))
|
||||
val HARDENED_GLASS_MAGENTA: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/magenta"))
|
||||
val HARDENED_GLASS_ORANGE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/orange"))
|
||||
val HARDENED_GLASS_PINK: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/pink"))
|
||||
val HARDENED_GLASS_PURPLE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/purple"))
|
||||
val HARDENED_GLASS_RED: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/red"))
|
||||
val HARDENED_GLASS_WHITE: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/white"))
|
||||
val HARDENED_GLASS_YELLOW: TagKey<Block> = BlockTags.create(ResourceLocation("forge", "hardened_glass/yellow"))
|
||||
}
|
||||
|
@ -1,40 +0,0 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"overdrive_that_matters:industrial_glass",
|
||||
"overdrive_that_matters:industrial_glass_pane",
|
||||
|
||||
"overdrive_that_matters:industrial_glass_white",
|
||||
"overdrive_that_matters:industrial_glass_pane_white",
|
||||
"overdrive_that_matters:industrial_glass_orange",
|
||||
"overdrive_that_matters:industrial_glass_pane_orange",
|
||||
"overdrive_that_matters:industrial_glass_magenta",
|
||||
"overdrive_that_matters:industrial_glass_pane_magenta",
|
||||
"overdrive_that_matters:industrial_glass_light_blue",
|
||||
"overdrive_that_matters:industrial_glass_pane_light_blue",
|
||||
"overdrive_that_matters:industrial_glass_yellow",
|
||||
"overdrive_that_matters:industrial_glass_pane_yellow",
|
||||
"overdrive_that_matters:industrial_glass_lime",
|
||||
"overdrive_that_matters:industrial_glass_pane_lime",
|
||||
"overdrive_that_matters:industrial_glass_pink",
|
||||
"overdrive_that_matters:industrial_glass_pane_pink",
|
||||
"overdrive_that_matters:industrial_glass_gray",
|
||||
"overdrive_that_matters:industrial_glass_pane_gray",
|
||||
"overdrive_that_matters:industrial_glass_light_gray",
|
||||
"overdrive_that_matters:industrial_glass_pane_light_gray",
|
||||
"overdrive_that_matters:industrial_glass_cyan",
|
||||
"overdrive_that_matters:industrial_glass_pane_cyan",
|
||||
"overdrive_that_matters:industrial_glass_purple",
|
||||
"overdrive_that_matters:industrial_glass_pane_purple",
|
||||
"overdrive_that_matters:industrial_glass_blue",
|
||||
"overdrive_that_matters:industrial_glass_pane_blue",
|
||||
"overdrive_that_matters:industrial_glass_brown",
|
||||
"overdrive_that_matters:industrial_glass_pane_brown",
|
||||
"overdrive_that_matters:industrial_glass_green",
|
||||
"overdrive_that_matters:industrial_glass_pane_green",
|
||||
"overdrive_that_matters:industrial_glass_red",
|
||||
"overdrive_that_matters:industrial_glass_pane_red",
|
||||
"overdrive_that_matters:industrial_glass_black",
|
||||
"overdrive_that_matters:industrial_glass_pane_black"
|
||||
]
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"overdrive_that_matters:cargo_crate",
|
||||
"overdrive_that_matters:cargo_crate_white",
|
||||
"overdrive_that_matters:cargo_crate_orange",
|
||||
"overdrive_that_matters:cargo_crate_magenta",
|
||||
"overdrive_that_matters:cargo_crate_light_blue",
|
||||
"overdrive_that_matters:cargo_crate_yellow",
|
||||
"overdrive_that_matters:cargo_crate_lime",
|
||||
"overdrive_that_matters:cargo_crate_pink",
|
||||
"overdrive_that_matters:cargo_crate_gray",
|
||||
"overdrive_that_matters:cargo_crate_light_gray",
|
||||
"overdrive_that_matters:cargo_crate_cyan",
|
||||
"overdrive_that_matters:cargo_crate_purple",
|
||||
"overdrive_that_matters:cargo_crate_blue",
|
||||
"overdrive_that_matters:cargo_crate_brown",
|
||||
"overdrive_that_matters:cargo_crate_green",
|
||||
"overdrive_that_matters:cargo_crate_red",
|
||||
"overdrive_that_matters:cargo_crate_black"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user