-
Notifications
You must be signed in to change notification settings - Fork 5
Events
Relentless edited this page Oct 23, 2022
·
3 revisions
If recipes were set up properly, you can also use two events to alter the functionality of summoning rituals even further. These events require KubeJS.
The two events share the same event object and expose the following properties:
- level
- the world/level the ritual was started in
- pos
- the block position of the Altar that was used for the ritual
- recipe
- the altar recipe that is currently being crafted
- it exposes several properties and methods too, see here
- player
- the player that invoked the ritual
- undefined if the ritual was started through automation
- returns a
ServerPlayer
This event is fired right after the Catalyst is inserted and before the ritual is actually started.
You can check for more conditions here and cancel the event to prevent the altar recipe from starting.
1.18
onEvent('summoningrituals.start', event => {
1.19
SummoningRituals.start(event => {
onEvent('summoningrituals.start', event => {
// you can access the properties mentioned above by using event.level or event.getLevel()
// lets a lightning strike hit the altar when starting the ritual
event.level.spawnLightning(event.pos.x, event.pos.y, event.pos.z, true);
// keep in mind the invoking player can be nullish in case the ritual was started by automation
if (!event.player) return;
// if the player does not have at least 3 levels, cancel the craft
if (event.player.getXpLevel() < 3) {
event.cancel();
}
});
This event is fired when the ritual is complete and the outputs have already been spawned.
It can be used to apply more effects to the player or handle achievements or stages.
1.18
onEvent('summoningrituals.complete', event => {
1.19
SummoningRituals.complete(event => {
onEvent('summoningrituals.complete', event => {
// you can access the properties mentioned above by using event.level or event.getLevel()
// keep in mind the invoking player can be nullish in case the ritual was started by automation
if (!event.player) return;
// give the invoking player 10 levels
event.player.addXPLevels(10);
});