mojira.dev
MCPE-186594

Custom blocks with custom components are always interactable

Applying script-registered block custom components to a block results in that block becoming interactable, even when the onPlayerInteract event listener is not active.
This makes placing blocks on the custom block a worse experience and means that many items, such as projectiles, are impossible to throw when looking at a custom block.

The original "fix" for this issue was for the block the player is holding to be placed when the custom block is interacted with, however this creates more issues than it solves, with a delay between block placements and signs being placed with no edit text screen.

Steps to reproduce:

  • Import the provided example pack and apply it to a world

  • Join the world and place the custom block (which can be found at the end of the Construction category in the creative menu)

  • Right-click on the custom block to attempt to interact with it

Observed results:

  • The player's arm swings, indicating that the block has been interacted with

  • It is impossible to place several blocks in a line quickly by holding down the place button

  • Some blocks, such as signs, are placed without certain functionality

Expected results:

  • The block should not be interactable as the onPlayerInteract event listener is absent, meaning the player's arm will not swing

  • When placing other blocks on the custom block, default block placement functionality should be used, allowing for fast building by holding down the place button

Linked issues

Attachments

Comments 8

Can confirm, this is most likely a regression of the fix applied for MCPE-179928

I'm having a problem with creating a strippable log interaction. I only want the interaction to work when holding an axe, while still allowing block placement. To solve this and ensure blocks remain interactable by default, a good approach is adding a beforeOnPlayerInteract event with an interaction toggle. For example:

event.interact = true;

By default, interact would be set to false, and creators could enable it in the beforeEvent based on certain conditions. Then, the interaction itself could be managed via the onPlayerInteract afterEvent, which would only trigger if interaction was allowed through the beforeEvent.

I'm having a problem with creating a strippable log interaction. I only want the interaction to work when holding an axe, while still allowing block placement. To solve this and ensure blocks remain interactable by default, a good approach is adding a beforeOnPlayerInteract event with an interaction toggle. For example:

event.interact = true;

By default, interact would be set to false, and creators could enable it in the beforeEvent based on certain conditions. Then, the interaction itself could be managed via the onPlayerInteract afterEvent, which would only trigger if interaction was allowed through the beforeEvent.

I hope this bug takes priority. It almost makes using custom components unusable for gameplay, because ItemUse and ItemUseOn World AfterEvents also do not work. 

I hope this bug takes priority. It almost makes using custom components unusable for gameplay, because ItemUse and ItemUseOn World AfterEvents also do not work. 

Also in gameplay scenario's where a survival house is decorated by multiple blocks with custom components, it makes eating food impossible unless I find a specific block that doesn't trigger the sway animation.

Also in gameplay scenario's where a survival house is decorated by multiple blocks with custom components, it makes eating food impossible unless I find a specific block that doesn't trigger the sway animation.

QuazChick

(Unassigned)

1304425

Confirmed

Multiple

1.21.60.21 Preview, 1.21.50.20 Preview, 1.21.40.25 Preview, 1.21.40.22 Preview, 1.21.40.21 Preview, ..., 1.21.60.25 Preview, 1.21.60.24 Preview, 1.21.60.28 Preview, 1.21.70.20 Preview, 1.21.51 Hotfix

Retrieved