diff --git a/src/main/java/com/lambda/mixin/render/WorldRendererMixin.java b/src/main/java/com/lambda/mixin/render/WorldRendererMixin.java index f614aec49..163570406 100644 --- a/src/main/java/com/lambda/mixin/render/WorldRendererMixin.java +++ b/src/main/java/com/lambda/mixin/render/WorldRendererMixin.java @@ -127,11 +127,14 @@ private void injectOutlineBlockEntities(Camera camera, float tickProgress, World Set xRayTargets = OutlineManager.INSTANCE.getXrayBlockStyles().keySet(); Set depthTargets = OutlineManager.INSTANCE.getDepthTestedBlockStyles().keySet(); + Set alreadyCollected = new java.util.HashSet<>(); + for (BlockEntityRenderState s : renderStates.blockEntityRenderStates) { + alreadyCollected.add(s.pos); + } + for (BlockPos target : Sets.union(xRayTargets, depthTargets)) { if (!this.world.getChunkManager().isChunkLoaded(target.getX() >> 4, target.getZ() >> 4)) continue; - boolean alreadyCollected = renderStates.blockEntityRenderStates.stream() - .anyMatch(state -> state.pos.equals(target)); - if (alreadyCollected) continue; + if (alreadyCollected.contains(target)) continue; BlockEntity blockEntity = this.world.getBlockEntity(target); if (blockEntity != null && !blockEntity.isRemoved()) { diff --git a/src/main/kotlin/com/lambda/config/Configurable.kt b/src/main/kotlin/com/lambda/config/Configurable.kt index 030520a42..7728a0dad 100644 --- a/src/main/kotlin/com/lambda/config/Configurable.kt +++ b/src/main/kotlin/com/lambda/config/Configurable.kt @@ -140,7 +140,7 @@ abstract class Configurable( immutableCollection: Collection = Registries.BLOCK.toList(), description: String = "", visibility: () -> Boolean = { true }, - ) = Setting(name, description, BlockCollectionSetting(immutableCollection, defaultValue.toMutableList()), this, visibility).register() + ) = Setting(name, description, BlockCollectionSetting(immutableCollection, LinkedHashSet(defaultValue)), this, visibility).register() @JvmName("collectionSetting2") fun setting( @@ -149,7 +149,7 @@ abstract class Configurable( immutableCollection: Collection = Registries.ITEM.toList(), description: String = "", visibility: () -> Boolean = { true }, - ) = Setting(name, description, ItemCollectionSetting(immutableCollection, defaultValue.toMutableList()), this, visibility).register() + ) = Setting(name, description, ItemCollectionSetting(immutableCollection, LinkedHashSet(defaultValue)), this, visibility).register() @JvmName("collectionSetting3") inline fun setting( @@ -163,8 +163,8 @@ abstract class Configurable( ) = Setting( name, description, - if (displayClassName) ClassCollectionSetting(immutableList, defaultValue.toMutableList()) - else CollectionSetting(defaultValue.toMutableList(), immutableList, TypeToken.getParameterized(Collection::class.java, T::class.java).type, serialize), + if (displayClassName) ClassCollectionSetting(immutableList, LinkedHashSet(defaultValue)) + else CollectionSetting(LinkedHashSet(defaultValue), immutableList, TypeToken.getParameterized(Collection::class.java, T::class.java).type, serialize), this, visibility ).register() diff --git a/src/main/kotlin/com/lambda/config/settings/collections/ClassCollectionSetting.kt b/src/main/kotlin/com/lambda/config/settings/collections/ClassCollectionSetting.kt index f1064a061..36d4ba8da 100644 --- a/src/main/kotlin/com/lambda/config/settings/collections/ClassCollectionSetting.kt +++ b/src/main/kotlin/com/lambda/config/settings/collections/ClassCollectionSetting.kt @@ -50,7 +50,7 @@ class ClassCollectionSetting( override fun loadFromJson(serialized: JsonElement) { val strList = gson.fromJson>(serialized, type) .mapNotNull { str -> immutableCollection.find { it.className == str } } - .toMutableList() + .toMutableSet() value = strList } diff --git a/src/main/kotlin/com/lambda/config/settings/collections/CollectionSetting.kt b/src/main/kotlin/com/lambda/config/settings/collections/CollectionSetting.kt index 0817a515e..b468c0fb0 100644 --- a/src/main/kotlin/com/lambda/config/settings/collections/CollectionSetting.kt +++ b/src/main/kotlin/com/lambda/config/settings/collections/CollectionSetting.kt @@ -55,7 +55,7 @@ open class CollectionSetting( override var value get() = super.value set(newVal) { - super.value = newVal.toMutableList() + super.value = LinkedHashSet(newVal) } private var searchFilter = "" @@ -121,7 +121,7 @@ open class CollectionSetting( if (serialize) gson.fromJson(serialized, type) else gson.fromJson>(serialized, strListType) .mapNotNull { str -> immutableCollection.find { it.toString() == str } } - .toMutableList() + .toMutableSet() value = strList }