List of usage examples for io.netty.buffer ByteBuf writeShort
public abstract ByteBuf writeShort(int value);
From source file:net.tridentsdk.packets.play.out.PacketPlayOutWindowItems.java
License:Open Source License
@Override public void encode(ByteBuf buf) { buf.writeByte(this.windowId); buf.writeShort(this.slots.length); for (Slot s : this.slots) { s.write(buf);//from w w w .ja v a 2 s. co m } }
From source file:net.tridentsdk.packets.play.out.PacketPlayOutWindowProperty.java
License:Open Source License
@Override public void encode(ByteBuf buf) { buf.writeByte(this.windowId); buf.writeShort((int) this.property); buf.writeShort((int) this.value); }
From source file:net.tridentsdk.server.data.ChunkMetaBuilder.java
License:Apache License
@Override public void write(ByteBuf buf) { buf.writeInt(this.location.x()); buf.writeInt(this.location.z()); buf.writeShort((int) this.bitmap); }
From source file:net.tridentsdk.server.data.ProtocolMetadata.java
License:Apache License
@Override public void write(ByteBuf buf) { List<MetadataValue> localMeta; synchronized (metadata) { localMeta = metadata;//from w w w .ja v a2 s.co m } for (MetadataValue value : localMeta) { if (value == null) { continue; } buf.writeByte((value.type().id() << 5 | value.index & 0x1F) & 0xFF); switch (value.type) { case BYTE: buf.writeByte((byte) value.value); break; case SHORT: buf.writeShort((short) value.value); break; case INT: buf.writeInt((int) value.value); break; case FLOAT: buf.writeFloat((float) value.value); break; case STRING: Codec.writeString(buf, (String) value.value); break; case SLOT: ((Slot) value.value).write(buf); break; case XYZ: Vector vector = (Vector) value.value; buf.writeInt((int) vector.x()); buf.writeInt((int) vector.y()); buf.writeInt((int) vector.z()); break; case PYR: Vector v = (Vector) value.value; buf.writeFloat((float) v.x()); buf.writeFloat((float) v.y()); buf.writeFloat((float) v.z()); break; } } buf.writeByte(0x7F); // terminate array }
From source file:net.tridentsdk.server.data.RecordBuilder.java
License:Apache License
@Override public void write(ByteBuf buf) { buf.writeShort((((x % 16) & 0xF) << 12) | (((z % 16) & 0xF) << 8) | (y & 0xFF)); Codec.writeVarInt32(buf, blockId << 4 | data); }
From source file:net.tridentsdk.server.data.Slot.java
License:Apache License
@Override public void write(ByteBuf buf) { buf.writeByte(this.id); if (this.id == -1) { return;/*from ww w .ja va 2 s . c om*/ } buf.writeByte((int) this.quantity); buf.writeShort((int) this.damageValue); if (this.compoundTag != null) { // TODO: toPacket compound tag } }
From source file:net.tridentsdk.server.packets.play.out.PacketPlayOutChunkData.java
License:Apache License
@Override public void encode(ByteBuf buf) { buf.writeInt(this.chunkLocation.x()); buf.writeInt(this.chunkLocation.z()); buf.writeBoolean(this.continuous); buf.writeShort(this.bitmask); Codec.writeVarInt32(buf, data.length); buf.writeBytes(data);// w w w . j a v a2 s . co m }
From source file:net.tridentsdk.server.packets.play.out.PacketPlayOutEntityEquipment.java
License:Apache License
@Override public void encode(ByteBuf buf) { Codec.writeVarInt32(buf, this.entityId); buf.writeShort((int) this.slot); item.write(buf);/*from ww w .j av a2 s .co m*/ }
From source file:net.tridentsdk.server.packets.play.out.PacketPlayOutEntityVelocity.java
License:Apache License
@Override public void encode(ByteBuf buf) { Codec.writeVarInt32(buf, this.entityId); buf.writeShort((int) this.velocity.x()); buf.writeShort((int) this.velocity.y()); buf.writeShort((int) this.velocity.z()); }
From source file:net.tridentsdk.server.packets.play.out.PacketPlayOutMapChunkBulk.java
License:Apache License
@Override public void encode(ByteBuf buf) { buf.writeBoolean(this.lightSent); Codec.writeVarInt32(buf, entries.size()); for (PacketPlayOutChunkData packet : entries) { ChunkLocation location = packet.chunkLocation(); buf.writeInt(location.x());/*w ww .j a va2 s . c o m*/ buf.writeInt(location.z()); buf.writeShort(packet.bitmask()); } for (PacketPlayOutChunkData packet : entries) { buf.writeBytes(packet.data()); } }