Class FlowingFluid
java.lang.Object
net.minecraft.world.level.material.Fluid
net.minecraft.world.level.material.FlowingFluid
- All Implemented Interfaces:
IFluidExtension
- Direct Known Subclasses:
BaseFlowingFluid, LavaFluid, WaterFluid
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final recordprotected class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intstatic final BooleanPropertystatic final IntegerPropertyprivate static final ThreadLocal<it.unimi.dsi.fastutil.objects.Object2ByteLinkedOpenHashMap<FlowingFluid.BlockStatePairKey>> private final Map<FluidState, VoxelShape> Fields inherited from class Fluid
FLUID_STATE_REGISTRY, stateDefinition -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanaffectsFlow(FluidState neighbourFluid) protected abstract voidbeforeDestroyingBlock(LevelAccessor level, BlockPos pos, BlockState state) protected abstract booleancanConvertToSource(ServerLevel level) Deprecated.booleancanConvertToSource(FluidState state, ServerLevel level, BlockPos pos) Returns whether the fluid can create a source.private static booleancanHoldAnyFluid(BlockState state) private static booleancanHoldFluid(BlockGetter level, BlockPos pos, BlockState state, Fluid newFluid) private static booleancanHoldSpecificFluid(BlockGetter level, BlockPos pos, BlockState state, Fluid newFluid) private booleancanMaybePassThrough(BlockGetter level, BlockPos sourcePos, BlockState sourceState, Direction direction, BlockPos testPos, BlockState testState, FluidState testFluidState) private booleancanPassThrough(BlockGetter level, Fluid fluid, BlockPos sourcePos, BlockState sourceState, Direction direction, BlockPos testPos, BlockState testState, FluidState testFluidState) private static booleancanPassThroughWall(Direction direction, BlockGetter level, BlockPos sourcePos, BlockState sourceState, BlockPos targetPos, BlockState targetState) protected voidabstract intgetAmount(FluidState fluidState) protected abstract intgetDropOff(LevelReader level) getFlow(BlockGetter level, BlockPos pos, FluidState fluidState) abstract FluidgetFlowing(int amount, boolean falling) floatgetHeight(FluidState fluidState, BlockGetter level, BlockPos pos) protected static intgetLegacyLevel(FluidState fluidState) protected FluidStategetNewLiquid(ServerLevel level, BlockPos pos, BlockState state) floatgetOwnHeight(FluidState fluidState) getShape(FluidState state, BlockGetter level, BlockPos pos) protected intgetSlopeDistance(LevelReader level, BlockPos pos, int pass, Direction from, BlockState state, FlowingFluid.SpreadContext context) protected abstract intgetSlopeFindDistance(LevelReader level) abstract FluidgetSource(boolean falling) protected Map<Direction, FluidState> getSpread(ServerLevel level, BlockPos pos, BlockState state) protected intgetSpreadDelay(Level level, BlockPos pos, FluidState oldFluidState, FluidState newFluidState) private static booleanhasSameAbove(FluidState fluidState, BlockGetter level, BlockPos pos) protected booleanisSolidFace(BlockGetter level, BlockPos pos, Direction direction) private booleanprivate booleanisWaterHole(BlockGetter level, BlockPos topPos, BlockState topState, BlockPos bottomPos, BlockState bottomState) private intsourceNeighborCount(LevelReader level, BlockPos pos) Returns the number of immediately adjacent source blocks of the same fluid that lie on the horizontal plane.protected voidspread(ServerLevel level, BlockPos pos, BlockState state, FluidState fluidState) protected voidspreadTo(LevelAccessor level, BlockPos pos, BlockState state, Direction direction, FluidState target) private voidspreadToSides(ServerLevel level, BlockPos pos, FluidState fluidState, BlockState state) voidtick(ServerLevel level, BlockPos pos, BlockState blockState, FluidState fluidState) Methods inherited from class Fluid
animateTick, builtInRegistryHolder, canBeReplacedWith, computeDefaultResource, createLegacyBlock, defaultFluidState, entityInside, getAABB, getBucket, getDripParticle, getExplosionResistance, getFluidType, getPickupSound, getStateDefinition, getTickDelay, is, isEmpty, isRandomlyTicking, isSame, isSource, randomTick, registerDefaultState, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface IFluidExtension
appendHoverText, canExtinguish, canHydrate, getAdjacentBlockPathType, getBlockPathType, getExplosionResistance, move, supportsBoating
-
Field Details
-
FALLING
-
LEVEL
-
CACHE_SIZE
private static final int CACHE_SIZE- See Also:
-
OCCLUSION_CACHE
private static final ThreadLocal<it.unimi.dsi.fastutil.objects.Object2ByteLinkedOpenHashMap<FlowingFluid.BlockStatePairKey>> OCCLUSION_CACHE -
shapes
-
-
Constructor Details
-
FlowingFluid
public FlowingFluid()
-
-
Method Details
-
createFluidStateDefinition
- Overrides:
createFluidStateDefinitionin classFluid
-
getFlow
-
affectsFlow
-
isSolidFace
-
spread
-
spreadToSides
private void spreadToSides(ServerLevel level, BlockPos pos, FluidState fluidState, BlockState state) -
getNewLiquid
-
canPassThroughWall
private static boolean canPassThroughWall(Direction direction, BlockGetter level, BlockPos sourcePos, BlockState sourceState, BlockPos targetPos, BlockState targetState) -
getFlowing
-
getFlowing
-
getSource
-
getSource
-
canConvertToSource
Description copied from interface:IFluidExtensionReturns whether the fluid can create a source.- Parameters:
state- the state of the fluidlevel- the level that can get the fluidpos- the location of the fluid- Returns:
trueif the fluid can create a source,falseotherwise
-
canConvertToSource
Deprecated.Forge: UsecanConvertToSource(FluidState, ServerLevel, BlockPos)instead. -
spreadTo
protected void spreadTo(LevelAccessor level, BlockPos pos, BlockState state, Direction direction, FluidState target) -
beforeDestroyingBlock
-
getSlopeDistance
protected int getSlopeDistance(LevelReader level, BlockPos pos, int pass, Direction from, BlockState state, FlowingFluid.SpreadContext context) -
isWaterHole
private boolean isWaterHole(BlockGetter level, BlockPos topPos, BlockState topState, BlockPos bottomPos, BlockState bottomState) -
canPassThrough
private boolean canPassThrough(BlockGetter level, Fluid fluid, BlockPos sourcePos, BlockState sourceState, Direction direction, BlockPos testPos, BlockState testState, FluidState testFluidState) -
canMaybePassThrough
private boolean canMaybePassThrough(BlockGetter level, BlockPos sourcePos, BlockState sourceState, Direction direction, BlockPos testPos, BlockState testState, FluidState testFluidState) -
isSourceBlockOfThisType
-
getSlopeFindDistance
-
sourceNeighborCount
Returns the number of immediately adjacent source blocks of the same fluid that lie on the horizontal plane. -
getSpread
-
canHoldAnyFluid
-
canHoldFluid
private static boolean canHoldFluid(BlockGetter level, BlockPos pos, BlockState state, Fluid newFluid) -
canHoldSpecificFluid
private static boolean canHoldSpecificFluid(BlockGetter level, BlockPos pos, BlockState state, Fluid newFluid) -
getDropOff
-
getSpreadDelay
protected int getSpreadDelay(Level level, BlockPos pos, FluidState oldFluidState, FluidState newFluidState) -
tick
-
getLegacyLevel
-
hasSameAbove
-
getHeight
-
getOwnHeight
- Specified by:
getOwnHeightin classFluid
-
getAmount
-
getShape
-
canConvertToSource(FluidState, ServerLevel, BlockPos)instead.