Use the liquid name in liquid stack persistence. Closes #429

This commit is contained in:
Christian 2013-03-27 19:09:57 -04:00
parent e5315714a9
commit 91cecec28a
1 changed files with 13 additions and 2 deletions

View File

@ -41,15 +41,26 @@ public class LiquidStack
nbt.setShort("Id", (short)itemID); nbt.setShort("Id", (short)itemID);
nbt.setInteger("Amount", amount); nbt.setInteger("Amount", amount);
nbt.setShort("Meta", (short)itemMeta); nbt.setShort("Meta", (short)itemMeta);
nbt.setString("LiquidName", LiquidDictionary.findLiquidName(this));
return nbt; return nbt;
} }
public void readFromNBT(NBTTagCompound nbt) public void readFromNBT(NBTTagCompound nbt)
{
String liquidName = nbt.getString("LiquidName");
if (liquidName != null)
{
LiquidStack liquid = LiquidDictionary.getCanonicalLiquid(liquidName);
itemID = liquid.itemID;
itemMeta = liquid.itemMeta;
}
else
{ {
itemID = nbt.getShort("Id"); itemID = nbt.getShort("Id");
amount = nbt.getInteger("Amount");
itemMeta = nbt.getShort("Meta"); itemMeta = nbt.getShort("Meta");
} }
amount = nbt.getInteger("Amount");
}
/** /**
* @return A copy of this LiquidStack * @return A copy of this LiquidStack