Mojira Archive
MCPE-155143

Molang query.block_property can't reference "minecraft" namespace properties

Trying to reference minecraft namespace block properties in molang queries (ie minecraft:redstone_signal) will fail because all block states have to be registered in the description.properties section of the block definition.

Steps to Reproduce:

  1. Create a custom block.
  2. Add a molang query.block_property() that references a known property such as minecraft:redstone_signal.
  3. Trigger molang condition in-game.

Observed Results:

Query fails remarking use of "non-registered block state".

 

Expected Results:

Query succeeds returning the value of said block property.

Notes:

The goal here was to check if my custom block is receiving a redstone signal. I ran a gametest to log what properties existed on the block, which is how I learned that "redstone_signal" gets set by adjacent redstone signal blocks.

The description.properties field does not allow the use of the minecraft namespace as indicated by the error it returns.

[Blocks][error]-block_definitions | {behavior_pack_block_path} | Identifier not allowed to use Minecraft namespace

But without the property being set here, the query.block_property throws the following error.

[Molong][error]-Error:query.block_property is making use of non-registered block state

Here's a sample block behaviour file demonstrating how it was being used.
 

{
 "format_version": "1.16.0",
 "minecraft:block": {
  "description": {
   "identifier": "test:block",
   "category": "construction",
   "is_experimental": true,
   "properties": {
   }
 },
 "components": {
  "minecraft:destroy_time": 1,
  "minecraft:explosion_resistance": 5,
  "minecraft:friction": 0.6,
  "minecraft:flammable": { "flame_odds": 0, "burn_odds": 0 },         
  "minecraft:map_color": "#FFFFFF",
  "minecraft:block_light_absorption": 0,
  "minecraft:block_light_emission": 0.25, 
  "minecraft:creative_category": { "category": "construction" }, 
  "minecraft:ticking": {
    "on_tick": {
     "event": "test:tick",
     "target": "self"
    },
    "range": [0, 10],
    "looping": true
   },
 },
 "events": {
  "test:tick": {
   "sequence": [
    {
     "run_command": { "command": "say tick" }
    },
    {
     "condition": "query.block_property('minecraft:redstone_signal')>0",   
     "run_command": { "command": "say powered" }
    },
    {
     "condition": "query.block_property('minecraft:redstone_signal')==0",   
     "run_command": { "command": "say unpowered" }
    }
   ]
  }, 
 }
}

Incomplete

lowlines

2022-04-30, 08:04 PM

2023-01-20, 05:49 PM

2023-01-20, 05:49 PM

1

0

Unconfirmed

1.18.31

-