Skip to content

Instantly share code, notes, and snippets.

@Lanse505
Last active March 23, 2021 16:21
Show Gist options
  • Save Lanse505/a2c28951bc7e7ef2e3ab514ac7ad2506 to your computer and use it in GitHub Desktop.
Save Lanse505/a2c28951bc7e7ef2e3ab514ac7ad2506 to your computer and use it in GitHub Desktop.

1.17 Fluid Changes

General Clean-Up

JavaDocs

JavaDocs has been cleaned-up, fixed and clarified in the following.

  • IForgeFluid
  • IForgeFluidState
  • FluidUtil

API Additions

IForgeFluid

Method Name Method Params Method Description
getPathNodeType FluidState, IBlockReader, BlockPos, @Nullable MobEntity Used for Pathfind marking for Pathfinding Entities, This lets you set specific fluids are more or less dangerous to traverse for entities
getAdjacentNodeType FluidState, IBlockReader, BlockPos, @Nullable MobEntity, PathNodeType Used to get the node type value for modifying adjacent node types weight for deciding if an entity should traverse that adjacent block
handleAcceleration FluidState, Entity Used to handle so called "Fluid Pushing" and the acceleration alteration flowing fluids can have on entities. DOES NOT HANDLE SWIMMING
handleMotion FluidState, LivingEntity, Vector3d, double Used to handle things such as slower movement, swimming slowdown, jumping motion, etc in fluids
handleJump FluidState, LivingEntity Used to handle specifically Fluid-Modified Jumping
canSwim FluidState Used to dictate if a player can "swim" in the fluid as in the animation and swim state
canDrown FluidState, LivingEntity Used to dictate if an LivingEntity should drown in the Fluid
canHydrate FluidState, BlockState Used to dictate if the Fluid can "Hydrate" various BlockStates, Used for example with ConcretePowderBlock, Farmland and Sponge
handleFluidInteraction FluidState, World, BlockPos Used to handle interactions between two fluids colliding.

IForgeFluidState

Method Name Method Params Method Description
getPathNodeType IBlockReader, BlockPos, @Nullable MobEntity Used for Pathfind marking for Pathfinding Entities, This lets you set specific fluids are more or less dangerous to traverse for entities
getAdjacentNodeType IBlockReader, BlockPos, @Nullable MobEntity, PathNodeType Used to get the node type value for modifying adjacent node types weight for deciding if an entity should traverse that adjacent block
handleAcceleration Entity Used to handle so called "Fluid Pushing" and the acceleration alteration flowing fluids can have on entities. DOES NOT HANDLE SWIMMING
handleMotion LivingEntity, Vector3d, double Used to handle things such as slower movement, swimming slowdown, jumping motion, etc in fluids
handleJump LivingEntity Used to handle specifically Fluid-Modified Jumping
canSwim Used to dictate if a player can "swim" in the fluid as in the animation and swim state
canDrown LivingEntity Used to dictate if an LivingEntity should drown in the Fluid
canHydrate BlockState Used to dictate if the Fluid can "Hydrate" various BlockStates, Used for example with ConcretePowderBlock, Farmland and Sponge
handleFluidInteraction World, BlockPos Used to handle interactions between two fluids colliding.

FluidAttributes

Field Name Type
motionScale ToDoubleBiFunction<FluidState, Entity>
fallDistanceModifier ToDoubleBiFunction<FluidState, Entity>
canSwim Predicate<FluidState>
canDrown BiPredicate<FluidState, LivingEntity>
canExtinguish BiPredicate<FluidState, Entity>
canHydrate Predicate<BlockState>
Method Name Parameters
motionScale FluidState, Entity
fallDistanceModifier FluidState, Entity
canSwim FluidState
canSwim IBlockDisplayReader, BlockPos
canDrown FluidState, LivingEntity
canExtinguish FluidState, Entity
canHydrate BlockState
canHydrate IBlockDisplayReader, BlockPos

FluidAttributes.Builder

Field Name Type Default
motionScale ToDoubleBiFunction<FluidState, Entity> (state, entity) -> 0.014D
fallDistanceModifier ToDoubleBiFunction<FluidState, Entity> (state, entity) -> 0.0D
canSwim Predicate<FluidState> state -> true
canDrown BiPredicate<FluidState, LivingEntity> (state, entity) -> true
canExtinguish BiPredicate<FluidState, Entity> (state, entity) -> temperature < 1300
canHydrate Predicate<BlockState> state -> false
Method Name Parameters
motionScale ToDoubleBiFunction<FluidState, Entity>
fallDistanceModifier ToDoubleBiFunction<FluidState, Entity>
canSwim Predicate<FluidState>
canDrown BiPredicate<FluidState, LivingEntity>
canExtinguish BiPredicate<FluidState, Entity>
canHydrate Predicate<BlockState>

API Deprecation

API Removal

IFluidBlock

IFluidBlock and it's methods has been killed off.
Below you will find a table of replacement methods for IFluidBlock that should be used.

Old Method New Method
IFluidBlock#getFluid() World#getFluidState or BlockState#getFluidState to get the Fluid
IFluidBlock#place ILiquidContainer#receiveFluid
IFluidBlock#drain IBucketPickupHandler#pickupFluid
IFluidBlock#canDrain null
IFluidBlock#getFilledProcentage null

FluidAttributes

Removed Fields:

Field Reasoning
isGaseous Removed in favour of a "Gaseous" FluidTag

FluidAttributes.Builder

Field Reasoning
isGaseous Removed in favour of a "Gaseous" FluidTag
Method Reasoning
gaseous Removed in favour of a "Gaseous" FluidTag

ForgeFlowingFluidBlock.Properties

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment