From 3dd584b41fa824d2ad53afe7239f47736eefb331 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sun, 20 Nov 2022 13:19:53 +0000 Subject: [PATCH] Adjust nether biomes injection point (#2666) Co-authored-by: apple502j <33279053+apple502j@users.noreply.github.com> --- .../fabric/mixin/biome/MinecraftServerMixin.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/MinecraftServerMixin.java b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/MinecraftServerMixin.java index 06411dda2..3785ce044 100644 --- a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/MinecraftServerMixin.java +++ b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/MinecraftServerMixin.java @@ -24,14 +24,14 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.WorldGenerationProgressListener; import net.minecraft.util.registry.DynamicRegistryManager; import net.minecraft.util.registry.Registry; import net.minecraft.world.SaveProperties; import net.fabricmc.fabric.impl.biome.NetherBiomeData; -@Mixin(MinecraftServer.class) +// Priority set just below biome modification mixin's +@Mixin(value = MinecraftServer.class, priority = 990) public class MinecraftServerMixin { @Shadow @Final @@ -41,11 +41,8 @@ public class MinecraftServerMixin { @Final private DynamicRegistryManager.Immutable registryManager; - @Inject(method = "createWorlds", at = @At("HEAD")) - private void addNetherBiomes(WorldGenerationProgressListener worldGenerationProgressListener, CallbackInfo ci) { - // This is the last point where we can safely modify worldgen related things - // plus, this is server-side only, and DRM is easily accessible - // please blame Mojang for using dynamic registry + @Inject(method = "", at = @At("RETURN")) + private void addNetherBiomes(CallbackInfo ci) { this.saveProperties.getGeneratorOptions().getDimensions().stream().forEach(dimensionOptions -> NetherBiomeData.modifyBiomeSource(this.registryManager.get(Registry.BIOME_KEY), dimensionOptions.getChunkGenerator().getBiomeSource())); } }