Skip to content

Commit

Permalink
fix: type erasure
Browse files Browse the repository at this point in the history
  • Loading branch information
rvbsm committed Apr 25, 2024
1 parent 3c528bb commit b0c49c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/main/kotlin/dev/rvbsm/fsit/config/container/Container.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import net.minecraft.registry.tag.TagKey
import java.util.function.Predicate

sealed class Container<E : ItemConvertible, S>(
val registry: DefaultedRegistry<E>,
private val registry: DefaultedRegistry<E>,
val entries: MutableSet<E> = mutableSetOf(),
val tags: MutableSet<TagKey<E>> = mutableSetOf(),
) : Predicate<S> {
Expand All @@ -28,7 +28,7 @@ sealed class Container<E : ItemConvertible, S>(
entries.addAll(newEntries)
}

fun updateEntries(ids: Iterable<String>) {
fun updateEntriesByIds(ids: Iterable<String>) {
updateEntries(ids.parseEntries(registry))
}

Expand All @@ -37,7 +37,7 @@ sealed class Container<E : ItemConvertible, S>(
tags.addAll(newTags)
}

fun updateTags(ids: Iterable<String>) {
fun updateTagsByIds(ids: Iterable<String>) {
updateTags(ids.parseTags(registry))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ internal class ContainerProperty<E : ItemConvertible, C : Container<E, *>>(

private fun migrate(ids: Iterable<String>) = when (type) {
Type.ENTRIES -> {
container!!.updateEntries(ids)
container!!.updateEntriesByIds(ids)
}

Type.TAGS -> {
container!!.updateTags(ids.map { "#$it" })
container!!.updateTagsByIds(ids.map { "#$it" })
}

Type.CONTAINER -> {
container!!.updateEntries(ids)
container!!.updateTags(ids)
container!!.updateEntriesByIds(ids)
container!!.updateTagsByIds(ids)
}
}

Expand Down

0 comments on commit b0c49c4

Please sign in to comment.