Some convenience and safety changes.
This commit is contained in:
parent
f741f74e08
commit
bff14c9134
1 changed files with 11 additions and 4 deletions
|
@ -28,9 +28,9 @@ public abstract class LiquidDictionary
|
|||
{
|
||||
LiquidStack existing = liquids.get(name);
|
||||
if(existing != null) {
|
||||
return existing;
|
||||
return existing.copy();
|
||||
}
|
||||
liquids.put(name, liquid);
|
||||
liquids.put(name, liquid.copy());
|
||||
return liquid;
|
||||
}
|
||||
|
||||
|
@ -41,10 +41,17 @@ public abstract class LiquidDictionary
|
|||
* Can return null.
|
||||
*
|
||||
* @param name the name of the liquid
|
||||
* @param amount the amout of liquid
|
||||
* @return
|
||||
*/
|
||||
public static LiquidStack getLiquid(String name)
|
||||
public static LiquidStack getLiquid(String name, int amount)
|
||||
{
|
||||
return liquids.get(name);
|
||||
LiquidStack liquid = liquids.get(name);
|
||||
if(liquid == null)
|
||||
return null;
|
||||
|
||||
liquid = liquid.copy();
|
||||
liquid.amount = amount;
|
||||
return liquid;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue