@Override
    public void write(DataWriter out) throws IOException {
        out.writeStringNull(revision.toString());
        out.writeInt(attributes);
        out.writeBoolean(embedded);
        out.writeInt(typeMap.size());

        for (Map.Entry<Integer, TypeRoot<T>> entry : typeMap.entrySet()) {
            int classID = entry.getKey();
            TypeRoot typeRoot = entry.getValue();

            out.writeInt(classID);

            if (classID < 0) {
                out.writeStruct(typeRoot.scriptID());
            }

            out.writeStruct(typeRoot.oldTypeHash());

            if (embedded) {
                writeNode(out, typeRoot.nodes());
            }
        }
    }
@author Nico Bergemann <barracuda415 at yahoo.de>
disunity-core/src/main/java/info/ata4/junity/serialize/typetree/TypeTreeV3.java