code: public static Tag readTag(DataInput in) throws IOException {
          int id = in.readUnsignedByte();
          if(id == 0) {
              return null;
          }
  
          String name = in.readUTF();
          Tag tag;
  
          try {
              tag = TagRegistry.createInstance(id, name);
          } catch(TagCreateException e) {
              throw new IOException("Failed to create tag.", e);
          }
  
          tag.read(in);
          return tag;
      }
docs: Reads an NBT tag.
  
  @param in Data input to read from.
  @return The read tag, or null if the tag is an end tag.
  @throws java.io.IOException If an I/O error occurs.