added deep frozen state where chunk tickets will not be expiring as well, preventing chunks from unloading. Fixes #204

This commit is contained in:
gnembon committed 2020-04-14 01:28:00 -03:00
1 parent 07b3029820
commit 3e76adbdaa
5 files changed
+33 -4

No files matched your search

@@ -0,0 +1,23 @@
package carpet.mixins;
import carpet.helpers.TickSpeed;
import net.minecraft.server.world.ChunkTicketManager;
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.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ChunkTicketManager.class)
public class ChunkTicketManager_tickMixin
{
@Shadow private long age;
@Inject(method = "purge", at = @At("HEAD"), cancellable = true)
private void pauseTicketSystem(CallbackInfo ci)
{
// pausing expiry of tickets
// that will prevent also chunks from unloading, so require a deep frozen state
if (!TickSpeed.process_entities && TickSpeed.deepFreeze) age--;
}
}
@@ -120,7 +120,7 @@ public abstract class MinecraftServer_tickspeedMixin extends ReentrantThreadExec
this.profiler.startTick();
this.profiler.push("tick");
this.tick(TickSpeed.time_warp_start_time != 0 ? ()->true : this::shouldKeepTicking);
this.tick(TickSpeed.time_warp_start_time != 0 ? ()->!hasRunningTasks() : this::shouldKeepTicking);
this.profiler.swap("nextTickWait");
this.field_19249 = true;
this.field_19248 = Math.max(Util.getMeasuringTimeMs() + /*50L*/ msThisTick, this.timeReference);