Search in sources :

Example 11 with PEBinaryReader

use of org.dragonet.utilities.io.PEBinaryReader in project Dragonet-Legacy by DragonetMC.

the class ClientConnectPacket method decode.

@Override
public void decode() {
    try {
        PEBinaryReader reader = new PEBinaryReader(new ByteArrayInputStream(this.getData()));
        //PID
        reader.readByte();
        this.clientID = reader.readLong();
        this.sessionID = reader.readLong();
        this.useSecurity = (reader.readByte() & 0xFF) > 0;
        this.setLength(reader.totallyRead());
    } catch (IOException e) {
    }
}
Also used : PEBinaryReader(org.dragonet.utilities.io.PEBinaryReader) ByteArrayInputStream(java.io.ByteArrayInputStream) IOException(java.io.IOException)

Example 12 with PEBinaryReader

use of org.dragonet.utilities.io.PEBinaryReader in project Dragonet-Legacy by DragonetMC.

the class MovePlayerPacket method decode.

@Override
public void decode() {
    try {
        PEBinaryReader reader = new PEBinaryReader(new ByteArrayInputStream(this.getData()));
        //PID
        reader.readByte();
        this.eid = reader.readLong();
        this.x = reader.readFloat();
        this.y = reader.readFloat() - 1.62f;
        this.z = reader.readFloat();
        this.yaw = reader.readFloat();
        this.bodyYaw = reader.readFloat();
        this.pitch = reader.readFloat();
        this.mode = reader.readByte();
        this.teleport = reader.readByte() > 0;
        this.setLength(reader.totallyRead());
    } catch (IOException e) {
    }
}
Also used : PEBinaryReader(org.dragonet.utilities.io.PEBinaryReader) ByteArrayInputStream(java.io.ByteArrayInputStream) IOException(java.io.IOException)

Example 13 with PEBinaryReader

use of org.dragonet.utilities.io.PEBinaryReader in project Dragonet-Legacy by DragonetMC.

the class PingPongPacket method decode.

@Override
public void decode() {
    try {
        PEBinaryReader reader = new PEBinaryReader(new ByteArrayInputStream(this.getData()));
        reader.readByte();
        this.pingID = reader.readLong();
        this.setLength(reader.totallyRead());
    } catch (IOException e) {
    }
}
Also used : PEBinaryReader(org.dragonet.utilities.io.PEBinaryReader) ByteArrayInputStream(java.io.ByteArrayInputStream) IOException(java.io.IOException)

Example 14 with PEBinaryReader

use of org.dragonet.utilities.io.PEBinaryReader in project Dragonet-Legacy by DragonetMC.

the class PlayerActionPacket method decode.

@Override
public void decode() {
    try {
        PEBinaryReader reader = new PEBinaryReader(new ByteArrayInputStream(this.getData()));
        //PID
        reader.readByte();
        eid = reader.readLong();
        action = reader.readInt();
        x = reader.readInt();
        y = reader.readInt();
        z = reader.readInt();
        face = reader.readInt();
        this.setLength(reader.totallyRead());
    } catch (IOException e) {
    }
}
Also used : PEBinaryReader(org.dragonet.utilities.io.PEBinaryReader) ByteArrayInputStream(java.io.ByteArrayInputStream) IOException(java.io.IOException)

Example 15 with PEBinaryReader

use of org.dragonet.utilities.io.PEBinaryReader in project Dragonet-Legacy by DragonetMC.

the class UseItemPacket method decode.

@Override
public void decode() {
    try {
        PEBinaryReader reader = new PEBinaryReader(new ByteArrayInputStream(this.getData()));
        //PID
        reader.readByte();
        this.x = reader.readInt();
        this.y = reader.readInt();
        this.z = reader.readInt();
        this.face = reader.readByte() & 0xFF;
        this.fx = reader.readFloat();
        this.fy = reader.readFloat();
        this.fz = reader.readFloat();
        this.posX = reader.readFloat();
        this.posY = reader.readFloat();
        this.posZ = reader.readFloat();
        this.item = PEInventorySlot.readSlot(reader);
    } catch (IOException e) {
    }
}
Also used : PEBinaryReader(org.dragonet.utilities.io.PEBinaryReader) ByteArrayInputStream(java.io.ByteArrayInputStream) IOException(java.io.IOException)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)17 IOException (java.io.IOException)17 PEBinaryReader (org.dragonet.utilities.io.PEBinaryReader)17 DataFormatException (java.util.zip.DataFormatException)1 Inflater (java.util.zip.Inflater)1