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,14 +41,25 @@ public class LiquidStack
nbt.setShort("Id", (short)itemID);
nbt.setInteger("Amount", amount);
nbt.setShort("Meta", (short)itemMeta);
nbt.setString("LiquidName", LiquidDictionary.findLiquidName(this));
return nbt;
}
public void readFromNBT(NBTTagCompound nbt)
{
itemID = nbt.getShort("Id");
String liquidName = nbt.getString("LiquidName");
if (liquidName != null)
{
LiquidStack liquid = LiquidDictionary.getCanonicalLiquid(liquidName);
itemID = liquid.itemID;
itemMeta = liquid.itemMeta;
}
else
{
itemID = nbt.getShort("Id");
itemMeta = nbt.getShort("Meta");
}
amount = nbt.getInteger("Amount");
itemMeta = nbt.getShort("Meta");
}
/**