EventHandler - Comcraft Mod Loader API

API Docs for: 0.6
Show:

EventHandler Class

Access to the internal event handling system

Methods

bindEvent

(
  • eventID
  • callback
)

Adds a new event to the internal event handler system. See the Events tab for event information

Parameters:

Events

Comcraft.displayScreen

Fired whenever the screen is changed. If this event returns a new GuiScreen, use that one instead.

Event Payload:

Game.Command

When a command is entered by the user in the current world

Event Payload:

Game.Player.moveEntity

Fired whenever the player presses any of the movement buttons. Either by touch or by keyboard.

Event Payload:

  • player EntityPlayer

    the player attempting to move.

  • movVec Vec3D

    The direction of movement where x = strafe, y = up and z = forward

Game.Player.updateEntityMove

Fired continually (every game tick) to update the player's movement. The player's current velocity is described by vVec (0, 0, 0) is stationary.
slowVec is subtracted from vVec after this event to cause slowness.
If one or more components of slowVec are negative, that would result in acceleration in those component directions otherwise, deceleration would occur.

Event Payload:

  • player EntityPlayer

    The player being updated

  • slowVec Vec3D

    The slowness vector

  • vVec Vec3D

    The player's velocity vector

Language.List

Array

Add a new language. This callback must return a 2 element array: [String langName, String langPath]

Player.Construct

Fired when constructing a player. Use this event to modify initial properties of the player.

Event Payload:

Render.Init

When the render engine is initialised, this event is triggered.

Event Payload:

World.Generate

This event is called when a new world has been defined and is called with these arguments:

Event Payload:

  • isFlat Boolean

    whether the user selected flat world

  • chunkGenerator ChunkGeneratorNormal | ChunkGeneratorFlat

    an instance of a chunk generator. If isFlat == true then chunkGenerator is ChunkGeneratorFlat, otherwise ChunkGeneratorNormal