mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 19:39:22 +00:00
Fluid rework derp fixes. (#6098)
* Fix nulls returning from non-null methods, and null-check of non-nullable values. * Fix missed computation of the isEmpty flag in FluidStack * Cleanup getAmount/isEmpty calls. * Remove redundant suppliers. That info is readily available from the vanilla Fluid / FluidState.
This commit is contained in:
1 parent
bae2ee0420
commit
d9f6659f2c
12 files changed
+55
-80
No files matched your search
@@ -554,7 +554,7 @@ public class FluidUtil
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fluidSource.drain(resource, IFluidHandler.FluidAction.SIMULATE) == null)
|
||||
if (fluidSource.drain(resource, IFluidHandler.FluidAction.SIMULATE).isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -574,7 +574,7 @@ public class FluidUtil
|
||||
if (world.dimension.doesWaterVaporize() && fluid.getAttributes().doesVaporize(world, pos, resource))
|
||||
{
|
||||
FluidStack result = fluidSource.drain(resource, IFluidHandler.FluidAction.EXECUTE);
|
||||
if (result != null)
|
||||
if (!result.isEmpty())
|
||||
{
|
||||
result.getFluid().getAttributes().vaporize(player, world, pos, result);
|
||||
return true;
|
||||
@@ -585,7 +585,7 @@ public class FluidUtil
|
||||
// This fluid handler places the fluid block when filled
|
||||
IFluidHandler handler = getFluidBlockHandler(fluid, world, pos);
|
||||
FluidStack result = tryFluidTransfer(handler, fluidSource, resource, true);
|
||||
if (result != null)
|
||||
if (!result.isEmpty())
|
||||
{
|
||||
SoundEvent soundevent = resource.getFluid().getAttributes().getEmptySound(resource);
|
||||
world.playSound(player, pos, soundevent, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
|
||||
Reference in new issue
Block a user