Skip to content

Commit

Permalink
Add an extra sanity check when disabling initial chunk load
Browse files Browse the repository at this point in the history
  • Loading branch information
BoogieMonster1O1 committed Mar 27, 2021
1 parent 8232e33 commit 45683ab
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
package org.dimdev.vanillafix.bugs.mixins;

import org.dimdev.vanillafix.VanillaFix;
import org.dimdev.vanillafix.util.annotation.MixinConfigValue;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.injection.At;
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;

@MixinConfigValue(category = "bugFixes", value = "disableInitialChunkLoad")
@Mixin(MinecraftServer.class)
@Mixin(value = MinecraftServer.class, priority = 1)
public class MinecraftServerMixin {
/**
* @reason Disable initial chunk load. This makes world load much faster, but in exchange
* the player may see incomplete chunks (like when teleporting to a new area).
* @author ?
*/
@Overwrite
private void prepareStartRegion(WorldGenerationProgressListener worldGenerationProgressListener) {
@Inject(method = "prepareStartRegion", at = @At("HEAD"), cancellable = true)
private void prepareStartRegion(WorldGenerationProgressListener worldGenerationProgressListener, CallbackInfo ci) {
if (VanillaFix.config().bugFixes.disableInitialChunkLoad) {
ci.cancel();
}
}
}

0 comments on commit 45683ab

Please sign in to comment.