Package net.minecraftforge.client.event
Class InputEvent.InteractionKeyMappingTriggered
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.client.event.InputEvent
net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered
- Enclosing class:
- InputEvent
Fired when a keymapping that by default involves clicking the mouse buttons is triggered.
 
The key bindings that trigger this event are:
- Use Item - defaults to left mouse click
- Pick Block - defaults to middle mouse click
- Attack - defaults to right mouse click
This event is cancellable, and does not have a result.
 If this event is cancelled, then the keymapping's action is not processed further, and the hand will be swung
 according to shouldSwingHand().
This event is fired on the main Forge event bus, only on the logical client.
- 
Nested Class SummaryNested classes/interfaces inherited from class net.minecraftforge.client.event.InputEventInputEvent.InteractionKeyMappingTriggered, InputEvent.Key, InputEvent.MouseButton, InputEvent.MouseScrollingEventNested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Eventnet.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate final intprivate final InteractionHandprivate booleanprivate final KeyMapping
- 
Constructor SummaryConstructorsConstructorDescriptionInteractionKeyMappingTriggered(int button, KeyMapping keyMapping, InteractionHand hand) 
- 
Method SummaryModifier and TypeMethodDescriptiongetHand()Returns the hand that caused the input.Returns the key mapping which triggered this event.booleanisAttack()Returnstrueif the mouse button is the left mouse button.booleanReturnstrueif the mouse button is the middle mouse button.booleanReturnstrueif the mouse button is the right mouse button.voidsetSwingHand(boolean value) Sets whether to swing the hand.booleanReturns whether to swing the hand; always takes effect, regardless of cancellation.Methods inherited from class net.minecraftforge.eventbus.api.EventgetListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
- 
Field Details- 
buttonprivate final int button
- 
keyMapping
- 
hand
- 
handSwingprivate boolean handSwing
 
- 
- 
Constructor Details- 
InteractionKeyMappingTriggered@Internal public InteractionKeyMappingTriggered(int button, KeyMapping keyMapping, InteractionHand hand) 
 
- 
- 
Method Details- 
setSwingHandpublic void setSwingHand(boolean value) Sets whether to swing the hand. This takes effect whether or not the event is cancelled.- Parameters:
- value- whether to swing the hand
 
- 
shouldSwingHandpublic boolean shouldSwingHand()Returns whether to swing the hand; always takes effect, regardless of cancellation.- Returns:
- whether to swing the hand; always takes effect, regardless of cancellation
 
- 
getHandReturns the hand that caused the input.The event will be called for both hands if this is a use item input regardless of both event's cancellation. Will always be InteractionHand.MAIN_HANDif this is an attack or pick block input.- Returns:
- the hand that caused the input
 
- 
isAttackpublic boolean isAttack()Returnstrueif the mouse button is the left mouse button.- Returns:
- trueif the mouse button is the left mouse button
 
- 
isUseItempublic boolean isUseItem()Returnstrueif the mouse button is the right mouse button.- Returns:
- trueif the mouse button is the right mouse button
 
- 
isPickBlockpublic boolean isPickBlock()Returnstrueif the mouse button is the middle mouse button.- Returns:
- trueif the mouse button is the middle mouse button
 
- 
getKeyMappingReturns the key mapping which triggered this event.- Returns:
- the key mapping which triggered this event
 
 
-