Repository navigation
Hooks
benjamin edited this page Mar 23, 2018
·
4 revisions
function attackHook(attacker, victim) { }
- Called when an entity is attacked.
- (Entity)
attacker: The entity who attacked. - (Entity)
victim: The entity who got attacked.
function projectileHitBlockHook(projectile, blockX, blockY, blockZ, side) { }
- Called when a projectile like an arrow or a snowball hits a block
function projectileHitEntityHook(projectile, targetEntity)
- Called when a projectile like an arrow or a snowball hits a mob
function blockEventHook(x, y, z, type, data) { }
- No information available
function chatHook(text) { }
- Called when something has been said in chat
- (String)
text: The message
function chatReceiveHook(str, sender) { }
- No information available
function deathHook(attacker, victim) { }
- Called when an entity dies.
- (Entity)
attacker: The entity who killed. - (Entity)
victim: The entity who died.
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.
function entityAddedHook(entity) { }
- Called when an entity is added to the game.
- (Entity)
entity: The entity.
function entityRemovedHook(entity) { }
- Called when an entity is removed from the world.
- (Entity)
entity: The entity.
function eatHook(foodpoints, saturationratio) { }
function playerAddExpHook(player, experienceAdded)
- Gets called when the player collects xp
function playerExpLevelChangeHook(player, levelsAdded)
- Gets called when the players level changes
function levelEventHook(player, eventType, x, y, z, data) { }
- Called when a door gets opened or closed. (data: 0 = closing, 1 = opening, 2 = open)
function leaveGame() { }
- Called when the user exits a world.
- Accepts no parameters
function levelEventHook(player, eventType, x, y, z, data) { }
- No information available
function modTick() { }
- Called every game tick. A game tick is 1/20 of a second. (Called 20 times in a second.)
- Accepts no parameters
function newLevel(hasLevel) { }
- Called when the user starts loading a level.
-
hasLevel: ?
function procCmd(cmd) { }
- Called when a command is entered. (Chat text with "/" prefix.)
- (String)
cmd: The command, with arguments and "/" omitted.
function selectLevelHook() { }
- No information available
function serverMessageReceiveHook(str) { }
- No information available
function startDestroyBlock(x, y, z, side) { }
- No information available
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);