Package net.minecraftforge.event.world
Class BlockEvent.BlockToolInteractEvent
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.world.BlockEvent
net.minecraftforge.event.world.BlockEvent.BlockToolModificationEvent
net.minecraftforge.event.world.BlockEvent.BlockToolInteractEvent
- Enclosing class:
- BlockEvent
@Deprecated(forRemoval=true,
since="1.18.2")
public static class BlockEvent.BlockToolInteractEvent
extends BlockEvent.BlockToolModificationEvent
Deprecated, for removal: This API element is subject to removal in a future version.
Fired when a block is right-clicked by a tool to change its state.
For example: Used to determine if
an axe can strip
,
a shovel can path
, or a hoe can till
.
This deprecated subclass event is only fired when BlockEvent.BlockToolModificationEvent.isSimulated()
is false.
To receive simulated events, use BlockEvent.BlockToolModificationEvent
.
This event is Cancelable
. If canceled, this will prevent the tool
from changing the block's state.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraftforge.event.world.BlockEvent
BlockEvent.BlockToolInteractEvent, BlockEvent.BlockToolModificationEvent, BlockEvent.BreakEvent, BlockEvent.CreateFluidSourceEvent, BlockEvent.CropGrowEvent, BlockEvent.EntityMultiPlaceEvent, BlockEvent.EntityPlaceEvent, BlockEvent.FarmlandTrampleEvent, BlockEvent.FluidPlaceBlockEvent, BlockEvent.NeighborNotifyEvent, BlockEvent.PortalSpawnEvent
Nested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
Field Summary
-
Constructor Summary
ConstructorDescriptionBlockToolInteractEvent
(BlockState originalState, UseOnContext context, ToolAction toolAction) Deprecated, for removal: This API element is subject to removal in a future version.BlockToolInteractEvent
(LevelAccessor world, BlockPos pos, BlockState originalState, Player player, ItemStack stack, ToolAction toolAction) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.Methods inherited from class net.minecraftforge.event.world.BlockEvent.BlockToolModificationEvent
getContext, getFinalState, getToolAction, isSimulated, setFinalState
Methods inherited from class net.minecraftforge.event.world.BlockEvent
getPos, getState, getWorld
Methods inherited from class net.minecraftforge.eventbus.api.Event
getListenerList, getParentListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult, setup
-
Field Details
-
player
Deprecated, for removal: This API element is subject to removal in a future version. -
stack
Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Constructor Details
-
BlockToolInteractEvent
public BlockToolInteractEvent(BlockState originalState, @Nonnull UseOnContext context, ToolAction toolAction) Deprecated, for removal: This API element is subject to removal in a future version. -
BlockToolInteractEvent
public BlockToolInteractEvent(LevelAccessor world, BlockPos pos, BlockState originalState, Player player, ItemStack stack, ToolAction toolAction) Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
getPlayer
Deprecated, for removal: This API element is subject to removal in a future version.- Overrides:
getPlayer
in classBlockEvent.BlockToolModificationEvent
- Returns:
- the player using the tool, never null
-
getHeldItemStack
Deprecated, for removal: This API element is subject to removal in a future version.- Overrides:
getHeldItemStack
in classBlockEvent.BlockToolModificationEvent
- Returns:
- the tool being used
-
BlockEvent.BlockToolModificationEvent
and put world-modifying actions behindif (!event.isSimulated())
.