-
Bug
-
Resolution: Incomplete
-
None
-
1.21.10.22 Preview, 1.20.81 Hotfix
-
None
-
Unconfirmed
-
Multiple
The faceLocation is a location relative to the bottom north-west corner of the block, which is (0,0,0) and (1,1,1) on the top south-east of the block. In BlockCustomComponent.onPlayerInteract it returns to an actual world coordinate where the player is interacted rather than a faceLocation like from other world events (e.g., from PlayerInteractWithBlock, itemUseOn)
//This return to an actual faceLocation of the block
world.afterEvents.playerInteractWithBlock.subscribe(e => {
console.warn(JSON.stringify(e.faceLocation));
});//This return to world coordinate where the player is interacted with
world.beforeEvents.worldInitialize.subscribe(e => {
e.blockTypeRegistry.registerCustomComponent('custom:component', {
onPlayerInteract(e) {
console.warn(JSON.stringify(e.faceLocation));
{{ }}}
});
});