use of org.dragonet.utilities.io.PEBinaryWriter in project Dragonet-Legacy by DragonetMC.
the class WindowClosePacket 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);
this.setData(bos.toByteArray());
} catch (IOException e) {
}
}
use of org.dragonet.utilities.io.PEBinaryWriter in project Dragonet-Legacy by DragonetMC.
the class InteractPacket method encode.
@Override
public void encode() {
try {
setChannel(NetworkChannel.CHANNEL_WORLD_EVENTS);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
PEBinaryWriter writer = new PEBinaryWriter(bos);
writer.writeByte((byte) (this.pid() & 0xFF));
writer.writeByte(action);
writer.writeLong(target);
this.setData(bos.toByteArray());
} catch (IOException e) {
}
}
use of org.dragonet.utilities.io.PEBinaryWriter in project Dragonet-Legacy by DragonetMC.
the class SetEntityMotionPacket method encode.
@Override
public void encode() {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
PEBinaryWriter writer = new PEBinaryWriter(bos);
writer.writeByte((byte) (this.pid() & 0xFF));
writer.writeInt(this.motions.length);
for (EntityMotionData d : this.motions) {
if (d == null) {
continue;
}
writer.writeLong(d.eid);
writer.writeFloat(d.motionX);
writer.writeFloat(d.motionY);
writer.writeFloat(d.motionZ);
}
this.setData(bos.toByteArray());
} catch (IOException e) {
}
}
use of org.dragonet.utilities.io.PEBinaryWriter in project Dragonet-Legacy by DragonetMC.
the class SetSpawnPositionPacket method encode.
@Override
public void encode() {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
PEBinaryWriter writer = new PEBinaryWriter(bos);
writer.writeByte((byte) (this.pid() & 0xFF));
writer.writeInt(this.x);
writer.writeInt(this.y);
writer.writeInt(this.z);
this.setData(bos.toByteArray());
} catch (IOException e) {
}
}
Aggregations