-
Notifications
You must be signed in to change notification settings - Fork 10
Hooks
Connor4898 edited this page Jul 21, 2014
·
9 revisions
###attackHook
function attackHook(attacker, victim) { }
- Called when an entity is attacked.
- (Entity)
attacker
: The entity who attacked. - (Entity)
victim
: The entity who got attacked.
###blockEventHook
function blockEventHook(x, y, z, type, data) { }
- No information available
###chatHook
function chatHook(text) { }
- Called when something has been said in chat
- (String)
text
: The message
###chatReceiveHook
function chatReceiveHook(str, sender) { }
- No information available
###deathHook
function deathHook(attacker, victim) { }
- Called when an entity dies.
- (Entity)
attacker
: The entity who killed. - (Entity)
victim
: The entity who died.
###destroyBlock
function destroyBlock(x, y, z, side) { }
- Called when a block is destroyed.
- (Integer)
x, y, z
: The coordinates of the destroyed block. - (Integer)
side
: The side in which the block is destroyed. - Note: When this function is called, the block is ABOUT to be destroyed. After this function is called, the block will be destroyed.
###entityAddedHook
function entityAddedHook(entity) { }
- Called when an entity is added to the game.
- (Entity)
entity
: The entity.
###entityRemovedHook
function entityRemovedHook(entity) { }
- Called when an entity is removed from the world.
- (Entity)
entity
: The entity.
###leaveGame
function leaveGame() { }
- Called when the user exits a world.
- Accepts no parameters
###levelEventHook
function levelEventHook(player, eventType, x, y, z, data) { }
- No information available
###modTick
function modTick() { }
- Called every game tick. A game tick is 1/20 of a second. (Called 20 times in a second.)
- Accepts no parameters
###newLevel
function newLevel(hasLevel) { }
- Called when the user starts loading a level.
-
hasLevel
: ?
###procCmd
function procCmd(cmd) { }
- Called when a command is entered. (Chat text with "/" prefix.)
- (String)
cmd
: The command, with arguments and "/" omitted.
###selectLevelHook
function selectLevelHook() { }
- No information available
###serverMessageReceiveHook
function serverMessageReceiveHook(str) { }
- No information available
###startDestroyBlock
function startDestroyBlock(x, y, z, side) { }
- No information available
###useItem
function useItem(x, y, z, itemId, blockId, side, itemDamage, blockDamage) { }
- Called when a block is tapped.
- (Integer)
x, y, z
: The coordinates of the block tapped. - (Integer)
itemId
: The ID of the item held by the player. - (Integer)
blockId
: The ID of the block tapped. - (Integer)
side
: Side of the block tapped. - (Integer)
itemDamage
: Damage value of the item held. - (Integer)
blockDamage
: Damage value of the block tapped.
attackHook(attacker, victim);
blockEventHook(x, y, z, type, data);
chatReceiveHook(str, sender);
deathHook(attacker, victim);
destroyBlock(x, y, z, side);
entityAddedHook(entity);
entityRemovedHook(entity);
leaveGame();
levelEventHook(player, eventType, x, y, z, data);
modTick();
newLevel(hasLevel);
procCmd(cmd);
selectLevelHook();
serverMessageReceiveHook(str);
startDestroyBlock(x, y, z, side);
useItem(x, y, z, itemId, blockId, side, itemDamage, blockDamage);