ClientboundSetBorderLerpSizePacket 0x5B

ClientboundSetBorderLerpSizePacket: Minecraft 26.3 packet (0x5B Play clientbound). Wire name 'set_border_lerp_size', fields: border, handled

Minecraft 26.3PlayClientboundnet.minecraft.network.protocol.game

Protocol slots (1)

IDdecStateDirectionRegistry
0x5B91PLAYClientboundGamePacketTypes.CLIENTBOUND_SET_BORDER_LERP_SIZE: "set_border_lerp_size"

Packet ids are positional: the id is the index of the addPacket call in the protocol builder (see ProtocolInfoBuilder.listPackets). Ids change between game versions.

Wire fields (1)

FieldType
borderWorldBorder

Stream codec

static final StreamCodec<FriendlyByteBuf, ClientboundSetBorderLerpSizePacket> STREAM_CODEC = Packet.codec( ClientboundSetBorderLerpSizePacket::write, ClientboundSetBorderLerpSizePacket::new );

Modern packets serialize through StreamCodecs instead of read/write methods.

Handling

Resolved on the ClientGamePacketListener packet-listener interface by void handleSetBorderLerpSize(ClientboundSetBorderLerpSizePacket clientboundsetborderlerpsizepacket). The implementation in the game is ClientPacketListener.

Full Source

ClientboundSetBorderLerpSizePacket.java56 lines · Minecraft 26.3 · verbatimSource page ↗
1
package net.minecraft.network.protocol.game;
2
3
import net.minecraft.network.FriendlyByteBuf;
4
import net.minecraft.network.codec.StreamCodec;
5
import net.minecraft.network.protocol.Packet;
6
import net.minecraft.network.protocol.PacketType;
7
import net.minecraft.world.level.border.WorldBorder;
8
9
public class ClientboundSetBorderLerpSizePacket implements Packet<ClientGamePacketListener> {
10
	public static final StreamCodec<FriendlyByteBuf, ClientboundSetBorderLerpSizePacket> STREAM_CODEC = Packet.codec(
11
		ClientboundSetBorderLerpSizePacket::write, ClientboundSetBorderLerpSizePacket::new
12
	);
13
	private final double oldSize;
14
	private final double newSize;
15
	private final long lerpTime;
16
17
	public ClientboundSetBorderLerpSizePacket(final WorldBorder border) {
18
		this.oldSize = border.getSize();
19
		this.newSize = border.getLerpTarget();
20
		this.lerpTime = border.getLerpTime();
21
	}
22
23
	private ClientboundSetBorderLerpSizePacket(final FriendlyByteBuf input) {
24
		this.oldSize = input.readDouble();
25
		this.newSize = input.readDouble();
26
		this.lerpTime = input.readVarLong();
27
	}
28
29
	private void write(final FriendlyByteBuf output) {
30
		output.writeDouble(this.oldSize);
31
		output.writeDouble(this.newSize);
32
		output.writeVarLong(this.lerpTime);
33
	}
34
35
	@Override
36
	public PacketType<ClientboundSetBorderLerpSizePacket> type() {
37
		return GamePacketTypes.CLIENTBOUND_SET_BORDER_LERP_SIZE;
38
	}
39
40
	public void handle(final ClientGamePacketListener listener) {
41
		listener.handleSetBorderLerpSize(this);
42
	}
43
44
	public double getOldSize() {
45
		return this.oldSize;
46
	}
47
48
	public double getNewSize() {
49
		return this.newSize;
50
	}
51
52
	public long getLerpTime() {
53
		return this.lerpTime;
54
	}
55
}
56