#Gui not working [After Update]

1 messages ยท Page 1 of 1 (latest)

dull wing
#

Typeid of undefined

#
event.item.typeId === settings.gui.item.typeId
#

Yeah

#

Wait

#

itemStack right?

blazing sedge
#

item is now itemStack

dull wing
#

But still

#

Typeid of undefined

#

Plss

#

Help

#

Me

silent plank
#

@dull wing

world.beforeEvents.itemUse.subscribe((data) => {
    const player = data.source;
    const item = data.itemStack.typeId;
    if (item === 'minecraft:compass') {
        system.run(() => {
dull wing
noble pewterBOT
#
Program Output
/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
dull wing
#

@trim moss

#

I need your help

dull wing
#

@silent plank

silent plank
#

Yes, How could I help?

dull wing
#

See the gui.js and check if they are any mistakes i have done

silent plank
dull wing
#

Yeah

silent plank
#

Ok, I will be back

dull wing
#

Ya take ur time

silent plank
#

@dull wing there were SOO many errors! But now your code is working!

noble pewterBOT
#
Program Output
(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
silent plank
#

Also why did you execute a function inside a function inside a function?

weary scaffold
#
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?

silent plank
#

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

weary scaffold
#

ye

silent plank
#

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
weary scaffold
#

ah

silent plank
#

Let me know how your new code works!

weary scaffold
#

...

silent plank
#

Direct message me this link

#

Send it again

weary scaffold
#

i send dms

dull wing
#

No error but didn't open form

#

You checked it right?

#

@silent plank

#

@worldly sedge

#

Do you know how to fix it

silent plank
#

Which errors are you facing that need to be addressed?

dull wing
#

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

silent plank
#

I don't understand the error that is being caused, It baffles me

dull wing
#

Uh?

#

What error its showing?

worldly sedge
silent plank
near willow
#

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

dull wing
#

I changed the manifest

dull wing
#

I will give it a try

dull wing
#

Nothing works

#

Any helps

silent plank
#

I forgot about this, What exactly should this pack do?

dull wing
silent plank
#

Oh, Yes this error, I don't understand why it's here

dull wing
#

I have a working code

#

I fixed it

#

If you want I can give you

silent plank
#

What caused the error? No I would not like your code