11. API - Events¶
The events module defines the Events
class, which provides methods for
querying events in the Minecraft world, and BlockHitEvent
which is the
only event type currently supported.
Note
All items in this module are available from the picraft
namespace
without having to import picraft.events
directly.
The following items are defined in the module:
11.1. Events¶
11.2. BlockHitEvent¶
-
class
picraft.events.
BlockHitEvent
(pos, face, player)[source]¶ Event representing a block being hit by a player.
This tuple derivative represents the event resulting from a player striking a block with their sword in the Minecraft world. Users will not normally need to construct instances of this class, rather they are constructed and returned by calls to
poll()
.Note
Please note that the block hit event only registers when the player right clicks with the sword. For some reason, left clicks do not count.
-
face
¶ A string indicating which face of the block was struck. This can be one of six values: ‘x+’, ‘x-‘, ‘y+’, ‘y-‘, ‘z+’, or ‘z-‘. The value indicates which axis moves in which direction if one travelled away from the block in the direction of the face.
-