#V2 Block Components Not working

1 messages · Page 1 of 1 (latest)

leaden arrow
#

All custom components registration has been moved to system.beforeEvents.startup

next stag
#

[Blocks][error]-block_definitions | C:/Users/maxim/AppData/Local/Packages/Microsoft.MinecraftUWP_8wekyb3d8bbwe/LocalState/games/com.mojang/development_behavior_packs/The Deep End BP | blocks/faded_bud.json | C:/Users/maxim/AppData/Local/Packages/Microsoft.MinecraftUWP_8wekyb3d8bbwe/LocalState/games/com.mojang/development_behavior_packs/The Deep End BP | blocks/faded_bud.json | deep_end:faded_bud | components | deep_end:on_fall_on_faded_bud | child 'deep_end:on_fall_on_faded_bud' not valid here.

[Blocks][error]-block_definitions | C:/Users/maxim/AppData/Local/Packages/Microsoft.MinecraftUWP_8wekyb3d8bbwe/LocalState/games/com.mojang/development_behavior_packs/The Deep End BP | blocks/faded_bud.json | Unexpected version for the loaded data

...

[Blocks][warning]-Warning: The blocks.json "format_version": 1.21.70 exceeds largest currently supported version: 1.21.40."format_version" 1.1.0 will be used.

[Texture][warning]-The block named deep_end:faded_bud used in a "blocks.json" file does not exist in the registry

#
import { world, system, BlockPermutation, EntityDamageCause, EffectTypes, ItemStack } from "@minecraft/server";
import { MinecraftEffectTypes } from './vanilla-data.js';
import { Perlin } from './perlin.js';
//FADED BUD: BEGIN
system.beforeEvents.startup.subscribe((initEvent) => {
    initEvent.blockComponentRegistry.registerCustomComponent('deep_end:on_fall_on_faded_bud', {
        onEntityFallOn(arg) {
            if (arg.fallDistance >= 1) {
                arg.entity.addEffect(MinecraftEffectTypes.Levitation, 9, {
                    amplifier: 50
                });
                arg.entity.addEffect(MinecraftEffectTypes.SlowFalling, 140, {
                    amplifier: 1
                });
            }
        }
    });
});
leaden arrow
#

What's your block's format version?

next stag
#

As of now, it's 1.21.80

leaden arrow
next stag
#
{
    "format_version": "1.21.80",
    "minecraft:block": {
        "description": {
            "identifier": "deep_end:faded_bud",
            "is_experimental": true,
            "menu_category": {
                "category": "nature"
            }
        },
        "components": {
            "deep_end:on_fall_on_faded_bud": {},
            "minecraft:light_emission": 2,
            "minecraft:destructible_by_mining": {
                "seconds_to_destroy": 2
            },
            "minecraft:destructible_by_explosion": {
                "explosion_resistance": 1
            }
        }
    }
}```
leaden arrow
#

And just to be sure, what version of MC are you playing on?

next stag
#

On the world, yes

#

and I'm playing on 1.21.81 stable

leaden arrow
next stag
#

[Scripting][error]-TypeError: cannot read property 'subscribe' of undefined at <anonymous> (deep_end_custom_item_components.js:2)

[Scripting][error]-Plugin [The Deep End - 0.1.0] - [main.js] ran with error: [TypeError: cannot read property 'subscribe' of undefined at <anonymous> (deep_end_custom_item_components.js:2)
]

[Blocks][error]-block_definitions | C:/Users/maxim/AppData/Local/Packages/Microsoft.MinecraftUWP_8wekyb3d8bbwe/LocalState/games/com.mojang/development_behavior_packs/The Deep End BP | blocks/faded_bud.json | C:/Users/maxim/AppData/Local/Packages/Microsoft.MinecraftUWP_8wekyb3d8bbwe/LocalState/games/com.mojang/development_behavior_packs/The Deep End BP | blocks/faded_bud.json | deep_end:faded_bud | components | deep_end:on_fall_on_faded_bud | child 'deep_end:on_fall_on_faded_bud' not valid here.

[Blocks][error]-block_definitions | C:/Users/maxim/AppData/Local/Packages/Microsoft.MinecraftUWP_8wekyb3d8bbwe/LocalState/games/com.mojang/development_behavior_packs/The Deep End BP | blocks/faded_bud.json | Unexpected version for the loaded data

[Scripting][warning]-[Watchdog] Spike from 'The Deep End' (144ms)

[Blocks][warning]-Warning: The blocks.json "format_version": 1.21.70 exceeds largest currently supported version: 1.21.40."format_version" 1.1.0 will be used.

[Texture][warning]-The block named deep_end:faded_bud used in a "blocks.json" file does not exist in the registry

leaden arrow
#

That's so weird. Not sure why it keeps saying unexpected version. Can you make a new world with the two toggles turned on?

next stag
#

I shall flip on all the experimental toggles

#

same errors, unfortunately

next stag
#

Has anything changed since the new stable version?

#

Fixed bug where block custom component event beforeOnPlayerPlace was not using read only privilege. Due to V1.X.X of scripting releasing without read only privilege, the fix is now only applied to V2.X.X and higher versions of scripting