-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Capture Registries even earlier
- Loading branch information
Showing
3 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/java/com/terraformersmc/biolith/impl/mixin/MixinSaveLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.terraformersmc.biolith.impl.mixin; | ||
|
||
import net.minecraft.registry.CombinedDynamicRegistries; | ||
import net.minecraft.registry.ServerDynamicRegistryType; | ||
import net.minecraft.server.SaveLoader; | ||
|
||
import com.terraformersmc.biolith.impl.biome.BiomeCoordinator; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyVariable; | ||
|
||
@Mixin(value=SaveLoader.class, priority = 500) | ||
public class MixinSaveLoader { | ||
@Shadow @Final private CombinedDynamicRegistries<ServerDynamicRegistryType> combinedDynamicRegistries; | ||
|
||
@ModifyVariable(method = "<init>", argsOnly = true, at = @At(value = "INVOKE", target = "Ljava/lang/Record;<init>()V", shift = At.Shift.AFTER)) | ||
private CombinedDynamicRegistries<ServerDynamicRegistryType> biolith$earlyCaptureRegistries( | ||
CombinedDynamicRegistries<ServerDynamicRegistryType> combinedDynamicRegistries | ||
) { | ||
System.out.println("Biolith: early capture registries"); | ||
// We need the registries really early in case TerraBlender calls us before the Fabric server start event. | ||
BiomeCoordinator.setRegistryManager(combinedDynamicRegistries); | ||
return combinedDynamicRegistries; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters