вовращаем меканизм + бамп версии неофбабрика + рецепты покраски для красителя из меканизма #203

This commit is contained in:
YuRaNnNzZZ 2024-12-12 07:58:55 +03:00
parent 3cbc7b417f
commit 9689153910
Signed by: YuRaNnNzZZ
GPG Key ID: 5F71738C85A6006D
3 changed files with 66 additions and 2 deletions

View File

@ -171,6 +171,7 @@ dependencies {
val prism_lib_id: String by project
val cloth_config_version: String by project
val condensed_creative_version: String by project
val mekanism_version: String by project
compileOnly("top.theillusivec4.curios:curios-neoforge:${curios_version}+${curios_mc_version}")
implementation("curse.maven:cosmetic-armor-reworked-237307:$cosmetic_armor_reworked_id")
@ -207,6 +208,8 @@ dependencies {
// runtimeOnly("curse.maven:integrated-terminals-295910:4400924")
// runtimeOnly("curse.maven:common-capabilities-247007:4391468")
// runtimeOnly("curse.maven:integrated-tunnels-251389:4344632")
implementation("mekanism:Mekanism:${mc_version}-${mekanism_version}")
}
}
@ -276,7 +279,6 @@ repositories {
content {
includeGroup("yalter.mousetweaks")
includeGroup("mekanism")
includeGroup("lain.mods.cos")
includeGroup("at.ridgo8.moreoverlays")
includeGroup("ru.dbotthepony")
@ -338,6 +340,14 @@ repositories {
}
}
maven {
url = uri("https://modmaven.dev/")
content {
includeGroup("mekanism")
}
}
// mavenCentral()
}

View File

@ -15,7 +15,7 @@ jei_mc_version=1.21.1
curios_mc_version=1.21
forge_gradle_version=7.0.153
forge_version=21.1.1
forge_version=21.1.21
mixingradle_version=0.7.33
mixin_version=0.8.5
@ -37,6 +37,7 @@ iceberg_id=5750025
prism_lib_id=5625115
cloth_config_version=15.0.130
condensed_creative_version=3.4.1+1.21
mekanism_version=10.7.7.64
kotlin_for_forge_version=5.5.0
kotlin_version=2.0.10

View File

@ -1,11 +1,17 @@
package ru.dbotthepony.mc.otm.datagen.recipes
import mekanism.api.recipes.basic.BasicPaintingRecipe
import mekanism.api.recipes.ingredients.creator.IngredientCreatorAccess
import mekanism.api.text.EnumColor
import mekanism.common.registries.MekanismChemicals
import net.minecraft.data.recipes.RecipeOutput
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.item.DyeColor
import net.minecraft.world.item.Item
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items
import net.minecraft.world.item.crafting.Ingredient
import net.neoforged.fml.ModList
import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.recipe.PainterArmorDyeRecipe
@ -15,6 +21,10 @@ import ru.dbotthepony.mc.otm.registry.MRegistry
private val Item.recipeName get() = registryName!!.namespace + "/" + registryName!!.path
private val isMekanismLoaded by lazy {
ModList.get().isLoaded("mekanism")
}
private fun generate(consumer: RecipeOutput, items: Map<out DyeColor?, Item>, amount: Int = 1) {
for ((targetColor, targetItem) in items) {
if (targetColor == null) continue
@ -24,6 +34,16 @@ private fun generate(consumer: RecipeOutput, items: Map<out DyeColor?, Item>, am
ItemStack(targetItem),
mapOf(targetColor to amount, null to 15)
))
if (isMekanismLoaded) {
addMekanismPaintRecipe(consumer,
modLocation("mekanism/painter/" + targetItem.recipeName),
Ingredient.of(items.entries.stream().filter { it.key != null && it.key != targetColor }.map { ItemStack(it.value) }),
ItemStack(targetItem),
targetColor,
amount
)
}
}
}
@ -41,6 +61,16 @@ private fun generate(consumer: RecipeOutput, default: Item, items: Map<out DyeCo
ItemStack(v1),
mapOf(k1 to amount)
))
if (isMekanismLoaded) {
addMekanismPaintRecipe(consumer,
modLocation("mekanism/painter/" + default.recipeName + "/" + v1.recipeName),
Ingredient.of(default),
ItemStack(v1),
k1,
amount
)
}
}
}
@ -65,7 +95,30 @@ private fun striped(consumer: RecipeOutput, name: String, items: List<Pair<Item,
ItemStack(stripeItem),
setOf(stripe)
))
if (isMekanismLoaded) {
addMekanismPaintRecipe(consumer,
modLocation("mekanism/painter/stripes_$name/${baseColor.getName()}/${stripe.getName()}"),
Ingredient.of(base[baseColor]),
ItemStack(stripeItem),
stripe
)
}
}
}
private fun addMekanismPaintRecipe(consumer: RecipeOutput, location: ResourceLocation, input: Ingredient, output: ItemStack, dye: DyeColor, amount: Int = 1, dyeMul: Float = 0.125F) {
if (output.item.registryName?.namespace == "minecraft") return // mekanism already has painting recipes for vanilla
val color = EnumColor.entries.find{it.dyeColor == dye} ?: return
val pigment = MekanismChemicals.PIGMENT_COLOR_LOOKUP.get(color) ?: return
consumer.accept(location, BasicPaintingRecipe(
IngredientCreatorAccess.item().from(input),
IngredientCreatorAccess.chemicalStack().from(pigment, (256L * amount * dyeMul).toLong()),
output.copy(),
false
))
}
fun addPainterRecipes(consumer: RecipeOutput) {