@Override public void read(NetInput in) throws IOException { this.name = in.readString(); this.action = MagicValues.key(ObjectiveAction.class, in.readByte()); if (this.action == ObjectiveAction.ADD || this.action == ObjectiveAction.UPDATE) { this.displayName = in.readString(); this.type = MagicValues.key(ScoreType.class, in.readString()); } }
public static EntityMetadata[] readEntityMetadata(NetInput in) throws IOException { List<EntityMetadata> ret = new ArrayList<EntityMetadata>(); byte b; while ((b = in.readByte()) != 127) { int typeId = (b & 0xE0) >> 5; int id = b & 0x1F; MetadataType type = MagicValues.key(MetadataType.class, typeId); Object value; switch (type) { case BYTE: value = in.readByte(); break; case SHORT: value = in.readShort(); break; case INT: value = in.readInt(); break; case FLOAT: value = in.readFloat(); break; case STRING: value = in.readString(); break; case ITEM: value = readItem(in); break; case POSITION: value = new Position(in.readInt(), in.readInt(), in.readInt()); break; case ROTATION: value = new Rotation(in.readFloat(), in.readFloat(), in.readFloat()); break; default: throw new IOException("Unknown metadata type id: " + typeId); } ret.add(new EntityMetadata(id, type, value)); } return ret.toArray(new EntityMetadata[ret.size()]); }
@Override public void read(NetInput in) throws IOException { this.channel = in.readString(); this.data = in.readBytes(in.available()); }
@Override public void read(NetInput in) throws IOException { this.serverId = in.readString(); this.publicKey = CryptUtil.decodePublicKey(in.readBytes(in.readVarInt())); this.verifyToken = in.readBytes(in.readVarInt()); }