package net.minecraft.network.protocol.game; import net.minecraft.core.BlockPos; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.PacketType; public class ClientboundSetDefaultSpawnPositionPacket implements Packet { public static final StreamCodec STREAM_CODEC = Packet.codec( ClientboundSetDefaultSpawnPositionPacket::write, ClientboundSetDefaultSpawnPositionPacket::new ); private final BlockPos pos; private final float angle; public ClientboundSetDefaultSpawnPositionPacket(BlockPos pos, float angle) { this.pos = pos; this.angle = angle; } private ClientboundSetDefaultSpawnPositionPacket(FriendlyByteBuf buffer) { this.pos = buffer.readBlockPos(); this.angle = buffer.readFloat(); } /** * Writes the raw packet data to the data stream. */ private void write(FriendlyByteBuf buffer) { buffer.writeBlockPos(this.pos); buffer.writeFloat(this.angle); } @Override public PacketType type() { return GamePacketTypes.CLIENTBOUND_SET_DEFAULT_SPAWN_POSITION; } /** * Passes this Packet on to the NetHandler for processing. */ public void handle(ClientGamePacketListener handler) { handler.handleSetSpawn(this); } public BlockPos getPos() { return this.pos; } public float getAngle() { return this.angle; } }