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
public static class BlockEvent.BlockToolInteractEvent extends 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 isCancelable
. 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
-
-
Field Summary
Fields Modifier and Type Field Description private PlayerEntity
player
private ItemStack
stack
private BlockState
state
private ToolType
toolType
-
Constructor Summary
Constructors Constructor Description BlockToolInteractEvent(IWorld world, BlockPos pos, BlockState originalState, PlayerEntity player, ItemStack stack, ToolType toolType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BlockState
getFinalState()
Gets the transformed state after tool use.ItemStack
getHeldItemStack()
Gets the tool being used.PlayerEntity
getPlayer()
Gets the player using the tool.ToolType
getToolType()
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
-
-
-
-
Field Detail
-
player
private final PlayerEntity player
-
stack
private final ItemStack stack
-
toolType
private final ToolType toolType
-
state
private BlockState state
-
-
Constructor Detail
-
BlockToolInteractEvent
public BlockToolInteractEvent(IWorld world, BlockPos pos, BlockState originalState, PlayerEntity player, ItemStack stack, ToolType toolType)
-
-
Method Detail
-
getPlayer
public PlayerEntity getPlayer()
Gets the player using the tool.
-
getHeldItemStack
public ItemStack getHeldItemStack()
Gets the tool being used.
-
getToolType
public ToolType getToolType()
Gets the current type of the tool being compared against.
-
setFinalState
public void setFinalState(BlockState finalState)
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
public BlockState 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.
-
-