Add UpdateViewDistancePacket

This commit is contained in:
Paul Heidenreich 2019-04-28 12:09:10 +02:00
parent 48a1e1fbda
commit c1a9d298ad
2 changed files with 25 additions and 2 deletions

View file

@ -135,6 +135,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerSpawnP
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUnloadChunkPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateTileEntityPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateTimePacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateViewDistancePacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateViewPositionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerWorldBorderPacket;
import com.github.steveice10.mc.protocol.packet.login.client.EncryptionResponsePacket;
@ -427,7 +428,7 @@ public class MinecraftProtocol extends PacketProtocol {
this.registerIncoming(0x3E, ServerSwitchCameraPacket.class);
this.registerIncoming(0x3F, ServerPlayerChangeHeldItemPacket.class);
this.registerIncoming(0x40, ServerUpdateViewPositionPacket.class);
// 0x41 Update View Distance
this.registerIncoming(0x41, ServerUpdateViewDistancePacket.class);
this.registerIncoming(0x42, ServerDisplayScoreboardPacket.class);
this.registerIncoming(0x43, ServerEntityMetadataPacket.class);
this.registerIncoming(0x44, ServerEntityAttachPacket.class);
@ -617,7 +618,7 @@ public class MinecraftProtocol extends PacketProtocol {
this.registerOutgoing(0x3E, ServerSwitchCameraPacket.class);
this.registerOutgoing(0x3F, ServerPlayerChangeHeldItemPacket.class);
this.registerOutgoing(0x40, ServerUpdateViewPositionPacket.class);
// 0x41 Update View Distance
this.registerOutgoing(0x41, ServerUpdateViewDistancePacket.class);
this.registerOutgoing(0x42, ServerDisplayScoreboardPacket.class);
this.registerOutgoing(0x43, ServerEntityMetadataPacket.class);
this.registerOutgoing(0x44, ServerEntityAttachPacket.class);

View file

@ -0,0 +1,22 @@
package com.github.steveice10.mc.protocol.packet.ingame.server.world;
import java.io.IOException;
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
import com.github.steveice10.packetlib.io.NetInput;
import com.github.steveice10.packetlib.io.NetOutput;
public class ServerUpdateViewDistancePacket extends MinecraftPacket {
private int viewDistance;
@Override
public void read(NetInput in) throws IOException {
this.viewDistance = in.readVarInt();
}
@Override
public void write(NetOutput out) throws IOException {
out.writeVarInt(this.viewDistance);
}
}