split server #3

This commit is contained in:
Sen 2025-05-03 23:14:58 +02:00
parent 8f8abfa0d3
commit 19f3813338
6 changed files with 83 additions and 5 deletions

View file

@ -96,6 +96,7 @@ import game.packet.SPacketMessage;
import game.packet.SPacketMultiBlockChange;
import game.packet.SPacketPlayerPosLook;
import game.packet.SPacketRespawn;
import game.packet.SPacketServerTick;
import game.packet.SPacketSetExperience;
import game.packet.SPacketSkin;
import game.packet.SPacketSpawnMob;
@ -927,6 +928,12 @@ public class ClientPlayer extends NetHandler
this.gameController.setTicked(packetIn.getServerinfo());
}
public void handleServerTick(SPacketServerTick packet)
{
NetHandler.checkThread(packet, this, this.gameController);
this.gameController.setLastTick(packet.getTime());
}
// public void handleCompass(SPacketCompass packetIn)
// {
// NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);

View file

@ -75,6 +75,7 @@ import game.packet.SPacketMessage;
import game.packet.SPacketMultiBlockChange;
import game.packet.SPacketPlayerPosLook;
import game.packet.SPacketRespawn;
import game.packet.SPacketServerTick;
import game.packet.SPacketSetExperience;
import game.packet.SPacketSkin;
import game.packet.SPacketSpawnMob;
@ -179,6 +180,7 @@ public enum PacketRegistry
// this.server(SPacketNotify.class);
this.server(SPacketDimensionName.class);
this.server(SPacketCharacterList.class);
this.server(SPacketServerTick.class);
this.server(SPacketLoading.class);
this.client(CPacketKeepAlive.class);

View file

@ -101,6 +101,7 @@ import game.packet.SPacketMapChunkBulk;
import game.packet.SPacketMessage;
import game.packet.SPacketMessage.Type;
import game.packet.SPacketPlayerPosLook;
import game.packet.SPacketServerTick;
import game.packet.SPacketSetExperience;
import game.packet.SPacketSkin;
import game.packet.SPacketTrades;
@ -188,6 +189,7 @@ public class Player extends NetHandler implements ICrafting, Executor
private int ping;
private boolean deleted;
private String password;
private boolean profiling;
private int selectionDim = Integer.MIN_VALUE;
private ClipboardBlock[][][] clipboard;
@ -274,8 +276,8 @@ public class Player extends NetHandler implements ICrafting, Executor
this.pingKey = (int)this.lastPingTime;
this.sendPacket(new SPacketKeepAlive(this.pingKey));
}
// if(this.local)
if(this.admin && this.profiling)
this.sendPacket(new SPacketServerTick((int)this.server.getLastTick()));
if(this.respawnTimer > 0) {
if(--this.respawnTimer == 0) {
this.respawnPlayer();
@ -2895,6 +2897,16 @@ public class Player extends NetHandler implements ICrafting, Executor
});
}
break;
case START_PROFILING:
if(this.admin)
this.profiling = true;
break;
case STOP_PROFILING:
if(this.admin)
this.profiling = false;
break;
default:
throw new IllegalArgumentException("Ungültige Aktion!");