- SetTimeout support
What people often run into when starting out with Minecraft Scripting is the problem with timing, the standards for timing code as you may have noticed are the
setInterval functions and their cancel functions.
These standardized methods are used by the frame system where you can set the delay to millisecond precision, but minecraft uses a tick to process changes in the world, right? That's why even these methods are not and will not be available, instead we got the
system.runInterval system methods from version 1.19.70, which delay to the precision of one tick, you can read more about on Microsoft Docs or Wiki Tutorial
- Eval permission
Not everyone can encounter this problem because the use of eval and Function method for running code in string format is not great.
Some browsers also prohibit the use of these methods, mainly the eval method, when using eval there is a risk of malicious code that can harm the problem in your add-on, which is why it is disabled by default.
To enable these methods that evaluate code, you must mention it in the manifest. What and how you can find here. Start with Script API.
- Native handles
That means the only function you called with a non-natively released object, the function tries to find a native handle on an object that is no longer there.
You will encounter this most often when using events, because in every data events are natively released after the event ends, therefore you cannot save the object that was given by the event; if you have a player object, after the player leaves, the native handle of the object is released and you can no longer call the methods and properties of the object that used to be the player.
What is supported
Object- Standard function constructor for objects
Function- Standard function constructor for functions
AggregateError) - Classes for error construction
UInt8ClampedArray) Standard function constructor for Array objects
parseFloat- Standard methods for parsing string to number
isFinite- Standard Methods for checking number types
encodeURI- Standard methods for decoding and encoding URI paths
encodeURIComponent- Standard methods for decoding and encoding URI components
unescape- Non-Standard methods please use decodeURI/encodeURI if its possible
undefined- Standard variables for incode usage,
__date_clock- Build-in QuickJS method for getting current time
(Number, Boolean, String, Symbol) - Standard function constructor for JS primitives
Math- Standard Object having primary math functions
Reflect- Standard Object having build-in methods
eval- Standard Method for evaluating string as code
globalThis- Standard Object with access to global scoped variables
Date- Standard function constructor for date instance
RegExp- Standard function constructor for regex instance
JSON- Standard Object having stringify and parse methods for JSON interaction
Proxy- Standard function constructor for build-in proxy handler
WeakSer- Standard function constructors for data organisation objects
DataView- Standard function constructor for binary arrays interactions
Promise- Standard function constructor for async interaction
console- Standard object having base output methods (
What is not supported
BigInt- Standard function constructor for big ints
setTimeout- Standard function for timing code runs
setInterval- Standard function for timing code runs in intervals
clearTimeout- Standard function for canceling setTimeout runs
clearInterval- Standard function for canceling setInterval runs