Add ServerNBTResponsePacket

This commit is contained in:
Jonas Herzig 2018-07-19 11:17:11 +02:00
parent 3340e5f5e3
commit 75d4540f8f
2 changed files with 45 additions and 1 deletions

View file

@ -108,6 +108,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerChunkD
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerExplosionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerMapDataPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerMultiBlockChangePacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerNBTResponsePacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerNotifyClientPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerOpenTileEntityEditorPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerPlayBuiltinSoundPacket;
@ -370,7 +371,7 @@ public class MinecraftProtocol extends PacketProtocol {
this.registerIncoming(0x1A, ServerPlaySoundPacket.class);
this.registerIncoming(0x1B, ServerDisconnectPacket.class);
this.registerIncoming(0x1C, ServerEntityStatusPacket.class);
// FIXME: 0x1D
this.registerIncoming(0x1D, ServerNBTResponsePacket.class);
this.registerIncoming(0x1E, ServerExplosionPacket.class);
this.registerIncoming(0x1F, ServerUnloadChunkPacket.class);
this.registerIncoming(0x20, ServerNotifyClientPacket.class);

View file

@ -0,0 +1,43 @@
package com.github.steveice10.mc.protocol.packet.ingame.server.world;
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
import com.github.steveice10.mc.protocol.util.NetUtil;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.packetlib.io.NetInput;
import com.github.steveice10.packetlib.io.NetOutput;
import java.io.IOException;
public class ServerNBTResponsePacket extends MinecraftPacket {
private int transactionId;
private CompoundTag nbt;
@SuppressWarnings("unused")
private ServerNBTResponsePacket() {
}
public ServerNBTResponsePacket(int transactionId, CompoundTag nbt) {
this.transactionId = transactionId;
this.nbt = nbt;
}
public int getTransactionId() {
return this.transactionId;
}
public CompoundTag getNBT() {
return this.nbt;
}
@Override
public void read(NetInput in) throws IOException {
this.transactionId = in.readVarInt();
this.nbt = NetUtil.readNBT(in);
}
@Override
public void write(NetOutput out) throws IOException {
out.writeVarInt(this.transactionId);
NetUtil.writeNBT(out, this.nbt);
}
}