Reduce file count of painter recipes
This commit is contained in:
parent
840b103ee1
commit
e08e6d7830
@ -7,6 +7,7 @@ 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.core.stream
|
||||
import ru.dbotthepony.mc.otm.datagen.modLocation
|
||||
import ru.dbotthepony.mc.otm.recipe.PainterRecipe
|
||||
import ru.dbotthepony.mc.otm.registry.MItems
|
||||
@ -16,19 +17,15 @@ import java.util.function.Consumer
|
||||
private val Item.recipeName get() = registryName!!.namespace + "/" + registryName!!.path
|
||||
|
||||
private fun generate(consumer: Consumer<FinishedRecipe>, items: Map<out DyeColor?, Item>, amount: Int = 1) {
|
||||
for ((k1, v1) in items) {
|
||||
if (k1 == null) continue
|
||||
for ((k2, v2) in items) {
|
||||
if (k2 == null || k1 == k2) continue
|
||||
for ((targetColor, targetItem) in items) {
|
||||
if (targetColor == null) continue
|
||||
|
||||
consumer.accept(PainterRecipe(
|
||||
modLocation("painter/" + v2.recipeName + "/" + v1.recipeName),
|
||||
Ingredient.of(v1),
|
||||
ItemStack(v2),
|
||||
//if (k1 == DyeColor.WHITE || k2 == DyeColor.BLACK) setOf(k2) else setOf(DyeColor.BLACK, k2)
|
||||
mapOf(k2 to amount)
|
||||
).toFinished())
|
||||
}
|
||||
consumer.accept(PainterRecipe(
|
||||
modLocation("painter/" + targetItem.recipeName),
|
||||
Ingredient.of(items.entries.stream().filter { it.key != null && it.key != targetColor }.map { ItemStack(it.value) }),
|
||||
ItemStack(targetItem),
|
||||
mapOf(targetColor to amount)
|
||||
).toFinished())
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,16 +48,12 @@ private fun generate(consumer: Consumer<FinishedRecipe>, default: Item, items: M
|
||||
}
|
||||
|
||||
private fun cleaning(consumer: Consumer<FinishedRecipe>, to: Item, from: Map<out DyeColor?, Item>) {
|
||||
for ((k1, v1) in from) {
|
||||
if (k1 == null) continue
|
||||
|
||||
consumer.accept(PainterRecipe(
|
||||
modLocation("painter/cleaning/" + to.recipeName + "/" + v1.recipeName),
|
||||
Ingredient.of(v1),
|
||||
ItemStack(to),
|
||||
setOf()
|
||||
).toFinished())
|
||||
}
|
||||
consumer.accept(PainterRecipe(
|
||||
modLocation("painter/cleaning/" + to.recipeName),
|
||||
Ingredient.of(from.entries.stream().filter { it.key != null }.map { ItemStack(it.value) }),
|
||||
ItemStack(to),
|
||||
setOf()
|
||||
).toFinished())
|
||||
}
|
||||
|
||||
private fun striped(consumer: Consumer<FinishedRecipe>, name: String, items: List<Pair<Item, Pair<DyeColor, DyeColor>>>, base: Map<DyeColor, Item>) {
|
||||
|
Loading…
Reference in New Issue
Block a user