This repository has been archived on 2023-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
ScriptCraft/docs/tutorials/EVENT.md
TheBrokenRail 0f63f63d86
Some checks failed
ScriptCraft/pipeline/head There was a failure building this commit
Update API and Docs
2020-06-02 16:01:26 -04:00

741 B

Use An Event

Example

import { Events } from 'minecraft';

Events.WORLD_TICK.addListener(e => {
    // Use e.getWorld()
});

All Events

Name Description Input Type Output Type
WORLD_TICK Triggered on every world tick. WorldEvent None
ATTACK_BLOCK Triggered when breaking a block. BlockEvent ActionResult
USE_BLOCK Triggered when using a block. BlockEvent ActionResult
USE_ITEM Triggered when using an item. ItemEvent ActionResult

Manually Trigger An Event

import { Events } from 'minecraft';

const result = Events.<Event Name>.trigger(<Input Value>);