public class PlayerInteractEvent extends PlayerEvent
MinecraftForge.EVENT_BUS
.
See the individual documentation on each subevent for more details.Modifier and Type | Class and Description |
---|---|
static class |
PlayerInteractEvent.EntityInteract
This event is fired on both sides when the player right clicks an entity.
|
static class |
PlayerInteractEvent.EntityInteractSpecific
This event is fired on both sides whenever a player right clicks an entity.
|
static class |
PlayerInteractEvent.LeftClickBlock
This event is fired when a player left clicks while targeting a block.
|
static class |
PlayerInteractEvent.LeftClickEmpty
This event is fired on the client side when the player left clicks empty space with any ItemStack.
|
static class |
PlayerInteractEvent.RightClickBlock
This event is fired on both sides whenever the player right clicks while targeting a block.
|
static class |
PlayerInteractEvent.RightClickEmpty
This event is fired on the client side when the player right clicks empty space with an empty hand.
|
static class |
PlayerInteractEvent.RightClickItem
This event is fired on both sides before the player triggers
Item.onItemRightClick(net.minecraft.world.World, net.minecraft.entity.player.EntityPlayer, net.minecraft.util.EnumHand) . |
PlayerEvent.BreakSpeed, PlayerEvent.Clone, PlayerEvent.HarvestCheck, PlayerEvent.LoadFromFile, PlayerEvent.NameFormat, PlayerEvent.SaveToFile, PlayerEvent.StartTracking, PlayerEvent.StopTracking, PlayerEvent.Visibility
LivingEvent.LivingJumpEvent, LivingEvent.LivingUpdateEvent
EntityEvent.CanUpdate, EntityEvent.EnteringChunk, EntityEvent.EntityConstructing
Event.HasResult, Event.Result
Modifier and Type | Method and Description |
---|---|
EnumActionResult |
getCancellationResult() |
EnumFacing |
getFace() |
EnumHand |
getHand() |
ItemStack |
getItemStack() |
BlockPos |
getPos()
If the interaction was on an entity, will be a BlockPos centered on the entity.
|
Side |
getSide() |
World |
getWorld() |
void |
setCancellationResult(EnumActionResult result)
Set the EnumActionResult that will be returned to vanilla if the event is cancelled, instead of calling the relevant
method of the event.
|
getEntityPlayer
getEntityLiving
getEntity
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult, setup
public EnumHand getHand()
public ItemStack getItemStack()
ItemStack.EMPTY
if the hand was empty.public BlockPos getPos()
public EnumFacing getFace()
public World getWorld()
public Side getSide()
Side.CLIENT
on the client thread, and Side.SERVER
on the server thread.public EnumActionResult getCancellationResult()
EnumActionResult.PASS
, meaning cancelled events will cause
the client to keep trying more interactions until something works.public void setCancellationResult(EnumActionResult result)
PlayerInteractEvent.RightClickBlock
, PlayerInteractEvent.RightClickItem
, PlayerInteractEvent.EntityInteract
, and PlayerInteractEvent.EntityInteractSpecific
.