`PhosphophylliteFluidStack` `getFluid` problem
Technici4n opened this issue ยท 0 comments
We discussed this on FC, the gist is:
amount != 0
- Forge's internal
isEmpty
is true even though the stack is not empty
public final Fluid getFluid()
{
return isEmpty ? Fluids.EMPTY : fluidDelegate.get();
}
Then the following (AE2) code crashes because the returned fluid is Fluids.EMPTY
:
FluidStack fluidStack = fluidHandler.getStackInSlot(...);
if (fluidStack.isEmpty()) {
return null;
}
var newStack = new FluidStack(fluidStack.getFluid(), 1);
newStack.setTag(fluidStack.getTag()); // Crashes: can't modify empty