Mojira Archive
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().

Incomplete

PavelDobCZ23

2022-11-23, 12:41 AM

2024-01-24, 03:57 PM

2024-01-24, 03:57 PM

0

0

Unconfirmed

1.19.50.25 Preview

-