#Scripting V2 Custom Components Registration

1 messages · Page 1 of 1 (latest)

crystal coyote
#

A while back, Mojang noted the creation of @minecraft/server Version 2.0.0-alpha. I hadn't messed with it until recently.

It looks like the worldInitialize event is gone and has been replaced by system.beforeEvents.startup:

import {system} from "@minecraft/server"
system.beforeEvents.startup.subscribe(
    event => {
        event.blockComponentRegistry.registerCustomComponent(
            "test:a",
            {onTick(event) {console.warn("New!")}}
        )
    }
)

I'm sure there are other changes, but this is the one that stands out the most to me. So far as I can tell, nothing has changed on the blocks side with registration — it's a scripting only change.

I guess the scripting team felt registrations had a better home in system than in world? Personally, I like the change.

Attached is the exports list from @minecraft/server, to those that are curious. I'm sure someone has/can emit something more robust to look into V2.

jade tree
crystal coyote
jade tree
crystal coyote
#

Well… anyway, this is in the latest Preview for sure. I just double-checked.

jade tree
crystal coyote
#

Well, I'm afraid the documentation is not up to date or should otherwise not yet exist because it is tentative.

jade tree
#

Yes, but why would they add a duplicate worldInititalize event? Moreover, they can no longer redo the worldInititalize event. +Previously, the documentation contained version 2.0.0, but now it is not there. You referred to the post of October 17th. I think it's already outdated

crystal coyote
#

They can absolutely destroy the worldInitialize event. They follow semantic versioning, which allows them to issue breaking changes on major releases (e.g., v2).

jade tree
#

I need to check if this version is available..

jade tree
#

Hmm, it exists...

crystal coyote
#

Told ya' so. Let me know if you find anything I didn't catch.

tulip seal
#

but there isn't library or document yet

#

that's so sad

#

ooo it requires system.run to execute world.getAllPlayers

#

the 2.0.0-alpha

fringe ice