package projectzombie.items.modifier;

import bdf.types.BdfNamedList;
import bdf.types.BdfObject;

public class ItemModifierWater extends ItemModifier
{
	private double volume;
	
	public double getVolume() {
		return volume;
	}
	
	public void setVolume(double volume) {
		this.volume = volume;
	}
	
	public ItemModifierWater(double volume) {
		this.volume = volume;
	}
	
	public ItemModifierWater(BdfObject bdf) {
		BdfClassLoad(bdf);
	}

	@Override
	public void BdfClassLoad(BdfObject bdf) {
		BdfNamedList nl = bdf.getNamedList();
		volume = nl.get("volume").getDouble();
	}

	@Override
	public void BdfClassSave(BdfObject bdf) {
		BdfNamedList nl = bdf.getNamedList();
		nl.set("volume", bdf.newObject().setDouble(volume));
	}

	@Override
	public boolean isEqual(ItemModifier other)
	{
		if(!(other instanceof ItemModifierWater)) {
			return false;
		}
		
		ItemModifierWater other_fs = (ItemModifierWater)other;
		
		return other_fs.volume == volume;
	}

	@Override
	public ItemModifier copy() {
		return new ItemModifierWater(volume);
	}
}
