#Can't use things like ActionFormData

1 messages · Page 1 of 1 (latest)

ebon oar
#

I kep getting errors saying I don't have the privileges to use it and some things like "worldGetDynamicProperties"

[Scripting][error]-ReferenceError: Native function [World::getDynamicProperty] does not have required privileges. at <anonymous> (main.js:32)

[Scripting][error]-Plugin [Decayed Reality V2 BP (v0.7) - 1.0.0] - [main.js] ran with error: [ReferenceError: Native function [World::getDynamicProperty] does not have required privileges. at <anonymous> (main.js:32)
]

#

[Scripting][error]-ReferenceError: Native constructor for [ActionFormData] does not have required privileges. at ActionFormData (native)
at <anonymous> (Items.js:9)

[Scripting][error]-Plugin [Decayed Reality V2 BP (v0.7) - 1.0.0] - [main.js] ran with error: [ReferenceError: Native constructor for [ActionFormData] does not have required privileges. at ActionFormData (native)
at <anonymous> (Items.js:9)
]

twilit arrow
#

2.0.0-beta?

#

Wrapping your code in worldLoad afterEvent should help

ebon oar
#

btw I have another problem

#

world.afterEvents.worldInitialize.subscribe(initEvent => {

twilit arrow
#

yup

ebon oar
#

this is my thing for custom components

twilit arrow
#

worldLoad

#

oh

#

for custom components you should use system.beforeEvents

#

i don't really remember the event name

ebon oar
#

and let me get the error

#

[Scripting][error]-Plugin [Decayed Reality V2 BP (v0.7) - 1.0.0] - [main.js] ran with error: [TypeError: cannot read property 'subscribe' of undefined at <anonymous> (block_trigger.js:5) ]

#

it did that before too

ebon oar
swift swift
#

system.beforeEvents.startup.subscribe()

ebon oar
#

oh thx it worked!!!!

ebon oar
#

Now I have a last problem

#

// Initial population of the tracking map
addEntitiesToTracking();

#

I have to keep it out of a system.interval loop, bc then the variable wont work idk why

#

but theres the same error from the beggining

twilit arrow
#

what's the error

ebon oar
#

[Scripting][error]-Plugin [Decayed Reality V2 BP (v0.7) - 1.0.0] - [main.js] ran with error: [ReferenceError: Native function [World::getDimension] does not have required privileges. at addEntitiesToTracking (main.js:301)
at <anonymous> (main.js:311)
]

#

// Function to add entities to the tracking system
function addEntitiesToTracking() {
for (const entity of world.getDimension("overworld").getEntities()) {
if (entity.typeId === "minecraft:ender_dragon" && !entity.hasTag("splitted") && !entity.hasTag("devour")) {
if (!trackedEntities.has(entity)) {
trackedEntities.set(entity, entity.location); // Add to tracking
}
}
}
}

// Initial population of the tracking map
addEntitiesToTracking();

system.runInterval(() => {
addEntitiesToTracking();
});

twilit arrow
#

worldload

#

again

#

They changed the way the scripts work

#

and by default they work in a pre-world load state

ebon oar
#

and so where do I put the world load in the function?

twilit arrow
#

after world load everything is "back to normal"

#

around addEntitiesToTracking()

ebon oar
twilit arrow
#

yup

#

wha

#

world.afterEvents.worldLoad.subscribe...

ebon oar
#

like this?

twilit arrow
#

Ye

ebon oar
#

k

azure bane
#

@ebon oar i have this js code, YES is updated for 1.21.70 and upper u can use this for decayed v2