Spinning tick await

This commit is contained in:
Sotr
2019-05-14 13:02:49 +08:00
parent 99be334597
commit 6e5df77560
3 changed files with 15 additions and 1 deletions

View File

@@ -604,6 +604,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
}
public void move(EnumMoveType enummovetype, double d0, double d1, double d2) {
System.out.print("move");
if (this.noclip) {
this.a(this.getBoundingBox().d(d0, d1, d2));
this.recalcPosition();

View File

@@ -17,6 +17,7 @@ import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
import com.mojang.datafixers.DataFixer;
import io.akarin.server.core.AkarinGlobalConfig;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufOutputStream;
import io.netty.buffer.Unpooled;
@@ -816,7 +817,14 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
}
}
if (wait > 0) {
Thread.sleep(wait / 1000000);
// Akarin start
if (AkarinGlobalConfig.spinningAwaitTicking) {
long park = System.nanoTime();
while ((System.nanoTime() - park) < wait);
} else {
Thread.sleep(wait / 1000000);
}
// Akarin end
curTime = System.nanoTime();
wait = TICK_TIME - (curTime - lastTick);
}