Interface BlockSpoutingBehaviour

All Known Implementing Classes:
CauldronSpoutingBehavior, SpoutCasting, StateChangingBehavior
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface BlockSpoutingBehaviour
Interface for custom block-filling behavior for spouts.

Behaviors are queried by block first, through BY_BLOCK. If no behavior was provided, they are then queried by block entity type, through BY_BLOCK_ENTITY.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final SimpleRegistry<net.minecraft.world.level.block.Block,BlockSpoutingBehaviour>
     
    static final SimpleRegistry<net.minecraft.world.level.block.entity.BlockEntityType<?>,BlockSpoutingBehaviour>
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    fillBlock(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, SpoutBlockEntity spout, net.neoforged.neoforge.fluids.FluidStack availableFluid, boolean simulate)
    While idle, spouts will query the behavior provided by the block below it.
    static @Nullable BlockSpoutingBehaviour
    get(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos)
    Get the behavior that should be used for the block at the given location.
  • Field Details

  • Method Details

    • get

      @Nullable static @Nullable BlockSpoutingBehaviour get(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos)
      Get the behavior that should be used for the block at the given location. Queries both the block and the block entity if needed.
    • fillBlock

      int fillBlock(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, SpoutBlockEntity spout, net.neoforged.neoforge.fluids.FluidStack availableFluid, boolean simulate)
      While idle, spouts will query the behavior provided by the block below it. If one is present, this method will be called every tick with simulate == true.

      When a value greater than 0 is returned, the spout will begin processing. It will call this method again with simulate == false, which is when any filling behavior should actually occur.

      This method is only called on the server side, except for in Ponder.

      Parameters:
      level - The current level
      pos - The position of the affected block
      spout - The spout block entity that is calling this
      availableFluid - A copy of the fluidStack that is available, modifying this will do nothing, return the amount to be subtracted instead
      simulate - Whether the spout is testing or actually performing this behaviour
      Returns:
      The amount filled into the block, 0 to idle/cancel