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.Items
|
||||||
import net.minecraft.world.item.crafting.Ingredient
|
import net.minecraft.world.item.crafting.Ingredient
|
||||||
import ru.dbotthepony.mc.otm.core.registryName
|
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.datagen.modLocation
|
||||||
import ru.dbotthepony.mc.otm.recipe.PainterRecipe
|
import ru.dbotthepony.mc.otm.recipe.PainterRecipe
|
||||||
import ru.dbotthepony.mc.otm.registry.MItems
|
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 val Item.recipeName get() = registryName!!.namespace + "/" + registryName!!.path
|
||||||
|
|
||||||
private fun generate(consumer: Consumer<FinishedRecipe>, items: Map<out DyeColor?, Item>, amount: Int = 1) {
|
private fun generate(consumer: Consumer<FinishedRecipe>, items: Map<out DyeColor?, Item>, amount: Int = 1) {
|
||||||
for ((k1, v1) in items) {
|
for ((targetColor, targetItem) in items) {
|
||||||
if (k1 == null) continue
|
if (targetColor == null) continue
|
||||||
for ((k2, v2) in items) {
|
|
||||||
if (k2 == null || k1 == k2) continue
|
|
||||||
|
|
||||||
consumer.accept(PainterRecipe(
|
consumer.accept(PainterRecipe(
|
||||||
modLocation("painter/" + v2.recipeName + "/" + v1.recipeName),
|
modLocation("painter/" + targetItem.recipeName),
|
||||||
Ingredient.of(v1),
|
Ingredient.of(items.entries.stream().filter { it.key != null && it.key != targetColor }.map { ItemStack(it.value) }),
|
||||||
ItemStack(v2),
|
ItemStack(targetItem),
|
||||||
//if (k1 == DyeColor.WHITE || k2 == DyeColor.BLACK) setOf(k2) else setOf(DyeColor.BLACK, k2)
|
mapOf(targetColor to amount)
|
||||||
mapOf(k2 to amount)
|
).toFinished())
|
||||||
).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>) {
|
private fun cleaning(consumer: Consumer<FinishedRecipe>, to: Item, from: Map<out DyeColor?, Item>) {
|
||||||
for ((k1, v1) in from) {
|
consumer.accept(PainterRecipe(
|
||||||
if (k1 == null) continue
|
modLocation("painter/cleaning/" + to.recipeName),
|
||||||
|
Ingredient.of(from.entries.stream().filter { it.key != null }.map { ItemStack(it.value) }),
|
||||||
consumer.accept(PainterRecipe(
|
ItemStack(to),
|
||||||
modLocation("painter/cleaning/" + to.recipeName + "/" + v1.recipeName),
|
setOf()
|
||||||
Ingredient.of(v1),
|
).toFinished())
|
||||||
ItemStack(to),
|
|
||||||
setOf()
|
|
||||||
).toFinished())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun striped(consumer: Consumer<FinishedRecipe>, name: String, items: List<Pair<Item, Pair<DyeColor, DyeColor>>>, base: Map<DyeColor, Item>) {
|
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