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