mirror of
https://github.com/FabricMC/fabric.git
synced 2025-04-21 03:10:54 -04:00
Don't tick gametests if the server isn't ticking (#3528)
* Don't tick gametests if the server isn't ticking * Fix import order
This commit is contained in:
parent
d6f2b0841c
commit
85d85a93b5
1 changed files with 8 additions and 1 deletions
|
@ -18,21 +18,28 @@ package net.fabricmc.fabric.mixin.gametest;
|
|||
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
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;
|
||||
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.ServerTickManager;
|
||||
import net.minecraft.test.TestManager;
|
||||
|
||||
@Mixin(MinecraftServer.class)
|
||||
public abstract class MinecraftServerMixin {
|
||||
@Shadow
|
||||
@Final
|
||||
private ServerTickManager tickManager;
|
||||
|
||||
@Inject(method = "tickWorlds", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;updatePlayerLatency()V", shift = At.Shift.AFTER))
|
||||
private void tickWorlds(BooleanSupplier shouldKeepTicking, CallbackInfo callbackInfo) {
|
||||
// Called by vanilla when isDevelopment is enabled.
|
||||
if (!SharedConstants.isDevelopment) {
|
||||
if (!SharedConstants.isDevelopment && this.tickManager.shouldTick()) {
|
||||
TestManager.INSTANCE.tick();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue