-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an extra sanity check when disabling initial chunk load
- Loading branch information
1 parent
8232e33
commit 45683ab
Showing
1 changed file
with
10 additions
and
3 deletions.
There are no files selected for viewing
13 changes: 10 additions & 3 deletions
13
src/main/java/org/dimdev/vanillafix/bugs/mixins/MinecraftServerMixin.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 |
---|---|---|
@@ -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(); | ||
} | ||
} | ||
} |