Use unmodifiable map

This commit is contained in:
DBotThePony 2022-11-06 12:22:56 +07:00
parent 0cf1bbcf24
commit 9e9cac41ee
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -45,6 +45,7 @@ import ru.dbotthepony.mc.otm.core.set
import ru.dbotthepony.mc.otm.data.stream
import ru.dbotthepony.mc.otm.storage.ItemStackWrapper
import java.math.BigInteger
import java.util.Collections
import java.util.stream.Stream
import kotlin.math.pow
@ -753,6 +754,7 @@ object MatterManager : SimpleJsonResourceReloadListener(GsonBuilder().setPrettyP
private val keyEntries = HashMap<ResourceLocation, KeyEntry>()
private val tagEntries = ArrayList<TagEntry>()
private val computedEntries = Reference2ObjectOpenHashMap<Item, Entry>()
val computedEntriesView: Map<Item, Entry> = Collections.unmodifiableMap(computedEntries)
/**
* Returns directly defined matter value
@ -794,7 +796,7 @@ object MatterManager : SimpleJsonResourceReloadListener(GsonBuilder().setPrettyP
@JvmStatic
fun stream(): Stream<Map.Entry<Item, Entry>> {
return computedEntries.entries.stream().filter { it.value.hasMatterValue }
return computedEntriesView.entries.stream().filter { it.value.hasMatterValue }
}
private var resolvedEverything = false