/// Modifies the item. @Override public void modifyItem(ItemStatsInfo itemStats) { int amplifier = FileHelper.getCount(this.amplifiers, itemStats.random); int duration = FileHelper.getCount(this.durations, itemStats.random); EffectHelper.addPotionEffect( itemStats.theItem, this.potionId, duration, amplifier, this.ambient); }
public EntryStatsPotion( String path, JsonObject root, int index, JsonObject node, IPropertyReader loader) { super(node, path); this.potionId = FileHelper.readPotion(node, path, "id").id; this.amplifiers = FileHelper.readCounts(node, path, "amplifier", 0.0, 0.0); this.durations = FileHelper.readCounts(node, path, "duration", Integer.MAX_VALUE, Integer.MAX_VALUE); this.ambient = FileHelper.readBoolean(node, path, "ambient", false); this.override = FileHelper.readBoolean(node, path, "override", false); }
/// Initializes the entity's stats. @Override public void init(MobStatsInfo mobStats) { int amplifier = FileHelper.getCount(this.amplifiers, mobStats.random); int duration = FileHelper.getCount(this.durations, mobStats.random); if (this.override) { EffectHelper.addPotionEffect( mobStats.theEntity, this.potionId, duration, amplifier, this.ambient); } else { mobStats.theEntity.addPotionEffect( new PotionEffect(this.potionId, duration, amplifier, this.ambient)); } }