Skip to content

Commit 45683ab

Browse files
Add an extra sanity check when disabling initial chunk load
1 parent 8232e33 commit 45683ab

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
package org.dimdev.vanillafix.bugs.mixins;
22

3+
import org.dimdev.vanillafix.VanillaFix;
34
import org.dimdev.vanillafix.util.annotation.MixinConfigValue;
45
import org.spongepowered.asm.mixin.Mixin;
56
import org.spongepowered.asm.mixin.Overwrite;
7+
import org.spongepowered.asm.mixin.injection.At;
8+
import org.spongepowered.asm.mixin.injection.Inject;
9+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
610

711
import net.minecraft.server.MinecraftServer;
812
import net.minecraft.server.WorldGenerationProgressListener;
913

1014
@MixinConfigValue(category = "bugFixes", value = "disableInitialChunkLoad")
11-
@Mixin(MinecraftServer.class)
15+
@Mixin(value = MinecraftServer.class, priority = 1)
1216
public class MinecraftServerMixin {
1317
/**
1418
* @reason Disable initial chunk load. This makes world load much faster, but in exchange
1519
* the player may see incomplete chunks (like when teleporting to a new area).
1620
* @author ?
1721
*/
18-
@Overwrite
19-
private void prepareStartRegion(WorldGenerationProgressListener worldGenerationProgressListener) {
22+
@Inject(method = "prepareStartRegion", at = @At("HEAD"), cancellable = true)
23+
private void prepareStartRegion(WorldGenerationProgressListener worldGenerationProgressListener, CallbackInfo ci) {
24+
if (VanillaFix.config().bugFixes.disableInitialChunkLoad) {
25+
ci.cancel();
26+
}
2027
}
2128
}

0 commit comments

Comments
 (0)