JsonObject json = jsonElement.getAsJsonObject();
PotionEffectType pet = PotionEffectType.getById(json.get(POTION_EFFECT_ID).getAsInt());
int duration = POTION_DURATION_DEFAULT;
JsonElement durationElement = json.get(POTION_DURATION);
if (durationElement != null)
{
duration = durationElement.getAsInt();
}
int amplifier = POTION_AMPLIFIER_DEFAULT;
JsonElement amplifierElement = json.get(POTION_AMPLIFIER);
if (amplifierElement != null)
{
amplifier = amplifierElement.getAsInt();
}
boolean ambient = POTION_AMBIENT_DEFAULT;
JsonElement ambientElement = json.get(POTION_AMBIENT);
if (ambientElement != null)
{
ambient = ambientElement.getAsBoolean();
}
return new PotionEffect(pet, duration, amplifier, ambient);
}