And handle the null case in the constructor itself. Closes #1794 (again)
This commit is contained in:
parent
230d757a89
commit
5c88164211
1 changed files with 6 additions and 1 deletions
|
@ -23,7 +23,12 @@ public class FluidStack
|
||||||
|
|
||||||
public FluidStack(Fluid fluid, int amount)
|
public FluidStack(Fluid fluid, int amount)
|
||||||
{
|
{
|
||||||
if (!FluidRegistry.isFluidRegistered(fluid))
|
if (fluid == null)
|
||||||
|
{
|
||||||
|
FMLLog.bigWarning("Null fluid supplied to fluidstack. Did you try and create a stack for an unregistered fluid?");
|
||||||
|
throw new IllegalArgumentException("Cannot create a fluidstack from a null fluid");
|
||||||
|
}
|
||||||
|
else if (!FluidRegistry.isFluidRegistered(fluid))
|
||||||
{
|
{
|
||||||
FMLLog.bigWarning("Failed attempt to create a FluidStack for an unregistered Fluid %s (type %s)", fluid.getName(), fluid.getClass().getName());
|
FMLLog.bigWarning("Failed attempt to create a FluidStack for an unregistered Fluid %s (type %s)", fluid.getName(), fluid.getClass().getName());
|
||||||
throw new IllegalArgumentException("Cannot create a fluidstack from an unregistered fluid");
|
throw new IllegalArgumentException("Cannot create a fluidstack from an unregistered fluid");
|
||||||
|
|
Loading…
Reference in a new issue