Class BlockEvent.FluidPlaceBlockEvent

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.level.BlockEvent
net.neoforged.neoforge.event.level.BlockEvent.FluidPlaceBlockEvent
All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent
Enclosing class:
BlockEvent

public static class BlockEvent.FluidPlaceBlockEvent extends BlockEvent implements net.neoforged.bus.api.ICancellableEvent
Fired when a liquid places a block. Use setNewState(BlockState) to change the result of a cobblestone generator or add variants of obsidian. Alternatively, you could execute arbitrary code when lava sets blocks on fire, even preventing it. BlockEvent.getState() will return the block that was originally going to be placed. BlockEvent.getPos() will return the position of the block to be changed.
  • Field Details

    • liquidPos

      private final net.minecraft.core.BlockPos liquidPos
    • newState

      private net.minecraft.world.level.block.state.BlockState newState
    • origState

      private net.minecraft.world.level.block.state.BlockState origState
  • Constructor Details

    • FluidPlaceBlockEvent

      public FluidPlaceBlockEvent(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, net.minecraft.core.BlockPos liquidPos, net.minecraft.world.level.block.state.BlockState state)
  • Method Details

    • getLiquidPos

      public net.minecraft.core.BlockPos getLiquidPos()
      Returns:
      The position of the liquid this event originated from. This may be the same as BlockEvent.getPos().
    • getNewState

      public net.minecraft.world.level.block.state.BlockState getNewState()
      Returns:
      The block state that will be placed after this event resolves.
    • setNewState

      public void setNewState(net.minecraft.world.level.block.state.BlockState state)
    • getOriginalState

      public net.minecraft.world.level.block.state.BlockState getOriginalState()
      Returns:
      The state of the block to be changed before the event was fired.