public static class PlayerInteractEvent.RightClickBlock extends PlayerInteractEvent
Block.onBlockActivated(net.minecraft.world.World, net.minecraft.util.math.BlockPos, net.minecraft.block.state.IBlockState, net.minecraft.entity.player.EntityPlayer, net.minecraft.util.EnumHand, net.minecraft.item.ItemStack, net.minecraft.util.EnumFacing, float, float, float)
and/or Item.onItemUse(net.minecraft.item.ItemStack, net.minecraft.entity.player.EntityPlayer, net.minecraft.world.World, net.minecraft.util.math.BlockPos, net.minecraft.util.EnumHand, net.minecraft.util.EnumFacing, float, float, float)
will be called after Item.onItemUseFirst(net.minecraft.item.ItemStack, net.minecraft.entity.player.EntityPlayer, net.minecraft.world.World, net.minecraft.util.math.BlockPos, net.minecraft.util.EnumFacing, float, float, float, net.minecraft.util.EnumHand)
is called.
Canceling the event will cause none of the above three to be called.
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.RightClickBlock, PlayerInteractEvent.RightClickEmpty, PlayerInteractEvent.RightClickItem
PlayerEvent.BreakSpeed, PlayerEvent.Clone, PlayerEvent.HarvestCheck, PlayerEvent.LoadFromFile, PlayerEvent.NameFormat, PlayerEvent.SaveToFile, PlayerEvent.StartTracking, PlayerEvent.StopTracking
LivingEvent.LivingJumpEvent, LivingEvent.LivingUpdateEvent
EntityEvent.CanUpdate, EntityEvent.EnteringChunk, EntityEvent.EntityConstructing
Event.HasResult, Event.Result
Constructor and Description |
---|
RightClickBlock(EntityPlayer player,
EnumHand hand,
ItemStack stack,
BlockPos pos,
EnumFacing face,
Vec3d hitVec) |
Modifier and Type | Method and Description |
---|---|
Vec3d |
getHitVec() |
Event.Result |
getUseBlock() |
Event.Result |
getUseItem() |
void |
setCanceled(boolean canceled)
Sets the state of this event, not all events are cancelable, and any attempt to
cancel a event that can't be will result in a IllegalArgumentException.
|
void |
setUseBlock(Event.Result triggerBlock)
DENY: Block will never be used.
|
void |
setUseItem(Event.Result triggerItem)
DENY: The item will never be used.
|
getFace, getHand, getItemStack, getPos, getSide, getWorld
getEntityPlayer
getEntityLiving
getEntity
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setPhase, setResult, setup
public RightClickBlock(EntityPlayer player, EnumHand hand, ItemStack stack, BlockPos pos, EnumFacing face, Vec3d hitVec)
public Vec3d getHitVec()
public Event.Result getUseBlock()
public Event.Result getUseItem()
public void setUseBlock(Event.Result triggerBlock)
Item.doesSneakBypassUse(net.minecraft.item.ItemStack, net.minecraft.world.IBlockAccess, net.minecraft.util.math.BlockPos, net.minecraft.entity.player.EntityPlayer)
).
ALLOW: Block will always be used, regardless of sneaking and doesSneakBypassUse.public void setUseItem(Event.Result triggerItem)
public void setCanceled(boolean canceled)
Event
setCanceled
in class Event
canceled
- The new canceled value