#client side gamemode 1.20.6 help
1 messages · Page 1 of 1 (latest)
tf is client side gamemode
is the image even related
well maybe i dunno what client side gamemode is xd
even tho that looks like speech bubbles to me
dont think that image is supposed to have been attached....
but anyways you can do client side gamemodes by sending a GAME_STATE_CHANGE packet i believe, i was experimenting with something like this earlier:
set {_newPacket} to {_packet}.getIntegers().write(3, -1)
ProtocolLibrary.getProtocolManager().sendServerPacket(player, {_newPacket})```
it probably doesn't work perfectly (but u get the idea) but that sets field 3 of the GAME_STATE_CHANGE packet (the gamemode state) to -1 which is a fake spectator mode
the code that i attached uses protcollib + skript-reflect
import:
net.minecraft.server.v1_16_R3.PacketPlayOutGameStateChange$a
effect change client side gamemode of %players% to %gamemode%:
trigger:
set {_packet} to new play_server_game_state_change packet
set field 1 of {_packet} to 0 if "%expression-2%" is "survival"
set field 1 of {_packet} to 1 if "%expression-2%" is "creative"
set field 1 of {_packet} to 2 if "%expression-2%" is "adventure"
set field 1 of {_packet} to 3 if "%expression-2%" is "spectator"
set field 0 of {_packet} to new a(3) # reason
send packet {_packet} to expression-1 without calling event````
Found this but import doenst work
thats because its using nms
afaik you cant import nms like that without having mojang mapping (which requires buildtools to get, i dont even understand it fully bc its very complicated) where did you get that code?
nms mappings are different for each version (they are highly version-dependent) as they are obfuscated by mojang
looks like that code uses skript-packet combined with nms and skript-reflect
well you can't just import net.minecraft.server stuff in skript unless you have the proper setup (from my understanding)
well that would have been helpful for me to know 6 days ago to know so i didn't have to waste my entire weekend with setting up the paperweight test plugin to try messing with nms in java and it still didnt work 💀
didnt seem to work when i imported them from before, i'll have to give it a second go
all the java code i found online had a different import syntax (which included the game version) is there a reason why the skript import doesnt?
Aynone can help me?
we don't do that here
Thats a mod but you could probally do it with custom displays
looks like a bunch of text displays with a 3d skin resource pack for the npc but it doesnt look related to the question
The picture already belongs to me, I'm not asking for text displays.
And not mod
3d skin layers mod
Im not asking that guys
Anyone know Client side gamemode changin?
you have to use packets (like the code you put above) to change the client's gamemode
Yes but it doesnt work
im using 1.20.6
the import is wrong
try what Sovde mentioned and remove .v1_16_R3 because 1.17+ versions don't use that part anymore
it'd look like this
need protocollib right?
no
oh okay
nice
Ill try
net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity
don't forget the $a
if it's still a
probably is
and make sure to use the gamestatechange and not the spawn entity packet
trigger:
set {_packet} to new play_server_game_state_change packet
set field 1 of {_packet} to 0 if "%expression-2%" is "survival"
set field 1 of {_packet} to 1 if "%expression-2%" is "creative"
set field 1 of {_packet} to 2 if "%expression-2%" is "adventure"
set field 1 of {_packet} to 3 if "%expression-2%" is "spectator"
set field 0 of {_packet} to new a(3) # reason
send packet {_packet} to expression-1 without calling event```
is it wrong?