Use unmodifiable map
This commit is contained in:
parent
0cf1bbcf24
commit
9e9cac41ee
@ -45,6 +45,7 @@ import ru.dbotthepony.mc.otm.core.set
|
|||||||
import ru.dbotthepony.mc.otm.data.stream
|
import ru.dbotthepony.mc.otm.data.stream
|
||||||
import ru.dbotthepony.mc.otm.storage.ItemStackWrapper
|
import ru.dbotthepony.mc.otm.storage.ItemStackWrapper
|
||||||
import java.math.BigInteger
|
import java.math.BigInteger
|
||||||
|
import java.util.Collections
|
||||||
import java.util.stream.Stream
|
import java.util.stream.Stream
|
||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
|
|
||||||
@ -753,6 +754,7 @@ object MatterManager : SimpleJsonResourceReloadListener(GsonBuilder().setPrettyP
|
|||||||
private val keyEntries = HashMap<ResourceLocation, KeyEntry>()
|
private val keyEntries = HashMap<ResourceLocation, KeyEntry>()
|
||||||
private val tagEntries = ArrayList<TagEntry>()
|
private val tagEntries = ArrayList<TagEntry>()
|
||||||
private val computedEntries = Reference2ObjectOpenHashMap<Item, Entry>()
|
private val computedEntries = Reference2ObjectOpenHashMap<Item, Entry>()
|
||||||
|
val computedEntriesView: Map<Item, Entry> = Collections.unmodifiableMap(computedEntries)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns directly defined matter value
|
* Returns directly defined matter value
|
||||||
@ -794,7 +796,7 @@ object MatterManager : SimpleJsonResourceReloadListener(GsonBuilder().setPrettyP
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun stream(): Stream<Map.Entry<Item, Entry>> {
|
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
|
private var resolvedEverything = false
|
||||||
|
Loading…
Reference in New Issue
Block a user