Get ID of block placed by player in server side script?
Andrew Mclaughlin
I'm creating a behavior pack and I need to detect the ID of a block placed by a player. The player_placed_block event doesn't give me an ID with the event data, it only gives me a three-dimensional coordinate of where the block was placed, and which player placed it:
There's also a getBlock method, which would work great with the coordinates I get back from the player_plaed_block event; however, it requires a ticking area:
The problem with getBlock is that I can't find anything in the documentation for getting the ticking area of the player, and the only thing I could find on the web was a ticket for code that didn't work, and seemed to require the tickingarea command to be ran in game first, which defeats the purpose of my script.
Is there a way to not only know the position and player, but also the type of block placed?
1 Answer
I assume this is from the community-ran bedrock(dawt)dev website? I recommend checking their Wiki / Guides which is also updated by the community.