package projectzombie.items.modifier;

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

public class ItemModifierFluidStorage extends ItemModifier
{
	public static final byte FLUID_NONE = 0;
	public static final byte FLUID_WATER = 1;
	
	private byte type;
	private double volume;
	
	public byte getType() {
		return type;
	}
	
	public void setType(byte type) {
		this.type = type;
	}
	
	public double getVolume() {
		return volume;
	}
	
	public void setVolume(double volume) {
		this.volume = volume;
	}
	
	public ItemModifierFluidStorage(byte type, double volume) {
		this.type = type;
		this.volume = volume;
	}
	
	public ItemModifierFluidStorage(BdfObject bdf) {
		BdfClassLoad(bdf);
	}

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

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

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

	@Override
	public ItemModifier copy() {
		return new ItemModifierFluidStorage(type, volume);
	}

}
