Fluid API rework (#5983)

- Moved forge fluids into FluidAttributes companion object to the vanilla Fluid. By gigaherz
- Redesigned the Fluid API to be closer to the Items API. By King Lemming
Co-authored-by: King Lemming <[email protected]>
This commit is contained in:
David Quintana committed 2019-08-29 03:18:41 +02:00
1 parent e784a7f606
commit b7e1cc5f6b
48 files changed
+1077 -2193

No files matched your search

@@ -19,8 +19,10 @@
package net.minecraftforge.fluids;
import net.minecraft.fluid.Fluid;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fluids.capability.IFluidHandler;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -47,22 +49,22 @@ public interface IFluidBlock
* @param world the world to place the block in
* @param pos the position to place the block at
* @param fluidStack the fluid stack to get the required data from
* @param doPlace if false, the placement will only be simulated
* @param action If SIMULATE, the placement will only be simulated
* @return the amount of fluid extracted from the provided stack to achieve some fluid level
*/
int place(World world, BlockPos pos, @Nonnull FluidStack fluidStack, boolean doPlace);
int place(World world, BlockPos pos, @Nonnull FluidStack fluidStack, IFluidHandler.FluidAction action);
/**
* Attempt to drain the block. This method should be called by devices such as pumps.
*
* NOTE: The block is intended to handle its own state changes.
*
* @param doDrain
* If false, the drain will only be simulated.
* @param action
* If SIMULATE, the drain will only be simulated.
* @return
*/
@Nullable
FluidStack drain(World world, BlockPos pos, boolean doDrain);
FluidStack drain(World world, BlockPos pos, IFluidHandler.FluidAction action);
/**
* Check to see if a block can be drained. This method should be called by devices such as