Search in sources :

Example 6 with PEBinaryWriter

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

the class WindowSetSlotPacket method encode.

@Override
public void encode() {
    try {
        setChannel(NetworkChannel.CHANNEL_PRIORITY);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        PEBinaryWriter writer = new PEBinaryWriter(bos);
        writer.writeByte((byte) (this.pid() & 0xFF));
        writer.writeByte(this.windowID);
        writer.writeShort(this.slot);
        writer.writeShort(this.hotbarSlot);
        ;
        PEInventorySlot.writeSlot(writer, this.item);
        this.setData(bos.toByteArray());
    } catch (IOException e) {
    }
}
Also used : PEBinaryWriter(org.dragonet.utilities.io.PEBinaryWriter) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException)

Example 7 with PEBinaryWriter

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

the class RemoveEntityPacket method encode.

@Override
public void encode() {
    try {
        setChannel(NetworkChannel.CHANNEL_ENTITY_SPAWNING);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        PEBinaryWriter writer = new PEBinaryWriter(bos);
        writer.writeByte((byte) (this.pid() & 0xFF));
        writer.writeLong(this.eid);
        this.setData(bos.toByteArray());
    } catch (IOException e) {
    }
}
Also used : PEBinaryWriter(org.dragonet.utilities.io.PEBinaryWriter) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException)

Example 8 with PEBinaryWriter

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

the class RemovePlayerPacket method encode.

@Override
public void encode() {
    try {
        setChannel(NetworkChannel.CHANNEL_ENTITY_SPAWNING);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        PEBinaryWriter writer = new PEBinaryWriter(bos);
        writer.writeByte((byte) (this.pid() & 0xFF));
        writer.writeLong(this.eid);
        writer.writeUUID(this.uuid);
        this.setData(bos.toByteArray());
    } catch (IOException e) {
    }
}
Also used : PEBinaryWriter(org.dragonet.utilities.io.PEBinaryWriter) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException)

Example 9 with PEBinaryWriter

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

the class RespawnPacket method encode.

@Override
public void encode() {
    try {
        setChannel(NetworkChannel.CHANNEL_MOVEMENT);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        PEBinaryWriter writer = new PEBinaryWriter(bos);
        writer.writeByte((byte) (this.pid() & 0xFF));
        writer.writeFloat(x);
        writer.writeFloat(y + 1.62f);
        writer.writeFloat(z);
        this.setData(bos.toByteArray());
    } catch (IOException e) {
    }
}
Also used : PEBinaryWriter(org.dragonet.utilities.io.PEBinaryWriter) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException)

Example 10 with PEBinaryWriter

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

the class ServerHandshakePacket method encode.

@Override
public void encode() {
    try {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        PEBinaryWriter writer = new PEBinaryWriter(bos);
        writer.writeByte((byte) (this.pid() & 0xFF));
        writer.writeAddress(addr, port);
        writer.writeShort((short) 0);
        writer.writeAddress(Inet4Address.getByName("127.0.0.1"), (short) 0);
        writer.writeAddress(Inet4Address.getByName("0.0.0.0"), (short) 0);
        writer.writeAddress(Inet4Address.getByName("0.0.0.0"), (short) 0);
        writer.writeAddress(Inet4Address.getByName("0.0.0.0"), (short) 0);
        writer.writeAddress(Inet4Address.getByName("0.0.0.0"), (short) 0);
        writer.writeAddress(Inet4Address.getByName("0.0.0.0"), (short) 0);
        writer.writeAddress(Inet4Address.getByName("0.0.0.0"), (short) 0);
        writer.writeAddress(Inet4Address.getByName("0.0.0.0"), (short) 0);
        writer.writeAddress(Inet4Address.getByName("0.0.0.0"), (short) 0);
        writer.writeAddress(Inet4Address.getByName("0.0.0.0"), (short) 0);
        writer.writeLong(this.session);
        writer.writeLong(this.session2);
        this.setData(bos.toByteArray());
    } catch (IOException e) {
    }
}
Also used : PEBinaryWriter(org.dragonet.utilities.io.PEBinaryWriter) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException)

Aggregations

ByteArrayOutputStream (java.io.ByteArrayOutputStream)39 IOException (java.io.IOException)39 PEBinaryWriter (org.dragonet.utilities.io.PEBinaryWriter)39 HashMap (java.util.HashMap)1 Map (java.util.Map)1 UUID (java.util.UUID)1 Deflater (java.util.zip.Deflater)1 Enchantment (org.bukkit.enchantments.Enchantment)1 FurnaceRecipe (org.bukkit.inventory.FurnaceRecipe)1 ItemStack (org.bukkit.inventory.ItemStack)1 Recipe (org.bukkit.inventory.Recipe)1 ShapedRecipe (org.bukkit.inventory.ShapedRecipe)1 ShapelessRecipe (org.bukkit.inventory.ShapelessRecipe)1 PEInventorySlot (org.dragonet.inventory.PEInventorySlot)1