@Override
    void write(DataOutput dataoutput) {
        try {
            if (!this.list.isEmpty()) {
                this.type = ((NBTBase) this.list.get(0)).getTypeId();
            } else {
                this.type = 0;
            }

            dataoutput.writeByte(this.type);
            dataoutput.writeInt(this.list.size());

            for (int i = 0; i < this.list.size(); ++i) {
                ((NBTBase) this.list.get(i)).write(dataoutput);
            }
        } catch (IOException e) {
            throw new NBTWriteException(e);
        }
    }