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
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
static final BooleanProperty
static final IntegerProperty
private static final ThreadLocal
<it.unimi.dsi.fastutil.objects.Object2ByteLinkedOpenHashMap<Block.BlockStatePairKey>> private final Map
<FluidState, VoxelShape> Fields inherited from class net.minecraft.world.level.material.Fluid
FLUID_STATE_REGISTRY, stateDefinition
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
affectsFlow
(FluidState state) protected abstract void
beforeDestroyingBlock
(LevelAccessor level, BlockPos pos, BlockState state) protected abstract boolean
canConvertToSource
(Level level) Deprecated.boolean
canConvertToSource
(FluidState state, Level level, BlockPos pos) Returns whether the fluid can create a source.private boolean
canHoldFluid
(BlockGetter level, BlockPos pos, BlockState state, Fluid fluid) private boolean
canPassThrough
(BlockGetter level, Fluid fluid, BlockPos pos, BlockState state, Direction direction, BlockPos spreadPos, BlockState spreadState, FluidState fluidState) private boolean
canPassThroughWall
(Direction direction, BlockGetter level, BlockPos pos, BlockState state, BlockPos spreadPos, BlockState spreadState) protected boolean
canSpreadTo
(BlockGetter level, BlockPos fromPos, BlockState fromBlockState, Direction direction, BlockPos toPos, BlockState toBlockState, FluidState toFluidState, Fluid fluid) protected void
abstract int
getAmount
(FluidState state) private static short
getCacheKey
(BlockPos sourcePos, BlockPos spreadPos) protected abstract int
getDropOff
(LevelReader level) getFlow
(BlockGetter blockReader, BlockPos pos, FluidState fluidState) abstract Fluid
getFlowing
(int level, boolean falling) float
getHeight
(FluidState state, BlockGetter level, BlockPos pos) protected static int
getLegacyLevel
(FluidState state) protected FluidState
getNewLiquid
(Level level, BlockPos pos, BlockState blockState) float
getOwnHeight
(FluidState state) getShape
(FluidState state, BlockGetter level, BlockPos pos) protected int
getSlopeDistance
(LevelReader level, BlockPos spreadPos, int distance, Direction p_direction, BlockState currentSpreadState, BlockPos sourcePos, it.unimi.dsi.fastutil.shorts.Short2ObjectMap<com.mojang.datafixers.util.Pair<BlockState, FluidState>> stateCache, it.unimi.dsi.fastutil.shorts.Short2BooleanMap waterHoleCache) protected abstract int
getSlopeFindDistance
(LevelReader level) abstract Fluid
getSource
(boolean falling) protected Map
<Direction, FluidState> getSpread
(Level level, BlockPos pos, BlockState state) protected int
getSpreadDelay
(Level level, BlockPos pos, FluidState currentState, FluidState newState) private static boolean
hasSameAbove
(FluidState fluidState, BlockGetter level, BlockPos pos) protected boolean
isSolidFace
(BlockGetter level, BlockPos neighborPos, Direction side) private boolean
private boolean
isWaterHole
(BlockGetter level, Fluid fluid, BlockPos pos, BlockState state, BlockPos spreadPos, BlockState spreadState) private int
sourceNeighborCount
(LevelReader level, BlockPos pos) Returns the number of immediately adjacent source blocks of the same fluid that lie on the horizontal plane.protected void
spread
(Level level, BlockPos pos, FluidState state) protected void
spreadTo
(LevelAccessor level, BlockPos pos, BlockState blockState, Direction direction, FluidState fluidState) private void
spreadToSides
(Level level, BlockPos pos, FluidState fluidState, BlockState blockState) void
tick
(Level level, BlockPos pos, FluidState state) Methods inherited from class net.minecraft.world.level.material.Fluid
animateTick, builtInRegistryHolder, canBeReplacedWith, createLegacyBlock, defaultFluidState, getBucket, getDripParticle, getExplosionResistance, getFluidType, getPickupSound, getStateDefinition, getTickDelay, is, isEmpty, isRandomlyTicking, isSame, isSource, randomTick, registerDefaultState, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.neoforged.neoforge.common.extensions.IFluidExtension
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<Block.BlockStatePairKey>> OCCLUSION_CACHE -
shapes
-
-
Constructor Details
-
FlowingFluid
public FlowingFluid()
-
-
Method Details
-
createFluidStateDefinition
- Overrides:
createFluidStateDefinition
in classFluid
-
getFlow
-
affectsFlow
-
isSolidFace
-
spread
-
spreadToSides
-
getNewLiquid
-
canPassThroughWall
private boolean canPassThroughWall(Direction direction, BlockGetter level, BlockPos pos, BlockState state, BlockPos spreadPos, BlockState spreadState) -
getFlowing
-
getFlowing
-
getSource
-
getSource
-
canConvertToSource
Description copied from interface:IFluidExtension
Returns 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:
true
if the fluid can create a source,false
otherwise
-
canConvertToSource
Deprecated.Forge: UsecanConvertToSource(FluidState, Level, BlockPos)
instead. -
spreadTo
protected void spreadTo(LevelAccessor level, BlockPos pos, BlockState blockState, Direction direction, FluidState fluidState) -
beforeDestroyingBlock
-
getCacheKey
-
getSlopeDistance
protected int getSlopeDistance(LevelReader level, BlockPos spreadPos, int distance, Direction p_direction, BlockState currentSpreadState, BlockPos sourcePos, it.unimi.dsi.fastutil.shorts.Short2ObjectMap<com.mojang.datafixers.util.Pair<BlockState, FluidState>> stateCache, it.unimi.dsi.fastutil.shorts.Short2BooleanMap waterHoleCache) -
isWaterHole
private boolean isWaterHole(BlockGetter level, Fluid fluid, BlockPos pos, BlockState state, BlockPos spreadPos, BlockState spreadState) -
canPassThrough
private boolean canPassThrough(BlockGetter level, Fluid fluid, BlockPos pos, BlockState state, Direction direction, BlockPos spreadPos, BlockState spreadState, FluidState fluidState) -
isSourceBlockOfThisType
-
getSlopeFindDistance
-
sourceNeighborCount
Returns the number of immediately adjacent source blocks of the same fluid that lie on the horizontal plane. -
getSpread
-
canHoldFluid
-
canSpreadTo
protected boolean canSpreadTo(BlockGetter level, BlockPos fromPos, BlockState fromBlockState, Direction direction, BlockPos toPos, BlockState toBlockState, FluidState toFluidState, Fluid fluid) -
getDropOff
-
getSpreadDelay
protected int getSpreadDelay(Level level, BlockPos pos, FluidState currentState, FluidState newState) -
tick
-
getLegacyLevel
-
hasSameAbove
-
getHeight
-
getOwnHeight
- Specified by:
getOwnHeight
in classFluid
-
getAmount
-
getShape
-
canConvertToSource(FluidState, Level, BlockPos)
instead.