#Is there any way to close a gui? With commands or kubejs?
78 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
could use something like this in client_scripts:
ItemEvents.clientRightClicked('ftbquests:book', event => {
if (event.hand != "MAIN_HAND") return
if(!event.player.isCrouching()) return
Client.setScreen(null)
})
It would need to be in a server script
I am giving the player acces to the enderchest to save their inventorys and then teleport them, but I don't want them to be able to get their items back after the teleport, so I have to close the enderchestinterfaces somehow
If it is important, I use /enderchest from ftb to open it
You could do both
Client script receiving network packet to close screen
Tho there might be a method in player to close screen
player.closeContainer()?
I have no idea how to do that...
you dont need to
^
I will try it
Nope it does not close the ender chest
just paste your current code
Nope even the normal chest doesn't work
This is my whole scipt
Paste version of events.js from @plucky ore
all I can say is jēbal. @keen edge check that one out
^
Is my code that bad?
its bulky
you should definitely reformat it at least
space out the events and make sure they dont cascade
like this shouldnt be happening
usually a sign of missing } or ) but in this case I think its just spacing
...
if(Math.random()<1.0){ is this some debug code? because this if statement will always be true
That has nothing to do with the enderchest not closing
I have it on that for testing, later on it will be on 0.1 or so
where is that enderchest closing code supposed to go?
There were it is now
ah, found it
rest of the schedules work properly?
Yes everything works fine
hm
I built in the ..seconds left to test if the rest works
alright, then instead of e.player.closeContainer() you can change it to e.player.sendData('close_gui', null)
I will try that
and then make a client_scripts script:
NetworkEvents.dataReceived('close_gui', event => {
Client.setScreen(null)
})
thats how you can send packets from server to client
I always think like this mod is too op, then someone tells me something like this
lol
It still doesn't close it, I will try with a normal chest...
It also doesn't close a normal chest
thats.. weird
Paste version of events.js, script.js from @plucky ore
what if you do just
NetworkEvents.dataReceived('close_gui', event => {
Client.setScreen(null)
console.log('Test')
})
does Test get printed to logs/kubejs/client.log?
and did you restart the game?
or at least run /kubejs reload client_scripts
since /reload only affects server scripts
No I didn't
I didn't know that sorry
I will test that quick
AHUJEL
its mostly formatting
It now works thank you
not actually nested event callbacks

