[Scarpet] Added ability to cancel events (#1497)

* Added ability to cancel events

* Made more events cancellable

* Added event_priority to __config

* Check for string values for performance

* Made player_finishes_using_item cancellable

* Made player_chooses_recipe cancellable

* Made player_swaps_hands cancellable

* Made player_message cancellable

* Added __on_player_placing_block (#1498)

* Added event to docs, keywords, event_test

* Added docs for event cancellation
This commit is contained in:
replaceitem authored and GitHub committed 2022-10-15 13:30:53 +02:00
1 parent 4bb4b557e5
commit 24b9c386ec
14 files changed
+243 -99

No files matched your search

@@ -177,6 +177,20 @@ __on_player_interacts_with_block(player, hand, block, face, hitvec) ->
print(' - face: '+face);
print(' - hitvec: '+map(hitvec, str('%.2f',_)))
);
__on_player_placing_block(player, item_tuple, hand, block) ->
(
l(item, count, nbt) = item_tuple || l('None', 0, null);
print('');
print('__on_player_placing_block(player, item_tuple, hand, block)');
print('player about to place a block:');
print(' - player: '+player);
print(' - block: '+block+' at '+map(pos(block), str('%.2f',_)));
print(' - hand: '+hand);
print(' - item:');
print(' > name: '+item);
print(' > count: '+count);
print(' > nbt: '+nbt);
);
__on_player_places_block(player, item_tuple, hand, block) ->
(
l(item, count, nbt) = item_tuple || l('None', 0, null);