ClientboundSetBorderWarningDistancePacket .java

net.minecraft.network.protocol.game.ClientboundSetBorderWarningDistancePacket (class, 40 lines): members: getWarningBlocks, warningBlocks, handle, type.

net.minecraft.network.protocol.gameclass40 linescommon1.3 KB

Implements

API Surface (3)

PacketType<ClientboundSetBorderWarningDistancePacket> type()
void handle(final ClientGamePacketListener listener)
int getWarningBlocks()

Fields & Constants (2)

STREAM_CODEC
warningBlocks

Same Package (197)

Full Source

ClientboundSetBorderWarningDistancePacket.java40 lines · Minecraft 26.3 · verbatim
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 ClientboundSetBorderWarningDistancePacket implements Packet<ClientGamePacketListener> {
10
	public static final StreamCodec<FriendlyByteBuf, ClientboundSetBorderWarningDistancePacket> STREAM_CODEC = Packet.codec(
11
		ClientboundSetBorderWarningDistancePacket::write, ClientboundSetBorderWarningDistancePacket::new
12
	);
13
	private final int warningBlocks;
14
15
	public ClientboundSetBorderWarningDistancePacket(final WorldBorder border) {
16
		this.warningBlocks = border.getWarningBlocks();
17
	}
18
19
	private ClientboundSetBorderWarningDistancePacket(final FriendlyByteBuf input) {
20
		this.warningBlocks = input.readVarInt();
21
	}
22
23
	private void write(final FriendlyByteBuf output) {
24
		output.writeVarInt(this.warningBlocks);
25
	}
26
27
	@Override
28
	public PacketType<ClientboundSetBorderWarningDistancePacket> type() {
29
		return GamePacketTypes.CLIENTBOUND_SET_BORDER_WARNING_DISTANCE;
30
	}
31
32
	public void handle(final ClientGamePacketListener listener) {
33
		listener.handleSetBorderWarningDistance(this);
34
	}
35
36
	public int getWarningBlocks() {
37
		return this.warningBlocks;
38
	}
39
}
40

Decompiled Minecraft 26.3 source of ClientboundSetBorderWarningDistancePacket (net/minecraft/network/protocol/game/ClientboundSetBorderWarningDistancePacket.java) with Mojang official mappings, stored verbatim on the site.