mojira.dev
MCPE-164506

Script API - Crashes when calling block.permutation.getAllProperties() on a custom block.

The issue:
Calling block.permutation.getAllProperties() on a custom block created with holiday creator experimental features with a set block property crashes Minecraft (tested both on BDS and client Minecraft).

Steps to reproduce:

  1. Create a custom block definition with some block property. Like the example provided below:

*{*
    *"format_version": "1.19.0",*
    *"minecraft:block": {*
        *"description": {*
            *"identifier": "example:custom_block",*
            *"properties": {*
                *"example:property_test": [0,1,2]*
            *},*
            *"is_experimental": true,*
            *"register_to_creative_menu": true,*
            *"menu_category": {*
                *"category": "construction"*
            *}*
        *},*
        *"components": {*
            *"minecraft:destroy_time": 0.0,*
            *"minecraft:block_light_filter": 0,*
            *"minecraft:collision_box": {*
                *"origin": [-8,0,-8],*
                *"size": [16,16,16]*
            *},*
            *"minecraft:selection_box": {*
                *"origin": [-8,0,-8],*
                *"size": [16,16,16]*
            *},*
            *"minecraft:material_instances": {*
                {*}"{*}": {*
                    *"texture": "wood_oak",*
                    *"render_method": "alpha_test"*
                *}*
            *},*
            *"minecraft:on_player_placing": {*
                *"event": "example:property_test",*
                *"target": "self"*
            *},*
        *},*
        *"events": {*
            *"example:set_rotation": {*
                *"set_block_property": {*
                    *"example:property_test": "1.0"*
                *}*
            *}*
        *},*
        *"permutations": [*
            *{*
                *"condition": "query.block_property('example:property_test') == 1.0",*
                *"components": {*
                    *"minecraft:rotation": [*
                        *0,*
                        *90,*
                        *0*
                    *]*
                *}*
            *}*
        *]*
    *}*
*}*

   2. Run such script using Script-API:
import {world} from '@minecraft/server';

world.events.itemUseOn.subscribe((eventData) => {
 if (eventData.item.typeId === 'minecraft:stick') {
  const block = eventData.source.dimension.getBlock(eventData.blockLocation);
  for (const permutation of block.permutation.getAllProperties()) {
  world.say(`[${permutation.name}] - ${permutation.value}`);
  }
 }
});

   3. Open a world with the custom behavior pack, place the custom block and right click it with a Stick item.

Expected result:
Chat message gets sent listing all the block properties.

Actual result:
Minecraft client/server crashes.

Additional context:
Functions of block.permutation like getProperty() actually work, the only problem I've found was with the function getAllProperties().

Comments 2

Thank you for your report!

However, this issue has been temporarily closed as Awaiting Response.

Is this still an issue in the latest version? If yes, could you please attach an example addon showcasing the issue?

This ticket will automatically reopen when you reply.

Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📓 Project Summary – 📧 Suggestions – 📖 Minecraft Wiki

Cleaning up old tickets: This ticket had been set to 'Awaiting Response', but has not received a response from the reporter (~3 months+) so is being closed as Incomplete. If you feel this is still a valid issue then please comment, or create a new ticket following the Issue Guidelines which includes steps to reproduce the problem.

Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki

PavelDobCZ23

(Unassigned)

Unconfirmed

Multiple

Windows 11

1.19.50.25 Preview

Retrieved