类 InputEvent.InteractionKeyMappingTriggered
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.client.event.InputEvent
net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered
- 封闭类:
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.
-
嵌套类概要
从类继承的嵌套类/接口 net.minecraftforge.client.event.InputEvent
InputEvent.InteractionKeyMappingTriggered, InputEvent.Key, InputEvent.MouseButton, InputEvent.MouseScrollingEvent
从类继承的嵌套类/接口 net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
字段概要
字段修饰符和类型字段说明private final int
private final InteractionHand
private boolean
private final KeyMapping
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明getHand()
返回 the hand that caused the input。返回 the key mapping which triggered this event。boolean
isAttack()
返回true
if the mouse button is the left mouse button。boolean
返回true
if the mouse button is the middle mouse button。boolean
返回true
if the mouse button is the right mouse button。void
setSwingHand
(boolean value) Sets whether to swing the hand.boolean
返回 whether to swing the hand; always takes effect, regardless of cancellation。从类继承的方法 net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
字段详细资料
-
button
private final int button -
keyMapping
-
hand
-
handSwing
private boolean handSwing
-
-
构造器详细资料
-
InteractionKeyMappingTriggered
@Internal public InteractionKeyMappingTriggered(int button, KeyMapping keyMapping, InteractionHand hand)
-
-
方法详细资料
-
setSwingHand
public void setSwingHand(boolean value) Sets whether to swing the hand. This takes effect whether or not the event is cancelled.- 参数:
value
- whether to swing the hand
-
shouldSwingHand
public boolean shouldSwingHand()返回 whether to swing the hand; always takes effect, regardless of cancellation。- 返回:
- whether to swing the hand; always takes effect, regardless of cancellation
-
getHand
返回 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_HAND
if this is an attack or pick block input.- 返回:
- the hand that caused the input
-
isAttack
public boolean isAttack()返回true
if the mouse button is the left mouse button。- 返回:
true
if the mouse button is the left mouse button
-
isUseItem
public boolean isUseItem()返回true
if the mouse button is the right mouse button。- 返回:
true
if the mouse button is the right mouse button
-
isPickBlock
public boolean isPickBlock()返回true
if the mouse button is the middle mouse button。- 返回:
true
if the mouse button is the middle mouse button
-
getKeyMapping
返回 the key mapping which triggered this event。- 返回:
- the key mapping which triggered this event
-