public static List<Entry> readMetadata(ByteBuf buf) throws IOException {
  List<Entry> entries=new ArrayList<>();
  byte item;
  while ((item=buf.readByte()) != -1) {
    MetadataType type=MetadataType.byId(buf.readByte());
    MetadataIndex index=MetadataIndex.getIndex((int)item,type);
switch (type) {
case BYTE:
      entries.add(new Entry(index,buf.readByte()));
    break;
case INT:
  entries.add(new Entry(index,ByteBufUtils.readVarInt(buf)));
break;
case FLOAT:
entries.add(new Entry(index,buf.readFloat()));
break;
case STRING:
entries.add(new Entry(index,ByteBufUtils.readUTF8(buf)));
break;
case ITEM:
entries.add(new Entry(index,readSlot(buf)));
break;
case BOOLEAN:
entries.add(new Entry(index,buf.readBoolean()));
break;
case VECTOR:
float x=buf.readFloat();
float y=buf.readFloat();
float z=buf.readFloat();
entries.add(new MetadataMap.Entry(index,new EulerAngle(x,y,z)));
break;
case POSITION:
case OPTPOSITION:
entries.add(new Entry(index,Position.getPosition(buf.readLong())));
break;
case DIRECTION:
entries.add(new Entry(index,ByteBufUtils.readVarInt(buf)));
break;
case OPTUUID:
if (buf.readBoolean()) {
entries.add(new Entry(index,readUuid(buf)));
}
break;
case BLOCKID:
entries.add(new Entry(index,ByteBufUtils.readVarInt(buf)));
}
}
return entries;
}

public static List < Entry > readMetadata ( ByteBuf buf ) throws IOException { List < Entry > entries = new ArrayList < > ( ) ; byte item ; while ( ( item = buf . readByte ( ) ) != - 1 ) { MetadataType type = MetadataType . byId ( buf . readByte ( ) ) ; MetadataIndex index = MetadataIndex . getIndex ( ( int ) item , type ) ; switch ( type ) { case BYTE : entries . add ( new Entry ( index , buf . readByte ( ) ) ) ; break ; case INT : entries . add ( new Entry ( index , ByteBufUtils . readVarInt ( buf ) ) ) ; break ; case FLOAT : entries . add ( new Entry ( index , buf . readFloat ( ) ) ) ; break ; case STRING : entries . add ( new Entry ( index , ByteBufUtils . readUTF8 ( buf ) ) ) ; break ; case ITEM : entries . add ( new Entry ( index , readSlot ( buf ) ) ) ; break ; case BOOLEAN : entries . add ( new Entry ( index , buf . readBoolean ( ) ) ) ; break ; case VECTOR : float x = buf . readFloat ( ) ; float y = buf . readFloat ( ) ; float z = buf . readFloat ( ) ; entries . add ( new MetadataMap . Entry ( index , new EulerAngle ( x , y , z ) ) ) ; break ; case POSITION : case OPTPOSITION : entries . add ( new Entry ( index , Position . getPosition ( buf . readLong ( ) ) ) ) ; break ; case DIRECTION : entries . add ( new Entry ( index , ByteBufUtils . readVarInt ( buf ) ) ) ; break ; case OPTUUID : if ( buf . readBoolean ( ) ) { entries . add ( new Entry ( index , readUuid ( buf ) ) ) ; } break ; case BLOCKID : entries . add ( new Entry ( index , ByteBufUtils . readVarInt ( buf ) ) ) ; } } return entries ; }
read a list of mob metadata entries from the buffer .
