public static final void writeTag(BufferedWriter out, NBTTagCompound tag) throws IOException {
   out.write("tag:");
   out.newLine();
   List<String> tagData = new ArrayList<String>();
   NBTTools.writeNBTToLines(tag, tagData);
   for (String line : tagData) {
     out.write(line);
     out.newLine();
   }
   out.write(":endtag");
   out.newLine();
 }
 public static final NBTTagCompound readTag(List<String> ruleData) {
   List<String> tagLines = new ArrayList<String>();
   String line;
   Iterator<String> it = ruleData.iterator();
   while (it.hasNext() && (line = it.next()) != null) {
     if (line.startsWith("tag:")) {
       it.remove();
       while (it.hasNext() && (line = it.next()) != null) {
         it.remove();
         if (line.startsWith(":endtag")) {
           break;
         }
         tagLines.add(line);
       }
     }
   }
   return NBTTools.readNBTFrom(tagLines);
 }