Merge branch 'master' into 1.16
This commit is contained in:
commit
6798521e6b
3 files changed
+39
-3
No files matched your search
@@ -118,6 +118,7 @@ public class CarpetServer // static for now - easier to handle all around the co
|
|||||||
if (scriptServer != null) scriptServer.onClose();
|
if (scriptServer != null) scriptServer.onClose();
|
||||||
settingsManager.detachServer();
|
settingsManager.detachServer();
|
||||||
LoggerRegistry.stopLoggers();
|
LoggerRegistry.stopLoggers();
|
||||||
|
TickSpeed.reset();
|
||||||
extensions.forEach(e -> e.onServerClosed(server));
|
extensions.forEach(e -> e.onServerClosed(server));
|
||||||
minecraft_server = null;
|
minecraft_server = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,24 @@ public class TickSpeed
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void reset()
|
||||||
|
{
|
||||||
|
tickrate = 20.0f;
|
||||||
|
mspt = 50.0f;
|
||||||
|
time_bias = 0;
|
||||||
|
time_warp_start_time = 0;
|
||||||
|
time_warp_scheduled_ticks = 0;
|
||||||
|
time_advancerer = null;
|
||||||
|
tick_warp_callback = null;
|
||||||
|
tick_warp_sender = null;
|
||||||
|
player_active_timeout = 0;
|
||||||
|
process_entities = true;
|
||||||
|
deepFreeze = false;
|
||||||
|
is_paused = false;
|
||||||
|
is_superHot = false;
|
||||||
|
notifyTickrateListeners("carpet");
|
||||||
|
}
|
||||||
|
|
||||||
public static void add_ticks_to_run_in_pause(int ticks)
|
public static void add_ticks_to_run_in_pause(int ticks)
|
||||||
{
|
{
|
||||||
player_active_timeout = PLAYER_GRACE+ticks;
|
player_active_timeout = PLAYER_GRACE+ticks;
|
||||||
|
|||||||
@@ -31,6 +31,10 @@ public class ServerPlayNetworkHandler_tickMixin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// to skip reposition adjustment check
|
||||||
|
private static long lastMovedTick = 0L;
|
||||||
|
private static double lastMoved = 0.0D;
|
||||||
|
|
||||||
@Inject(method = "onPlayerMove", at = @At(
|
@Inject(method = "onPlayerMove", at = @At(
|
||||||
value = "INVOKE",
|
value = "INVOKE",
|
||||||
target = "Lnet/minecraft/server/network/ServerPlayerEntity;isSleeping()Z",
|
target = "Lnet/minecraft/server/network/ServerPlayerEntity;isSleeping()Z",
|
||||||
@@ -38,10 +42,23 @@ public class ServerPlayNetworkHandler_tickMixin
|
|||||||
))
|
))
|
||||||
private void checkMove(PlayerMoveC2SPacket p, CallbackInfo ci)
|
private void checkMove(PlayerMoveC2SPacket p, CallbackInfo ci)
|
||||||
{
|
{
|
||||||
if (Math.abs(p.getX(player.getX()) - lastTickX) > 0.0001D
|
double movedBy = player.getPos().squaredDistanceTo(lastTickX, lastTickY, lastTickZ);
|
||||||
|| Math.abs(p.getY(player.getY()) - lastTickY) > 0.0001D
|
if (movedBy == 0.0D) return;
|
||||||
|| Math.abs(p.getZ(player.getZ()) - lastTickZ) > 0.0001D)
|
// corrective tick
|
||||||
|
if (movedBy < 0.0009 && lastMoved > 0.0009 && Math.abs(player.getServer().getTicks()-lastMovedTick-20)<2)
|
||||||
{
|
{
|
||||||
|
//CarpetSettings.LOG.error("Corrective movement packet");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (movedBy > 0.0D)
|
||||||
|
{
|
||||||
|
//CarpetSettings.LOG.error(String.format(
|
||||||
|
// "moved by %.6f at %d",
|
||||||
|
// player.getPos().squaredDistanceTo(lastTickX, lastTickY, lastTickZ),
|
||||||
|
// player.getServer().getTicks()-lastMovedTick
|
||||||
|
//));
|
||||||
|
lastMoved = movedBy;
|
||||||
|
lastMovedTick = player.getServer().getTicks();
|
||||||
TickSpeed.reset_player_active_timeout();
|
TickSpeed.reset_player_active_timeout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user