Use the liquid name in liquid stack persistence. Closes #429
This commit is contained in:
parent
e5315714a9
commit
91cecec28a
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue