Fix up some liquid logic
This commit is contained in:
parent
41ed59f424
commit
a7108bc2ff
2 changed files with 9 additions and 8 deletions
|
@ -34,6 +34,10 @@ public abstract class LiquidDictionary
|
|||
*/
|
||||
public static LiquidStack getOrCreateLiquid(String name, LiquidStack liquid)
|
||||
{
|
||||
if (liquid == null)
|
||||
{
|
||||
throw new NullPointerException("You cannot register a null LiquidStack");
|
||||
}
|
||||
LiquidStack existing = liquids.get(name);
|
||||
if(existing != null) {
|
||||
return existing.copy();
|
||||
|
|
|
@ -38,8 +38,8 @@ public class LiquidStack
|
|||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
nbt.setShort("Id", (short)itemID);
|
||||
nbt.setInteger("Amount", amount);
|
||||
nbt.setShort("Id", (short)itemID);
|
||||
nbt.setShort("Meta", (short)itemMeta);
|
||||
nbt.setString("LiquidName", LiquidDictionary.findLiquidName(this));
|
||||
return nbt;
|
||||
|
@ -50,13 +50,10 @@ public class LiquidStack
|
|||
String liquidName = nbt.getString("LiquidName");
|
||||
itemID = nbt.getShort("Id");
|
||||
itemMeta = nbt.getShort("Meta");
|
||||
if (liquidName != null)
|
||||
{
|
||||
LiquidStack liquid = LiquidDictionary.getCanonicalLiquid(liquidName);
|
||||
if(liquid != null) {
|
||||
itemID = liquid.itemID;
|
||||
itemMeta = liquid.itemMeta;
|
||||
}
|
||||
LiquidStack liquid = LiquidDictionary.getCanonicalLiquid(liquidName);
|
||||
if(liquid != null) {
|
||||
itemID = liquid.itemID;
|
||||
itemMeta = liquid.itemMeta;
|
||||
}
|
||||
amount = nbt.getInteger("Amount");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue