Class FluidInteractionRegistry

java.lang.Object
net.minecraftforge.fluids.FluidInteractionRegistry

public final class FluidInteractionRegistry extends Object
A registry which defines the interactions a source fluid can have with its surroundings. Each possible flow direction is checked for all interactions with the source.

Fluid interactions mimic the behavior of LiquidBlock#shouldSpreadLiquid. As such, all directions, besides Direction.DOWN is tested and then replaced. Any fluids which cause a change in the down interaction must be handled in FlowingFluid#spreadTo and not by this interaction manager.

  • Field Details

  • Constructor Details

    • FluidInteractionRegistry

      public FluidInteractionRegistry()
  • Method Details

    • addInteraction

      public static void addInteraction(FluidType source, FluidInteractionRegistry.InteractionInformation interaction)
      Adds an interaction between a source and its surroundings.
      Parameters:
      source - the source of the interaction, this will be replaced if the interaction occurs
      interaction - the interaction data to check and perform
    • canInteract

      public static boolean canInteract(Level level, BlockPos pos)
      Performs all potential fluid interactions at a given position.

      Note: Only the first interaction check that succeeds will occur.

      Parameters:
      level - the level the interactions take place in
      pos - the position of the source fluid
      Returns:
      true if an interaction took place, false otherwise