question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scarpet: Add `__on_player_placing_block` (name subject to change)

See original GitHub issue

Currently, __on_player_places_block is fired after the player places a block, not before. According to #1497, changing this “would involve a significant behaviour change, breaking many scripts”.

As a compromise, a new event __on_player_places_block_pre should be added, which functions just like __on_player_places_block, the only difference being it fires before the block is placed.

By doing this, existing scripts can keep the current behavior, while new scripts can take advantage of the new event and the features in #1497 to block the placement of a block under certain conditions.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
replaceitemcommented, Nov 9, 2022

It was added in the cancellation PR, triggering before the placing, allowing to cancel. The old event __on_player_places_block remained untouched.

1reaction
Ghoulboy78commented, Jul 23, 2022

maybe __on_player_placing_block cos it’s right as the player is placing the block, as opposed to after they place it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found