diff --git a/gradle.properties b/gradle.properties index 2c395a3..ad7a71b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ org.gradle.jvmargs = -Xmx3G # No daemon org.gradle.daemon = false -modVersion = 1.0 +modVersion = 1.0.1-dev # The modid of the mod modId = bettercaves diff --git a/src/main/java/com/yungnickyoung/minecraft/bettercaves/init/BCFeature.java b/src/main/java/com/yungnickyoung/minecraft/bettercaves/init/BCFeature.java index 5862171..4557f23 100644 --- a/src/main/java/com/yungnickyoung/minecraft/bettercaves/init/BCFeature.java +++ b/src/main/java/com/yungnickyoung/minecraft/bettercaves/init/BCFeature.java @@ -67,8 +67,8 @@ private static void lateSetup() { // These will be used in dimensions where Better Caves is not whitelisted. List>> defaultAirCarvers = biome.func_242440_e().func_242489_a(GenerationStage.Carving.AIR); List>> defaultLiquidCarvers = biome.func_242440_e().func_242489_a(GenerationStage.Carving.LIQUID); - BetterCaves.defaultBiomeAirCarvers.put(biome.toString(), defaultAirCarvers); - BetterCaves.defaultBiomeLiquidCarvers.put(biome.toString(), defaultLiquidCarvers); + BetterCaves.defaultBiomeAirCarvers.put(biome.toString(), convertImmutableList(defaultAirCarvers)); + BetterCaves.defaultBiomeLiquidCarvers.put(biome.toString(), convertImmutableList(defaultLiquidCarvers)); // Use Access Transformer to make carvers field public so we can replace with empty list biome.func_242440_e().field_242483_e = Maps.newHashMap(); @@ -79,9 +79,9 @@ private static void lateSetup() { while (biomeFeatures.size() <= GenerationStage.Decoration.RAW_GENERATION.ordinal()) { biomeFeatures.add(Lists.newArrayList()); } - biomeFeatures.get(GenerationStage.Decoration.RAW_GENERATION.ordinal()).add(0, - () -> CONFIGURED_BETTERCAVES_FEATURE - ); + List>> rawGenSuppliers = convertImmutableList(biomeFeatures.get(GenerationStage.Decoration.RAW_GENERATION.ordinal())); + rawGenSuppliers.add(0, () -> CONFIGURED_BETTERCAVES_FEATURE); + biomeFeatures.set(GenerationStage.Decoration.RAW_GENERATION.ordinal(), rawGenSuppliers); } } @@ -126,9 +126,23 @@ public static void configChanged(ModConfig.ModConfigEvent event) { } } + /** + * In 1.16.2, many lists were made immutable. Other modders seemingly have confused themselves and made + * mutable lists immutable after processing them. This method serves to help avoid problems arising from + * attempting to modify immutable collections. + */ private static void convertImmutableFeatures(Biome biome) { if (biome.func_242440_e().field_242484_f instanceof ImmutableList) { biome.func_242440_e().field_242484_f = biome.func_242440_e().field_242484_f.stream().map(Lists::newArrayList).collect(Collectors.toList()); } } + + /** + * In 1.16.2, many lists were made immutable. Other modders seemingly have confused themselves and made + * mutable lists immutable after processing them. This method serves to help avoid problems arising from + * attempting to modify immutable collections. + */ + private static List convertImmutableList(List list) { + return new ArrayList<>(list); + } }