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.BlockToolInteractEvent
- Enclosing class:
- BlockEvent
Fired when when this 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 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.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
Modifier and TypeFieldDescriptionprivate final PlayerEntity
private final ItemStack
private BlockState
private final ToolType
-
Constructor Summary
ConstructorDescriptionBlockToolInteractEvent
(IWorld world, BlockPos pos, BlockState originalState, PlayerEntity player, ItemStack stack, ToolType toolType) -
Method Summary
Modifier and TypeMethodDescriptionGets the transformed state after tool use.Gets the tool being used.Gets the player using the tool.Gets the current type of the tool being compared against.void
setFinalState
(BlockState finalState) Sets the transformed state after tool use.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
-
stack
-
toolType
-
state
-
-
Constructor Details
-
BlockToolInteractEvent
public BlockToolInteractEvent(IWorld world, BlockPos pos, BlockState originalState, PlayerEntity player, ItemStack stack, ToolType toolType)
-
-
Method Details
-
getPlayer
Gets the player using the tool. -
getHeldItemStack
Gets the tool being used. -
getToolType
Gets the current type of the tool being compared against. -
setFinalState
Sets the transformed state after tool use. If not set, will return the original state. This will be bypassed if canceled returning null instead. -
getFinalState
Gets the transformed state after tool use. If setFinalState not called, will return the original state. This will be bypassed if canceled returning null instead.
-