Closed Colton1070 closed 1 year ago
It looks like it was designed that way
Duplicate of #548
If that's the case could there be an additional property returned as a convenience for using player.getHand() during the onPlaceBlock event for this purpose?
So instead of:
mc.listen("onPlaceBlock", (player, block) => {
log('onPlaceBlock Triggered:');
log(block.name); //minecraft:grass
log(player.getHand().type); //minecraft:chest
});
It could be:
mc.listen("onPlaceBlock", (player, block, item) => {
log('onPlaceBlock Triggered:');
log(block.name); //minecraft:grass
log(item.name); //minecraft:chest
});
Or I could make a docs pull request to make it more obvious in case such a convenience change is seen as unnecessary,
emmm Maybe you should use "afterPlaceBlock" This monitor records the blocks placed But this monitor can't be intercepted
Exceptions module
ScriptEngine
Operating System
Windows 11
LiteLoader version
2.6.2
BDS version
1.19.21.01(ProtocolVersion 545)
What happened?
mc.listen("onPlaceBlock", (player, block) => {});
When logging the placed block (block.name/block.type), it does not log the block that was attempted to be placed. Instead it logs the block that was attempted to be placed on. For example, placing a chest on a grass block logsminecraft:grass
.Is this intended behavior? Using "afterPlaceBlock" correctly logs the right block, however the block that is placed cannot be intercepted - or at least it didn't let me intercept it to prevent it from being placed (docs might be erroneous saying that it can be). I'd assume that any interceptions should be done via onPlaceBlock anyways because that makes more sense.
I want to intercept blocks of a certain type from being placed (chests, signs) for a plugin I am developing. Thanks for the hard work and look forward to getting an answer.
Steps to reproduce?
Relevant log output
No response
Plugin list