Clarify variable

This commit is contained in:
DBotThePony 2023-03-24 23:32:14 +07:00
parent 11e3ff5161
commit d2da3535c1
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -144,16 +144,16 @@ class MatteryRecipe(val result: ItemLike, val count: Int = 1, val category: Reci
return builder return builder
} }
private var source: ResourceLocation? = null private var upgradeSource: ResourceLocation? = null
private val copyPaths = ArrayList<UpgradeRecipe.Op>() private val copyPaths = ArrayList<UpgradeRecipe.Op>()
fun setUpgradeSource(source: ResourceLocation): MatteryRecipe { fun setUpgradeSource(source: ResourceLocation): MatteryRecipe {
this.source = source this.upgradeSource = source
return this return this
} }
fun setUpgradeSource(source: ItemLike): MatteryRecipe { fun setUpgradeSource(source: ItemLike): MatteryRecipe {
this.source = source.asItem().registryName!! this.upgradeSource = source.asItem().registryName!!
return this return this
} }
@ -163,7 +163,7 @@ class MatteryRecipe(val result: ItemLike, val count: Int = 1, val category: Reci
} }
private fun filter(consumer: Consumer<FinishedRecipe>): Consumer<FinishedRecipe> { private fun filter(consumer: Consumer<FinishedRecipe>): Consumer<FinishedRecipe> {
if (source != null) { if (upgradeSource != null) {
check(copyPaths.isNotEmpty()) { "Defined upgrade recipe without nbt migration operations" } check(copyPaths.isNotEmpty()) { "Defined upgrade recipe without nbt migration operations" }
return Consumer { return Consumer {
@ -172,7 +172,7 @@ class MatteryRecipe(val result: ItemLike, val count: Int = 1, val category: Reci
it.serializeRecipeData(pJson) it.serializeRecipeData(pJson)
pJson["copyPaths"] = copyPaths.stream().map { it.serialize() }.collect(JsonArrayCollector) pJson["copyPaths"] = copyPaths.stream().map { it.serialize() }.collect(JsonArrayCollector)
pJson["source"] = source!!.toString() pJson["source"] = upgradeSource!!.toString()
} }
override fun getType(): RecipeSerializer<*> { override fun getType(): RecipeSerializer<*> {