Class PlayerInteractEvent.LeftClickBlock
- java.lang.Object
-
- net.minecraftforge.eventbus.api.Event
-
- net.minecraftforge.event.entity.EntityEvent
-
- net.minecraftforge.event.entity.living.LivingEvent
-
- net.minecraftforge.event.entity.player.PlayerEvent
-
- net.minecraftforge.event.entity.player.PlayerInteractEvent
-
- net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock
-
- Enclosing class:
- PlayerInteractEvent
public static class PlayerInteractEvent.LeftClickBlock extends PlayerInteractEvent
This event is fired when a player left clicks while targeting a block. This event controls which ofnet.minecraft.block.Block#onBlockClicked
and/or the item harvesting methods will be called Canceling the event will cause none of the above noted methods to be called. There are various results to this event, see the getters below. Note that if the event is canceled and the player holds down left mouse, the event will continue to fire. This is due to how vanilla calls the left click handler methods. Also note that creative mode directly breaks the block without running any other logic. Therefore, in creative mode,setUseBlock(net.minecraftforge.eventbus.api.Event.Result)
andsetUseItem(net.minecraftforge.eventbus.api.Event.Result)
have no effect.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.minecraftforge.event.entity.player.PlayerInteractEvent
PlayerInteractEvent.EntityInteract, PlayerInteractEvent.EntityInteractSpecific, PlayerInteractEvent.LeftClickBlock, PlayerInteractEvent.LeftClickEmpty, PlayerInteractEvent.RightClickBlock, PlayerInteractEvent.RightClickEmpty, PlayerInteractEvent.RightClickItem
-
Nested classes/interfaces inherited from class net.minecraftforge.event.entity.player.PlayerEvent
PlayerEvent.BreakSpeed, PlayerEvent.Clone, PlayerEvent.HarvestCheck, PlayerEvent.ItemCraftedEvent, PlayerEvent.ItemPickupEvent, PlayerEvent.ItemSmeltedEvent, PlayerEvent.LoadFromFile, PlayerEvent.NameFormat, PlayerEvent.PlayerChangedDimensionEvent, PlayerEvent.PlayerChangeGameModeEvent, PlayerEvent.PlayerLoggedInEvent, PlayerEvent.PlayerLoggedOutEvent, PlayerEvent.PlayerRespawnEvent, PlayerEvent.SaveToFile, PlayerEvent.StartTracking, PlayerEvent.StopTracking, PlayerEvent.TabListNameFormat, PlayerEvent.Visibility
-
Nested classes/interfaces inherited from class net.minecraftforge.event.entity.living.LivingEvent
LivingEvent.LivingJumpEvent, LivingEvent.LivingUpdateEvent, LivingEvent.LivingVisibilityEvent
-
Nested classes/interfaces inherited from class net.minecraftforge.event.entity.EntityEvent
EntityEvent.CanUpdate, EntityEvent.EnteringChunk, EntityEvent.EntityConstructing, EntityEvent.Size
-
-
Constructor Summary
Constructors Constructor Description LeftClickBlock(PlayerEntity player, BlockPos pos, Direction face)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)
void
setUseItem(net.minecraftforge.eventbus.api.Event.Result triggerItem)
-
Methods inherited from class net.minecraftforge.event.entity.player.PlayerInteractEvent
getCancellationResult, getFace, getHand, getItemStack, getPos, getSide, getWorld, setCancellationResult
-
Methods inherited from class net.minecraftforge.event.entity.player.PlayerEvent
getPlayer
-
Methods inherited from class net.minecraftforge.event.entity.living.LivingEvent
getEntityLiving
-
Methods inherited from class net.minecraftforge.event.entity.EntityEvent
getEntity
-
-
-
-
Constructor Detail
-
LeftClickBlock
public LeftClickBlock(PlayerEntity player, BlockPos pos, Direction face)
-
-
Method Detail
-
getUseBlock
public net.minecraftforge.eventbus.api.Event.Result getUseBlock()
- Returns:
- If
net.minecraft.block.Block#onBlockClicked
should be called. Changing this has no effect in creative mode
-
getUseItem
public net.minecraftforge.eventbus.api.Event.Result getUseItem()
- Returns:
- If the block should be attempted to be mined with the current item. Changing this has no effect in creative mode
-
setUseBlock
public void setUseBlock(net.minecraftforge.eventbus.api.Event.Result triggerBlock)
-
setUseItem
public void setUseItem(net.minecraftforge.eventbus.api.Event.Result triggerItem)
-
setCanceled
public void setCanceled(boolean canceled)
- Overrides:
setCanceled
in classnet.minecraftforge.eventbus.api.Event
-
-