PlayerClickListener.java
2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
* This file is part of LiteLoader.
* Copyright (C) 2012-16 Adam Mummery-Smith
* All Rights Reserved.
*/
package com.mumfrey.liteloader;
import com.mumfrey.liteloader.PlayerInteractionListener.MouseButton;
import net.minecraft.client.entity.EntityPlayerSP;
/**
* Interface for mods which want to listen for and intercept mouse events on the
* client side <em>before</em> they trigger remote actions, or otherwise just
* be notified that a click is about to be dispatched.
*
* @author Adam Mummery-Smith
*/
public interface PlayerClickListener extends LiteMod
{
/**
* For left, middle and right clicks. Called when the click event is
* processed, before any handling has been done. Note that the context of
* the click can be obtained from:
*
* <ul>
* <li><tt>Minecraft.objectMouseOver</tt> the object currently under
* cursor.</li>
* <li><tt>EntityUtilities.rayTraceFromEntity</tt> using the supplied
* player is useful to determine objects under the cursor at longer
* distances than the player's reach.</li>
* <li><tt>player.isRowingBoat()</tt> is used to inhibit a lot of vanilla
* click behaviour and is worth checking state if acting upon clicks.
* </li>
* </ul>
*
* @param player The local player
* @param button The mouse button which was clicked
* @return true to allow the click to be processed normally, false to
* inhibit further processing of the click. Other listeners will still
* be notified.
*/
public abstract boolean onMouseClicked(EntityPlayerSP player, MouseButton button);
/**
* For left and right clicks only, when the player holds the key down the
* game periodically processes additional events (eg. mining), this event is
* raised after the initial click when the mouse button is held down.
*
* @param player The local player
* @param button The mouse button being held, only valid for LEFT and RIGHT
* @return true to allow the button held event to be processed normally,
* false to inhibit further processing of the click. Other listeners
* will still be notified.
*/
public abstract boolean onMouseHeld(EntityPlayerSP player, MouseButton button);
}