use of org.dragonet.utilities.io.PEBinaryReader in project Dragonet-Legacy by DragonetMC.
the class WindowItemsPacket method decode.
@Override
public void decode() {
try {
PEBinaryReader reader = new PEBinaryReader(new ByteArrayInputStream(this.getData()));
reader.readByte();
this.windowID = reader.readByte();
short cnt = reader.readShort();
slots = new PEInventorySlot[cnt];
for (int i = 0; i < cnt; i++) {
slots[i] = PEInventorySlot.readSlot(reader);
}
if (this.windowID == PEWindowConstantID.PLAYER_INVENTORY) {
short hcnt = reader.readShort();
hotbar = new int[hcnt];
for (int i = 0; i < hcnt; i++) {
hotbar[i] = reader.readInt();
}
}
this.setLength(reader.totallyRead());
} catch (IOException e) {
}
}
use of org.dragonet.utilities.io.PEBinaryReader in project Dragonet-Legacy by DragonetMC.
the class WindowSetSlotPacket method decode.
@Override
public void decode() {
try {
PEBinaryReader reader = new PEBinaryReader(new ByteArrayInputStream(this.getData()));
reader.readByte();
this.windowID = reader.readByte();
this.slot = reader.readShort();
this.hotbarSlot = reader.readShort();
this.item = PEInventorySlot.readSlot(reader);
this.setLength(reader.totallyRead());
} catch (IOException e) {
}
}
use of org.dragonet.utilities.io.PEBinaryReader in project Dragonet-Legacy by DragonetMC.
the class RemoveBlockPacket method decode.
@Override
public void decode() {
try {
setChannel(NetworkChannel.CHANNEL_WORLD_EVENTS);
PEBinaryReader reader = new PEBinaryReader(new ByteArrayInputStream(this.getData()));
reader.readByte();
this.eid = reader.readLong();
this.x = reader.readInt();
this.z = reader.readInt();
this.y = reader.readByte();
this.setLength(reader.totallyRead());
} catch (IOException e) {
}
}
use of org.dragonet.utilities.io.PEBinaryReader in project Dragonet-Legacy by DragonetMC.
the class ClientHandshakePacket method decode.
@Override
public void decode() {
try {
PEBinaryReader reader = new PEBinaryReader(new ByteArrayInputStream(this.getData()));
//PID
reader.readByte();
this.address = reader.readAddress();
reader.readAddress();
reader.readAddress();
reader.readAddress();
reader.readAddress();
reader.readAddress();
reader.readAddress();
reader.readAddress();
reader.readAddress();
reader.readAddress();
reader.readAddress();
this.session2 = reader.readLong();
this.session = reader.readLong();
this.setLength(reader.totallyRead());
} catch (IOException e) {
}
}
use of org.dragonet.utilities.io.PEBinaryReader in project Dragonet-Legacy by DragonetMC.
the class PlayerEquipmentPacket method decode.
@Override
public void decode() {
try {
PEBinaryReader reader = new PEBinaryReader(new ByteArrayInputStream(this.getData()));
reader.readByte();
this.eid = reader.readLong();
this.item = PEInventorySlot.readSlot(reader);
this.slot = reader.readByte() & 0xFF;
this.selectedSlot = reader.readByte() & 0xFF;
this.setLength(reader.totallyRead());
} catch (IOException e) {
}
}
Aggregations