Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/main/java/com/lambda/mixin/render/WorldRendererMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,14 @@ private void injectOutlineBlockEntities(Camera camera, float tickProgress, World
Set<BlockPos> xRayTargets = OutlineManager.INSTANCE.getXrayBlockStyles().keySet();
Set<BlockPos> depthTargets = OutlineManager.INSTANCE.getDepthTestedBlockStyles().keySet();

Set<BlockPos> 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()) {
Expand Down
8 changes: 4 additions & 4 deletions src/main/kotlin/com/lambda/config/Configurable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ abstract class Configurable(
immutableCollection: Collection<Block> = 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(
Expand All @@ -149,7 +149,7 @@ abstract class Configurable(
immutableCollection: Collection<Item> = 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 <reified T : Any> setting(
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ClassCollectionSetting<T : Any>(
override fun loadFromJson(serialized: JsonElement) {
val strList = gson.fromJson<MutableList<String>>(serialized, type)
.mapNotNull { str -> immutableCollection.find { it.className == str } }
.toMutableList()
.toMutableSet()

value = strList
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ open class CollectionSetting<R : Any>(
override var value
get() = super.value
set(newVal) {
super.value = newVal.toMutableList()
super.value = LinkedHashSet(newVal)
}

private var searchFilter = ""
Expand Down Expand Up @@ -121,7 +121,7 @@ open class CollectionSetting<R : Any>(
if (serialize) gson.fromJson(serialized, type)
else gson.fromJson<Collection<String>>(serialized, strListType)
.mapNotNull { str -> immutableCollection.find { it.toString() == str } }
.toMutableList()
.toMutableSet()

value = strList
}
Expand Down