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.-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.level.BlockEvent
BlockEvent.BlockToolModificationEvent, BlockEvent.BreakEvent, BlockEvent.EntityMultiPlaceEvent, BlockEvent.EntityPlaceEvent, BlockEvent.FarmlandTrampleEvent, BlockEvent.FluidPlaceBlockEvent, BlockEvent.NeighborNotifyEvent, BlockEvent.PortalSpawnEvent
-
Field Summary
-
Constructor Summary
ConstructorDescriptionFluidPlaceBlockEvent
(LevelAccessor level, BlockPos pos, BlockPos liquidPos, BlockState state) -
Method Summary
Methods inherited from class net.neoforged.neoforge.event.level.BlockEvent
getLevel, getPos, getState
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.neoforged.bus.api.ICancellableEvent
isCanceled, setCanceled
-
Field Details
-
liquidPos
-
newState
-
origState
-
-
Constructor Details
-
FluidPlaceBlockEvent
public FluidPlaceBlockEvent(LevelAccessor level, BlockPos pos, BlockPos liquidPos, BlockState state)
-
-
Method Details
-
getLiquidPos
- Returns:
- The position of the liquid this event originated from. This may be the same as
BlockEvent.getPos()
.
-
getNewState
- Returns:
- The block state that will be placed after this event resolves.
-
setNewState
-
getOriginalState
- Returns:
- The state of the block to be changed before the event was fired.
-