Skip to content

Commit

Permalink
fix runtime world chunk generator crash
Browse files Browse the repository at this point in the history
  • Loading branch information
LCLPYT authored and pisaiah committed Jun 13, 2024
1 parent 042a578 commit 4c25e02
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,20 @@

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.server.world.ServerChunkLoadingManager;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.chunk.ChunkGeneratorSettings;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import xyz.nucleoid.fantasy.util.ChunkGeneratorSettingsProvider;

@Mixin(ServerChunkLoadingManager.class)
public abstract class ServerChunkLoadingManagerMixin {

@Shadow
public abstract ChunkGenerator getChunkGenerator();
public class ServerChunkLoadingManagerMixin {

@WrapOperation(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/gen/chunk/ChunkGeneratorSettings;createMissingSettings()Lnet/minecraft/world/gen/chunk/ChunkGeneratorSettings;"))
private ChunkGeneratorSettings fantasy$useProvidedChunkGeneratorSettings(Operation<ChunkGeneratorSettings> original) {
if (this.getChunkGenerator() instanceof ChunkGeneratorSettingsProvider provider) {
private ChunkGeneratorSettings fantasy$useProvidedChunkGeneratorSettings(Operation<ChunkGeneratorSettings> original, @Local(argsOnly = true) ChunkGenerator chunkGenerator) {
if (chunkGenerator instanceof ChunkGeneratorSettingsProvider provider) {
ChunkGeneratorSettings settings = provider.getSettings();
if (settings != null) return settings;
}
Expand Down

0 comments on commit 4c25e02

Please sign in to comment.