mirror of
https://github.com/Nan1t/NanoLimbo.git
synced 2025-07-14 21:20:15 +02:00
Add PacketSpawnPosition for 1.19.3
This commit is contained in:
parent
b36decb3dd
commit
68ea7c020c
@ -131,6 +131,9 @@ public class ClientConnection extends ChannelInboundHandlerAdapter {
|
|||||||
writePacket(PacketSnapshots.PACKET_JOIN_GAME);
|
writePacket(PacketSnapshots.PACKET_JOIN_GAME);
|
||||||
writePacket(PacketSnapshots.PACKET_PLAYER_ABILITIES);
|
writePacket(PacketSnapshots.PACKET_PLAYER_ABILITIES);
|
||||||
writePacket(PacketSnapshots.PACKET_PLAYER_POS);
|
writePacket(PacketSnapshots.PACKET_PLAYER_POS);
|
||||||
|
if (clientVersion.moreOrEqual(Version.V1_19_3)) {
|
||||||
|
writePacket(PacketSnapshots.PACKET_SPAWN_POSITION);
|
||||||
|
}
|
||||||
|
|
||||||
if (server.getConfig().isUsePlayerList() || clientVersion.equals(Version.V1_16_4))
|
if (server.getConfig().isUsePlayerList() || clientVersion.equals(Version.V1_16_4))
|
||||||
writePacket(PacketSnapshots.PACKET_PLAYER_INFO);
|
writePacket(PacketSnapshots.PACKET_PLAYER_INFO);
|
||||||
|
@ -33,6 +33,7 @@ public final class PacketSnapshots {
|
|||||||
|
|
||||||
public static PacketSnapshot PACKET_LOGIN_SUCCESS;
|
public static PacketSnapshot PACKET_LOGIN_SUCCESS;
|
||||||
public static PacketSnapshot PACKET_JOIN_GAME;
|
public static PacketSnapshot PACKET_JOIN_GAME;
|
||||||
|
public static PacketSnapshot PACKET_SPAWN_POSITION;
|
||||||
public static PacketSnapshot PACKET_PLUGIN_MESSAGE;
|
public static PacketSnapshot PACKET_PLUGIN_MESSAGE;
|
||||||
public static PacketSnapshot PACKET_PLAYER_ABILITIES;
|
public static PacketSnapshot PACKET_PLAYER_ABILITIES;
|
||||||
public static PacketSnapshot PACKET_PLAYER_INFO;
|
public static PacketSnapshot PACKET_PLAYER_INFO;
|
||||||
@ -99,8 +100,14 @@ public final class PacketSnapshots {
|
|||||||
info.setGameMode(server.getConfig().getGameMode());
|
info.setGameMode(server.getConfig().getGameMode());
|
||||||
info.setUuid(uuid);
|
info.setUuid(uuid);
|
||||||
|
|
||||||
|
PacketSpawnPosition packetSpawnPosition = new PacketSpawnPosition();
|
||||||
|
packetSpawnPosition.setX((long) server.getConfig().getSpawnPosition().getX());
|
||||||
|
packetSpawnPosition.setY((long) server.getConfig().getSpawnPosition().getY());
|
||||||
|
packetSpawnPosition.setZ((long) server.getConfig().getSpawnPosition().getZ());
|
||||||
|
|
||||||
PACKET_LOGIN_SUCCESS = PacketSnapshot.of(loginSuccess);
|
PACKET_LOGIN_SUCCESS = PacketSnapshot.of(loginSuccess);
|
||||||
PACKET_JOIN_GAME = PacketSnapshot.of(joinGame);
|
PACKET_JOIN_GAME = PacketSnapshot.of(joinGame);
|
||||||
|
PACKET_SPAWN_POSITION = PacketSnapshot.of(packetSpawnPosition);
|
||||||
PACKET_PLAYER_ABILITIES = PacketSnapshot.of(playerAbilities);
|
PACKET_PLAYER_ABILITIES = PacketSnapshot.of(playerAbilities);
|
||||||
PACKET_PLAYER_POS = PacketSnapshot.of(positionAndLook);
|
PACKET_PLAYER_POS = PacketSnapshot.of(positionAndLook);
|
||||||
PACKET_PLAYER_INFO = PacketSnapshot.of(info);
|
PACKET_PLAYER_INFO = PacketSnapshot.of(info);
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
package ru.nanit.limbo.protocol.packets.play;
|
||||||
|
|
||||||
|
import ru.nanit.limbo.protocol.ByteMessage;
|
||||||
|
import ru.nanit.limbo.protocol.PacketOut;
|
||||||
|
import ru.nanit.limbo.protocol.registry.Version;
|
||||||
|
|
||||||
|
public class PacketSpawnPosition implements PacketOut {
|
||||||
|
|
||||||
|
private long x;
|
||||||
|
private long y;
|
||||||
|
private long z;
|
||||||
|
|
||||||
|
public void setX(long x) {
|
||||||
|
this.x = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setY(long y) {
|
||||||
|
this.y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZ(long z) {
|
||||||
|
this.z = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void encode(ByteMessage msg, Version version) {
|
||||||
|
msg.writeLong(encodePosition(x, y ,z));
|
||||||
|
msg.writeFloat(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static long encodePosition(long x, long y, long z) {
|
||||||
|
return ((x & 0x3FFFFFF) << 38) | ((z & 0x3FFFFFF) << 12) | (y & 0xFFF);
|
||||||
|
}
|
||||||
|
}
|
@ -238,6 +238,9 @@ public enum State {
|
|||||||
map(0x63, V1_19_1, V1_19_1),
|
map(0x63, V1_19_1, V1_19_1),
|
||||||
map(0x61, V1_19_3, V1_19_3)
|
map(0x61, V1_19_3, V1_19_3)
|
||||||
);
|
);
|
||||||
|
clientBound.register(PacketSpawnPosition::new,
|
||||||
|
map(0x4C, V1_19_3, V1_19_3)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user