Package net.minecraftforge.fluids
Class FluidInteractionRegistry
java.lang.Object
net.minecraftforge.fluids.FluidInteractionRegistry
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
An interface which performs an interaction for a source.static interface
An interface which tests whether a source fluid can interact with its surroundings.static final record
Holds the interaction data for a given source type on when to succeed and what to perform. -
Field Summary
Modifier and TypeFieldDescriptionprivate static final Map
<FluidType, List<FluidInteractionRegistry.InteractionInformation>> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addInteraction
(FluidType source, FluidInteractionRegistry.InteractionInformation interaction) Adds an interaction between a source and its surroundings.static boolean
canInteract
(Level level, BlockPos pos) Performs all potential fluid interactions at a given position.
-
Field Details
-
INTERACTIONS
private static final Map<FluidType,List<FluidInteractionRegistry.InteractionInformation>> INTERACTIONS
-
-
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 occursinteraction
- the interaction data to check and perform
-
canInteract
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 inpos
- the position of the source fluid- Returns:
true
if an interaction took place,false
otherwise
-