mojira.dev
MCPE-187726

beforeOnPlayerPlace custom component doesn't fire if "replace_block_item" is true

The new stable release brings the "replace_block_item" option to "minecraft:block_placer" but it still doens't fix the following bug:
-When "replace_block_item" is set to true and the block has "beforeOnPlayerPlace" as a custom component event, it doesn't fire the event.

Steps to Reproduce:
Install the addon attached in this report. The addon has 2 blocks and 2 items, one item ("working_double_block") has "replace_block_item" set to true and the other one ("not_working_double_block") has "replace_block_item" set to false. Both blocks also have the same custom component that has "beforeOnPlayerPlace".

Observed Results:
When the "not_working_double_block" custom block is placed, the "beforeOnPlayerPlace" event is not fired unlike the other custom block "working_double_block".

Expected Results:
Both custom blocks should fire the "beforeOnPlayerPlace" event.

Linked issues

Attachments

Comments 4

Please attach a BP that demonstrates this issue.

We do not have enough information to reproduce this issue.

Please include the following information to help us understand your problem:

Steps to Reproduce:
1. (Explain what needs to be done for the issue to happen)
2.
3.

Observed Results:
(Briefly describe what happens)

Expected Results:
(Briefly describe what should happen)

Please also attach any needed commands, add-ons/behavior packs, data packs, resource packs, screenshots, videos, or worlds needed to help reproduce this issue.

Refer to the Bug Tracker Guidelines for more information about how to write helpful bug reports. Bug reports with insufficient information may be closed as Incomplete.

This issue is being temporarily resolved as Awaiting Response. Once the requested information has been delivered, the report will be reopened automatically.

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

For now there is a workaround

you can add a custom component to the item with the onUseOn event
(you would have to get the block using a method like this however)

onUseOn: e => {
const block = e.blockFace == 'North' ? e.block.north(1) : e.blockFace == 'East' ? e.block.east(1) : e.blockFace == 'South' ? e.block.south(1) : e.blockFace == 'West' ? e.block.west(1) : e.blockFace == 'Up' ? e.block.above(1) : e.block.below(1)  
}

Note that this event triggers after the block is placed, but before the itemStack is updated

 

Aguiles

(Unassigned)

Unconfirmed

Windows

Windows 11

add-on, block, custom_blocks, custom_items

1.21.60.21 Preview, 1.21.50.30 Preview, 1.21.50.26 Preview, 1.21.41 Hotfix, 1.21.43 Hotfix, 1.21.50.29 Preview, 1.21.44 Hotfix, 1.21.60.25 Preview, 1.21.60.24 Preview, 1.21.51 Hotfix

Retrieved