Don't store modification chain since it is not used anywhere

This commit is contained in:
DBotThePony 2022-11-23 19:47:39 +07:00
parent 033660a357
commit d39c0d33a3
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -95,7 +95,6 @@ import kotlin.collections.LinkedHashMap
import kotlin.math.pow import kotlin.math.pow
internal sealed class MutableEntry( internal sealed class MutableEntry(
val modificationChain: MutableList<ResourceLocation>,
var matter: ImpreciseFraction, var matter: ImpreciseFraction,
var complexity: Double, var complexity: Double,
var priority: Int var priority: Int
@ -105,23 +104,21 @@ internal sealed class MutableEntry(
internal class MutableTagEntry( internal class MutableTagEntry(
val tag: TagKey<Item>, val tag: TagKey<Item>,
modificationChain: MutableList<ResourceLocation>,
matter: ImpreciseFraction, matter: ImpreciseFraction,
complexity: Double, complexity: Double,
priority: Int priority: Int
) : MutableEntry(modificationChain, matter, complexity, priority) { ) : MutableEntry(matter, complexity, priority) {
override fun freeze(): Entry { override fun freeze(): Entry {
return TagEntry(tag, ImmutableList.copyOf(modificationChain), matter, complexity, priority) return TagEntry(tag, matter, complexity, priority)
} }
} }
internal class MutableKeyEntry( internal class MutableKeyEntry(
val key: ResourceLocation, val key: ResourceLocation,
modificationChain: MutableList<ResourceLocation>,
matter: ImpreciseFraction, matter: ImpreciseFraction,
complexity: Double, complexity: Double,
priority: Int priority: Int
) : MutableEntry(modificationChain, matter, complexity, priority) { ) : MutableEntry(matter, complexity, priority) {
init { init {
if (key == AIR) { if (key == AIR) {
throw JsonSyntaxException("you wot, can't modify $key") throw JsonSyntaxException("you wot, can't modify $key")
@ -129,7 +126,7 @@ internal class MutableKeyEntry(
} }
override fun freeze(): Entry { override fun freeze(): Entry {
return KeyEntry(key, ImmutableList.copyOf(modificationChain), matter, complexity, priority) return KeyEntry(key, matter, complexity, priority)
} }
companion object { companion object {
@ -138,21 +135,19 @@ internal class MutableKeyEntry(
} }
internal sealed class Entry( internal sealed class Entry(
val modificationChain: List<ResourceLocation>,
final override val matter: ImpreciseFraction, final override val matter: ImpreciseFraction,
final override val complexity: Double, final override val complexity: Double,
val priority: Int, val priority: Int,
) : IMatterValue { ) : IMatterValue {
companion object : Entry(listOf(), ImpreciseFraction.ZERO, 0.0, Int.MIN_VALUE) companion object : Entry(ImpreciseFraction.ZERO, 0.0, Int.MIN_VALUE)
} }
internal class TagEntry( internal class TagEntry(
val tag: TagKey<Item>, val tag: TagKey<Item>,
modificationChain: List<ResourceLocation>,
matter: ImpreciseFraction, matter: ImpreciseFraction,
complexity: Double, complexity: Double,
priority: Int, priority: Int,
) : Entry(modificationChain, matter, complexity, priority) { ) : Entry(matter, complexity, priority) {
val bound by lazy { val bound by lazy {
val manager = ForgeRegistries.ITEMS.tags() ?: throw NullPointerException("Forge registry of Items has no tags!") val manager = ForgeRegistries.ITEMS.tags() ?: throw NullPointerException("Forge registry of Items has no tags!")
manager.getTag(tag) manager.getTag(tag)
@ -161,11 +156,10 @@ internal class TagEntry(
internal class KeyEntry( internal class KeyEntry(
val key: ResourceLocation, val key: ResourceLocation,
modificationChain: List<ResourceLocation>,
matter: ImpreciseFraction, matter: ImpreciseFraction,
complexity: Double, complexity: Double,
priority: Int, priority: Int,
) : Entry(modificationChain, matter, complexity, priority) ) : Entry(matter, complexity, priority)
private fun transformQuotes(it: String?): String = if (it != null) '"' + it.replace("\"", "\"\"") + '"' else "NULL" private fun transformQuotes(it: String?): String = if (it != null) '"' + it.replace("\"", "\"\"") + '"' else "NULL"