Interface IForgeFluid

All Known Implementing Classes:
EmptyFluid, FlowingFluid, Fluid, ForgeFlowingFluid, ForgeFlowingFluid.Flowing, ForgeFlowingFluid.Source, LavaFluid, LavaFluid.Flowing, LavaFluid.Source, WaterFluid, WaterFluid.Flowing, WaterFluid.Source

public interface IForgeFluid
  • Method Details

    • self

      private Fluid self()
    • getExplosionResistance

      default float getExplosionResistance(FluidState state, BlockGetter level, BlockPos pos, Explosion explosion)
      Returns the explosion resistance of the fluid.
      Parameters:
      state - the state of the fluid
      level - the level the fluid is in
      pos - the position of the fluid
      explosion - the explosion the fluid is absorbing
      Returns:
      the amount of the explosion the fluid can absorb
    • getFluidType

      FluidType getFluidType()
      Returns the type of this fluid.

      Important: This MUST be overridden on your fluid, otherwise an error will be thrown.

      Returns:
      the type of this fluid
    • move

      default boolean move(FluidState state, LivingEntity entity, Vec3 movementVector, double gravity)
      Performs how an entity moves when within the fluid. If using custom movement logic, the method should return true. Otherwise, the movement logic will default to water.
      Parameters:
      state - the state of the fluid
      entity - the entity moving within the fluid
      movementVector - the velocity of how the entity wants to move
      gravity - the gravity to apply to the entity
      Returns:
      true if custom movement logic is performed, false otherwise
    • canConvertToSource

      default boolean canConvertToSource(FluidState state, Level level, BlockPos pos)
      Returns whether the fluid can create a source.
      Parameters:
      state - the state of the fluid
      level - the level that can get the fluid
      pos - the location of the fluid
      Returns:
      true if the fluid can create a source, false otherwise
    • supportsBoating

      default boolean supportsBoating(FluidState state, Boat boat)
      Returns whether the boat can be used on the fluid.
      Parameters:
      state - the state of the fluid
      boat - the boat trying to be used on the fluid
      Returns:
      true if the boat can be used, false otherwise
    • getBlockPathType

      @Nullable default @Nullable BlockPathTypes getBlockPathType(FluidState state, BlockGetter level, BlockPos pos, @Nullable @Nullable Mob mob, boolean canFluidLog)
      Gets the path type of this fluid when an entity is pathfinding. When null, uses vanilla behavior.
      Parameters:
      state - the state of the fluid
      level - the level which contains this fluid
      pos - the position of the fluid
      mob - the mob currently pathfinding, may be null
      canFluidLog - true if the path is being applied for fluids that can log blocks, should be checked against if the fluid can log a block
      Returns:
      the path type of this fluid
    • getAdjacentBlockPathType

      @Nullable default @Nullable BlockPathTypes getAdjacentBlockPathType(FluidState state, BlockGetter level, BlockPos pos, @Nullable @Nullable Mob mob, BlockPathTypes originalType)
      Gets the path type of the adjacent fluid to a pathfinding entity. Path types with a negative malus are not traversable for the entity. Pathfinding entities will favor paths consisting of a lower malus. When null, uses vanilla behavior.
      Parameters:
      state - the state of the fluid
      level - the level which contains this fluid
      pos - the position of the fluid
      mob - the mob currently pathfinding, may be null
      originalType - the path type of the source the entity is on
      Returns:
      the path type of this fluid
    • canHydrate

      default boolean canHydrate(FluidState state, BlockGetter getter, BlockPos pos, BlockState source, BlockPos sourcePos)
      Returns whether the block can be hydrated by a fluid.

      Hydration is an arbitrary word which depends on the block.

      • A farmland has moisture
      • A sponge can soak up the liquid
      • A coral can live
      Parameters:
      state - the state of the fluid
      getter - the getter which can get the fluid
      pos - the position of the fluid
      source - the state of the block being hydrated
      sourcePos - the position of the block being hydrated
      Returns:
      true if the block can be hydrated, false otherwise
    • canExtinguish

      default boolean canExtinguish(FluidState state, BlockGetter getter, BlockPos pos)
      Returns whether the block can be extinguished by this fluid.
      Parameters:
      state - the state of the fluid
      getter - the getter which can get the fluid
      pos - the position of the fluid
      Returns:
      true if the block can be extinguished, false otherwise