package net.minecraft.network.protocol.game; 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 ClientboundSetChunkCacheRadiusPacket implements Packet { public static final StreamCodec STREAM_CODEC = Packet.codec( ClientboundSetChunkCacheRadiusPacket::write, ClientboundSetChunkCacheRadiusPacket::new ); private final int radius; public ClientboundSetChunkCacheRadiusPacket(int radius) { this.radius = radius; } private ClientboundSetChunkCacheRadiusPacket(FriendlyByteBuf buffer) { this.radius = buffer.readVarInt(); } /** * Writes the raw packet data to the data stream. */ private void write(FriendlyByteBuf buffer) { buffer.writeVarInt(this.radius); } @Override public PacketType type() { return GamePacketTypes.CLIENTBOUND_SET_CHUNK_CACHE_RADIUS; } /** * Passes this Packet on to the NetHandler for processing. */ public void handle(ClientGamePacketListener handler) { handler.handleSetChunkCacheRadius(this); } public int getRadius() { return this.radius; } }