mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 11:29:15 +00:00
New round of fluid system fixes: (#6175)
- Fix race condition lazy-initializing flowing fluid block data. - Fix typo in ItemTextureQuadConverter that prevents certain animated textures from being used in the fluid bucket. - Fix calls to onContentsChanged in FluidTank. - Fix FluidUtil.tryEmptyContainer logic when simulating. - Fix EmptyFluidHandler.fill returning the wrong number.
This commit is contained in:
1 parent
ca980a56bc
commit
b294f4d894
5 files changed
+34
-36
No files matched your search
@@ -178,31 +178,20 @@ public class FluidUtil
|
||||
ItemStack containerCopy = ItemHandlerHelper.copyStackWithSize(container, 1); // do not modify the input
|
||||
return getFluidHandler(containerCopy)
|
||||
.map(containerFluidHandler -> {
|
||||
if (doDrain)
|
||||
|
||||
// We are acting on a COPY of the stack, so performing changes is acceptable even if we are simulating.
|
||||
FluidStack transfer = tryFluidTransfer(fluidDestination, containerFluidHandler, maxAmount, true);
|
||||
if (transfer.isEmpty())
|
||||
return FluidActionResult.FAILURE;
|
||||
|
||||
if (doDrain && player != null)
|
||||
{
|
||||
FluidStack transfer = tryFluidTransfer(fluidDestination, containerFluidHandler, maxAmount, true);
|
||||
if (!transfer.isEmpty())
|
||||
{
|
||||
if (player != null)
|
||||
{
|
||||
SoundEvent soundevent = transfer.getFluid().getAttributes().getEmptySound(transfer);
|
||||
player.world.playSound(null, player.posX, player.posY + 0.5, player.posZ, soundevent, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
}
|
||||
ItemStack resultContainer = containerFluidHandler.getContainer();
|
||||
return new FluidActionResult(resultContainer);
|
||||
}
|
||||
SoundEvent soundevent = transfer.getFluid().getAttributes().getEmptySound(transfer);
|
||||
player.world.playSound(null, player.posX, player.posY + 0.5, player.posZ, soundevent, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
FluidStack simulatedTransfer = tryFluidTransfer(fluidDestination, containerFluidHandler, maxAmount, false);
|
||||
if (!simulatedTransfer.isEmpty())
|
||||
{
|
||||
containerFluidHandler.drain(simulatedTransfer, IFluidHandler.FluidAction.SIMULATE);
|
||||
ItemStack resultContainer = containerFluidHandler.getContainer();
|
||||
return new FluidActionResult(resultContainer);
|
||||
}
|
||||
}
|
||||
return FluidActionResult.FAILURE;
|
||||
|
||||
ItemStack resultContainer = containerFluidHandler.getContainer();
|
||||
return new FluidActionResult(resultContainer);
|
||||
})
|
||||
.orElse(FluidActionResult.FAILURE);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user