public static class PlayerInteractEvent.RightClickBlock extends PlayerInteractEvent
Block.onBlockActivated(net.minecraft.block.state.IBlockState, net.minecraft.world.World, net.minecraft.util.math.BlockPos, net.minecraft.entity.player.EntityPlayer, net.minecraft.util.EnumHand, net.minecraft.util.EnumFacing, float, float, float) and/or Item.onItemUse(net.minecraft.item.ItemUseContext)
will be called after IForgeItem.onItemUseFirst(net.minecraft.item.ItemStack, net.minecraft.item.ItemUseContext) is called.
Canceling the event will cause none of the above three to be called
Let result be a return value of the above three methods, or PlayerInteractEvent.cancellationResult if the event is cancelled.
If we are on the client and result is not EnumActionResult.SUCCESS, the client will then try PlayerInteractEvent.RightClickItem.
There are various results to this event, see the getters below.
Note that handling things differently on the client vs server may cause desynchronizations!PlayerInteractEvent.EntityInteract, PlayerInteractEvent.EntityInteractSpecific, PlayerInteractEvent.LeftClickBlock, PlayerInteractEvent.LeftClickEmpty, PlayerInteractEvent.RightClickBlock, PlayerInteractEvent.RightClickEmpty, PlayerInteractEvent.RightClickItemPlayerEvent.BreakSpeed, PlayerEvent.Clone, PlayerEvent.HarvestCheck, PlayerEvent.LoadFromFile, PlayerEvent.NameFormat, PlayerEvent.SaveToFile, PlayerEvent.StartTracking, PlayerEvent.StopTracking, PlayerEvent.VisibilityLivingEvent.LivingJumpEvent, LivingEvent.LivingUpdateEventEntityEvent.CanUpdate, EntityEvent.EnteringChunk, EntityEvent.EntityConstructing| Constructor and Description |
|---|
RightClickBlock(EntityPlayer player,
EnumHand hand,
BlockPos pos,
EnumFacing face,
Vec3d hitVec) |
| Modifier and Type | Method and Description |
|---|---|
Vec3d |
getHitVec() |
net.minecraftforge.eventbus.api.Event.Result |
getUseBlock() |
net.minecraftforge.eventbus.api.Event.Result |
getUseItem() |
void |
setCanceled(boolean canceled) |
void |
setUseBlock(net.minecraftforge.eventbus.api.Event.Result triggerBlock)
DENY: Block will never be used.
|
void |
setUseItem(net.minecraftforge.eventbus.api.Event.Result triggerItem)
DENY: The item will never be used.
|
getCancellationResult, getFace, getHand, getItemStack, getPos, getSide, getWorld, setCancellationResultgetEntityPlayergetEntityLivinggetEntitypublic RightClickBlock(EntityPlayer player, EnumHand hand, BlockPos pos, EnumFacing face, Vec3d hitVec)
public Vec3d getHitVec()
public net.minecraftforge.eventbus.api.Event.Result getUseBlock()
public net.minecraftforge.eventbus.api.Event.Result getUseItem()
public void setUseBlock(net.minecraftforge.eventbus.api.Event.Result triggerBlock)
IForgeItem.doesSneakBypassUse(net.minecraft.item.ItemStack, net.minecraft.world.IWorldReader, net.minecraft.util.math.BlockPos, net.minecraft.entity.player.EntityPlayer)).
ALLOW: Block will always be used, regardless of sneaking and doesSneakBypassUse.public void setUseItem(net.minecraftforge.eventbus.api.Event.Result triggerItem)
public void setCanceled(boolean canceled)
setCanceled in class net.minecraftforge.eventbus.api.Event