diff --git a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/BiomeSourceMixin.java b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/BiomeSourceMixin.java index 766cdbf822..117d2dca5e 100644 --- a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/BiomeSourceMixin.java +++ b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/BiomeSourceMixin.java @@ -16,8 +16,6 @@ package net.fabricmc.fabric.mixin.biome; -import java.util.Collections; -import java.util.LinkedHashSet; import java.util.Set; import java.util.function.Supplier; @@ -33,11 +31,10 @@ public class BiomeSourceMixin { @Redirect(method = "getBiomes", at = @At(value = "INVOKE", target = "Ljava/util/function/Supplier;get()Ljava/lang/Object;")) private Object getBiomes(Supplier>> instance) { - var biomes = new LinkedHashSet<>(instance.get()); - fabric_modifyBiomeSet(biomes); - return Collections.unmodifiableSet(biomes); + return fabric_modifyBiomeSet(instance.get()); } - protected void fabric_modifyBiomeSet(Set> biomes) { + protected Set> fabric_modifyBiomeSet(Set> biomes) { + return biomes; } } diff --git a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/TheEndBiomeSourceMixin.java b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/TheEndBiomeSourceMixin.java index 3d156f4c6e..09ee624240 100644 --- a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/TheEndBiomeSourceMixin.java +++ b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/TheEndBiomeSourceMixin.java @@ -16,6 +16,8 @@ package net.fabricmc.fabric.mixin.biome; +import java.util.Collections; +import java.util.LinkedHashSet; import java.util.Set; import java.util.function.Supplier; @@ -108,14 +110,18 @@ private void getWeightedEndBiome(int biomeX, int biomeY, int biomeZ, MultiNoiseU } @Override - protected void fabric_modifyBiomeSet(Set> biomes) { + protected Set> fabric_modifyBiomeSet(Set> biomes) { if (!hasCheckedForModifiedSet) { hasCheckedForModifiedSet = true; biomeSetModified = !overrides.get().customBiomes.isEmpty(); } if (biomeSetModified) { - biomes.addAll(overrides.get().customBiomes); + var modifiedBiomes = new LinkedHashSet<>(biomes); + modifiedBiomes.addAll(overrides.get().customBiomes); + return Collections.unmodifiableSet(modifiedBiomes); } + + return biomes; } }