-
Bug
-
Resolution: Incomplete
-
None
-
1.18.0.21 Beta
-
None
-
Creative
-
Plausible
-
Windows
If the size of the world exceeds 250MB gametest-related tasks will not run properly.
(There may be translation errors)
This is the manifest.json I entered
{ "format_version": 2, "header": { "name": "pack.name", "description": "pack.description", "uuid": "9e5420d7-e1cb-4213-b30b-39a88d9705f4", "min_engine_version": [1, 16, 100], "version": [1, 0, 0] }, "modules": [{ "description": "pack.description", "type": "data", "uuid": "3d2beb24-1be7-4b62-b8a7-7cd949d2ada8", "version": [1, 0, 0] }, { "type": "javascript", "uuid": "4d37b624-a58d-449e-9653-0ae0b2610279", "entry": "scripts/main.js", "version": [1, 0, 0] } ], "dependencies": [{ "uuid": "b26a4d4c-afdf-4690-88f8-931846312678", "version": [0, 1, 0] }, { "uuid": "6f4b6893-1bb6-42fd-b458-7fa3d0c89616", "version": [0, 1, 0] } ] }
Then this is the script in scripts/mian.js
import \{ Commands, World } from "mojang-minecraft" let test; World.events.beforeChat.subscribe((msg) => { if (msg.message == "hello") { test = "test success"; Commands.run(`tellraw "${msg.sender.name}" \{"rawtext":[{"text":"${test}"}]}`, World.getDimension("overworld")) msg.message = `test '${msg.message}'` } })
If reproduce the chat window, it works like this in a world that is less than 250MB
-----------------------------------------------
exit
-----------------------------------------------
test success
<steve> test 'hello'
-----------------------------------------------
By the way, a world with more than 250MB is like this
-----------------------------------------------
exit
-----------------------------------------------
<steve> hello
-----------------------------------------------
At first I thought the script was not running, but the script was obviously running.
The proof was this when I removed the conditional statement and the commands.run function and made it like this:
import \{ Commands, World } from "mojang-minecraft" let test; World.events.beforeChat.subscribe((msg) => { msg.message = `test '${msg.message}'` })
-----------------------------------------------
exit
-----------------------------------------------
<steve> test 'hello'
<steve> test 'hi'
<steve> test 'a'
<steve> test 'b'
-----------------------------------------------
This time I tried to remove only the commands.run function
import \{ Commands, World } from "mojang-minecraft" let test; World.events.beforeChat.subscribe((msg) => { if (msg.message == "hello") msg.message = `test '${msg.message}'` })
The result was
-----------------------------------------------
exit
-----------------------------------------------
<steve> test 'hello'
<steve> hi
<steve> a
<steve> b
-----------------------------------------------
This time I tried using only the commands.run function
import \{ Commands, World } from "mojang-minecraft" let test; World.events.beforeChat.subscribe((msg) => { Commands.run(`tellraw "${msg.sender.name}" \{"rawtext":[{"text":"test"}]}`, World.getDimension("overworld")) })
The result was
-----------------------------------------------
exit
-----------------------------------------------
<steve> hello
<steve> hi
<steve> a
<steve> b
-----------------------------------------------
nothing happened
(I wish I could delete the bug report.)