mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Track world ticks
This commit is contained in:
parent
967d0a9fdd
commit
b25087448c
3 changed files with 12 additions and 0 deletions
|
|
@ -551,6 +551,14 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||
*/
|
||||
private int ticks;
|
||||
|
||||
/**
|
||||
* The world time in ticks according to the server
|
||||
* <p>
|
||||
* Note: The TickingStatePacket is currently ignored.
|
||||
*/
|
||||
@Setter
|
||||
private long worldTicks;
|
||||
|
||||
/**
|
||||
* Used to return the player to their original rotation after using an item in BedrockInventoryTransactionTranslator
|
||||
*/
|
||||
|
|
@ -1247,6 +1255,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||
}
|
||||
|
||||
ticks++;
|
||||
worldTicks++;
|
||||
}
|
||||
|
||||
public void setAuthenticationData(AuthData authData) {
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ public class JavaRespawnTranslator extends PacketTranslator<ClientboundRespawnPa
|
|||
DimensionUtils.switchDimension(session, fakeDim);
|
||||
}
|
||||
session.setWorldName(spawnInfo.getWorldName());
|
||||
session.setWorldTicks(0);
|
||||
DimensionUtils.switchDimension(session, newDimension);
|
||||
|
||||
ChunkUtils.loadDimension(session);
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ public class JavaSetTimeTranslator extends PacketTranslator<ClientboundSetTimePa
|
|||
|
||||
@Override
|
||||
public void translate(GeyserSession session, ClientboundSetTimePacket packet) {
|
||||
session.setWorldTicks(packet.getWorldAge());
|
||||
|
||||
// Bedrock sends a GameRulesChangedPacket if there is no daylight cycle
|
||||
// Java just sends a negative long if there is no daylight cycle
|
||||
long time = packet.getTime();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue