#Gui not working [After Update]
1 messages ยท Page 1 of 1 (latest)
item is now itemStack
@dull wing
world.beforeEvents.itemUse.subscribe((data) => {
const player = data.source;
const item = data.itemStack.typeId;
if (item === 'minecraft:compass') {
system.run(() => {
/home/jail/prog.js:1
import { world, ItemStack, ItemLockMode, system } from "@minecraft/server";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/c
@silent plank
Yes, How could I help?
See the gui.js and check if they are any mistakes i have done
Yeah
Ok, I will be back
Ya take ur time
(node:22) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use โ`node --trace-warnings ...โ` to show where the warning was created)
/home/jail/prog.js:1
import { world, ItemStack, ItemLockMode, syste
Also why did you execute a function inside a function inside a function?
import { world } from "@minecraft/server";
import { ActionForm, ModalForm } from "../utils/FormPaper.js";
import { mainPage } from "../utils/forms.js";
world.events.beforeItemUse.subscribe(data => {
if (data.item.typeId === "minecraft:compass" && data.source.typeId === 'minecraft:player')
mainPage(data.source);
});
this work or broke?
So what you want to do is export the mainGUI from the file 'forms.js' into the current (./) And execute the content of it, Ismtjis correct?@weary scaffold
ye
No, That won't work, You must add an object {} or place your mainPage function on the if line, Here's the working code:
import { world } from "@minecraft/server";
import { ActionForm, ModalForm } from "../utils/FormPaper.js";
import { mainPage } from "../utils/forms.js";
world.events.beforeItemUse.subscribe(data => {
if (data.item.typeId === "minecraft:compass" && data.source.typeId === 'minecraft:player') {
mainPage(data.source);
}
});
```@weary scaffold
ah
Let me know how your new code works!
...
i send dms
No error but didn't open form
You checked it right?
@silent plank
@worldly sedge
Do you know how to fix it
Which errors are you facing that need to be addressed?
You checked the code right?
And you seem to be fine with the code
And I checked it
No errors in the game but when I right click the gui it didn't show the form
I don't understand the error that is being caused, It baffles me
sorry which one again
I believe the user is referring to the for pages title, Use compass to test:
try it
world.afterEvents.itemUse.subscribe(data => {
if (data.itemStack.typeId == "minecraft:compass") {
mainPage(data.source);
}
});
And change your manifest modules
minecraft/server 1.3.0-beta
minecraft/server-ui 1.1.0-beta
I changed the manifest
I will give it a try
Tested it but not working
Nothing works
Any helps
I forgot about this, What exactly should this pack do?
Oh, Yes this error, I don't understand why it's here
What caused the error? No I would not like your code