package net.minecraft.server.packs.metadata.pack;

import net.minecraft.util.GsonHelper;
import com.google.gson.JsonParseException;
import net.minecraft.network.chat.Component;
import com.google.gson.JsonObject;
import net.minecraft.server.packs.metadata.MetadataSectionSerializer;

public class PackMetadataSectionSerializer implements MetadataSectionSerializer<PackMetadataSection> {
    @Override
    public PackMetadataSection fromJson(final JsonObject jsonObject) {
        final Component mr3 = Component.Serializer.fromJson(jsonObject.get("description"));
        if (mr3 == null) {
            throw new JsonParseException("Invalid/missing description!");
        }
        final int integer4 = GsonHelper.getAsInt(jsonObject, "pack_format");
        return new PackMetadataSection(mr3, integer4);
    }
    
    @Override
    public String getMetadataSectionName() {
        return "pack";
    }
}
