Architectury API (Fabric/Forge/NeoForge)

Architectury API (Fabric/Forge/NeoForge)

158M Downloads

Possible UnsupportedOperationException with Fabric API

henkelmax opened this issue ยท 0 comments

commented

The fabric API changes the field Set<RepositorySource> providers in PackRepository from an ImmutableSet to a HashSet to make it mutable:

https://github.com/FabricMC/fabric/blob/12865e786ce2102d344304a679b70084be84d166/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/ResourcePackManagerMixin.java#L48

This code of yours basically reverts that change:

List<RepositorySource> set = new ArrayList<>(repository.sources);
set.add(source);
repository.sources = ImmutableSet.copyOf(set);

This causes some mods that rely on that change to crash (henkelmax/simple-voice-chat#224).

I am creating a workaround in my mod for that, but it would be nice if this could be fixed.