Just updated to 1.20 and working with some scripting that worked in 1.19. I'm attempting to teleport the player, and am getting this error:
ReferenceError: Native function [Entity::teleport] does not have required privileges
I'm actually seeing this on a few different commands (such as Entity.kill()). I don't see any reference in the documentation to privileges. Manifest is set to 1.3.0-beta:
"dependencies": [
{
"module_name": "@minecraft/server",
"version": "1.3.0-beta"
}
]
Just need a little guidance here.
Comments 5
I just found the reason why they do indeed throw errors in certain environments. It's worth noting that the reason is actually written in the documentation, which states "This function can't be called in read-only mode."
To solve this issue, please refer to Bedrock Wiki.
Thanks @PFiS1737 for the link and info. It makes sense...but I cannot get it to work. Even the example on the Bedrock Wiki doesn't seem to work in my creative testing world. Does this only work with the beta Minecraft version (i.e. 1.20.10.21) and module 1.4.0-beta rather than the stable release (1.20.0.01) and module 1.3.0-beta? I'm running 1.20.0.01, and module version 1.4.0-beta appears to be invalid there; I can only use 1.3.0-beta.
When I wrap my function in a system.run(() => {}, it simply doesn't fire. Everything up until that (i.e. event.cancel = true; ) works. I'm thinking this is a 1.4.0-beta vs 1.3.0-beta thing.
Update: after updating my system to 1.20.10, I was able to utilize module version 1.4.0-beta and the system.run(() => {} syntax. I think this probably didn't work right in the 1.20.0 client, but it appears to be fine now.
I have occurred this issue when using `runCommand` to run `scoreboard` or `say`, too, whether on `Dimension` nor `Player`. My world has cheats enabled, and I can run them directly in game, but not through a script. I'm not sure if this is an issue with my script or the engine itself.
When I run `overworld.runCommand("say something")` at the root, it works, but I get an error when running it in other contexts. I haven't been able to find a simple way to reproduce the issue, so I will continue testing.
Minecraft version: beta 1.20.10.21
Module version: 1.4.0-beta