Skip to content

Causes datapack error screen to appear when entering worlds with json dimensions #3

@TelepathicGrunt

Description

@TelepathicGrunt

Hello, I am the developer for Bumblezone
https://www.curseforge.com/minecraft/mc-mods/the-bumblezone-fabric

A user was trying to play with Bumblezone and Disable VIllagers together and kept getting a datapack error screen preventing them from entering any world. When I got their stacktrace, it showed that the error was due to a mixin that was crashing:

java.lang.UnsupportedOperationException: null
    at com.google.common.collect.ImmutableMap.remove(ImmutableMap.java:851) ~[guava-31.0.1-jre.jar:?]
    at net.minecraft.world.gen.chunk.StructuresConfig.handler$zfo000$injectConstructor(StructuresConfig.java:1523) ~[client-intermediary.jar:?]
    at net.minecraft.world.gen.chunk.StructuresConfig.<init>(StructuresConfig.java:87) ~[client-intermediary.jar:?]
    at com.mojang.serialization.DataResult$Instance.ap2(DataResult.java:315) ~[datafixerupper-4.0.26.jar:?]
    at com.mojang.serialization.codecs.RecordCodecBuilder$Instance$3.decode(RecordCodecBuilder.java:246) ~[datafixerupper-4.0.26.jar:?]
    at com.mojang.serialization.codecs.RecordCodecBuilder$2.decode(RecordCodecBuilder.java:107) ~[datafixerupper-4.0.26.jar:?]
    at com.mojang.serialization.MapDecoder.lambda$compressedDecode$0(MapDecoder.java:52) ~[datafixerupper-4.0.26.jar:?]
    at com.mojang.serialization.DataResult.lambda$flatMap$10(DataResult.java:138) ~[datafixerupper-4.0.26.jar:?]
    at com.mojang.datafixers.util.Either$Left.map(Either.java:38) ~[datafixerupper-4.0.26.jar:?]
    at com.mojang.serialization.DataResult.flatMap(DataResult.java:136) ~[datafixerupper-4.0.26.jar:?]
    at com.mojang.serialization.MapDecoder.compressedDecode(MapDecoder.java:52) ~[datafixerupper-4.0.26.jar:?]
    at com.mojang.serialization.MapCodec$MapCodecCodec.decode(MapCodec.java:91) ~[datafixerupper-4.0.26.jar:?]

The cause is this mixin because when a user uses a mod or datapack that has a json dimension, that Map<StructureFeature<?>, StructureConfig> becomes an immutable map which now prevents removals. You may need to construct a new map, move all the entries to that map, and reassign the field itself to hold that new map

I hope this helps!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions