run all tasks when warping
This commit is contained in:
1 parent
f4fd31e9fa
commit
b8521c8bbf
1 file changed
+14
-2
@@ -3,8 +3,10 @@ package carpet.mixins;
|
|||||||
import carpet.helpers.TickSpeed;
|
import carpet.helpers.TickSpeed;
|
||||||
import carpet.utils.CarpetProfiler;
|
import carpet.utils.CarpetProfiler;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.server.ServerTask;
|
||||||
import net.minecraft.util.Util;
|
import net.minecraft.util.Util;
|
||||||
import net.minecraft.util.profiler.DisableableProfiler;
|
import net.minecraft.util.profiler.DisableableProfiler;
|
||||||
|
import net.minecraft.util.thread.ReentrantThreadExecutor;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -17,7 +19,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
import java.util.function.BooleanSupplier;
|
import java.util.function.BooleanSupplier;
|
||||||
|
|
||||||
@Mixin(MinecraftServer.class)
|
@Mixin(MinecraftServer.class)
|
||||||
public abstract class MinecraftServer_tickspeedMixin
|
public abstract class MinecraftServer_tickspeedMixin extends ReentrantThreadExecutor<ServerTask>
|
||||||
{
|
{
|
||||||
@Shadow private volatile boolean running;
|
@Shadow private volatile boolean running;
|
||||||
|
|
||||||
@@ -31,6 +33,11 @@ public abstract class MinecraftServer_tickspeedMixin
|
|||||||
|
|
||||||
@Shadow @Final private DisableableProfiler profiler;
|
@Shadow @Final private DisableableProfiler profiler;
|
||||||
|
|
||||||
|
public MinecraftServer_tickspeedMixin(String name)
|
||||||
|
{
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
|
||||||
@Shadow protected abstract void tick(BooleanSupplier booleanSupplier_1);
|
@Shadow protected abstract void tick(BooleanSupplier booleanSupplier_1);
|
||||||
|
|
||||||
@Shadow protected abstract boolean shouldKeepTicking();
|
@Shadow protected abstract boolean shouldKeepTicking();
|
||||||
@@ -117,7 +124,12 @@ public abstract class MinecraftServer_tickspeedMixin
|
|||||||
this.profiler.swap("nextTickWait");
|
this.profiler.swap("nextTickWait");
|
||||||
this.field_19249 = true;
|
this.field_19249 = true;
|
||||||
this.field_19248 = Math.max(Util.getMeasuringTimeMs() + /*50L*/ msThisTick, this.timeReference);
|
this.field_19248 = Math.max(Util.getMeasuringTimeMs() + /*50L*/ msThisTick, this.timeReference);
|
||||||
this.method_16208();
|
if (TickSpeed.time_warp_start_time != 0)
|
||||||
|
{
|
||||||
|
runTasks();
|
||||||
|
runTasks(() -> !hasRunningTasks() );
|
||||||
|
}
|
||||||
|
else { this.method_16208(); }
|
||||||
this.profiler.pop();
|
this.profiler.pop();
|
||||||
this.profiler.endTick();
|
this.profiler.endTick();
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|||||||
Reference in new issue
Block a user