Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-182546

faceLocation in BlockCustomComponent.onPlayerInteract doesn't return to actual faceLocation

XMLWordPrintable

    • Icon: Bug 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));
      {{        }}}
          });
      });

            MariusTanghal03 Unknown
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: