Sunser Posted November 10, 2018 Posted November 10, 2018 (edited) Hi everyone, I'm trying to prevent unlogged players to do anything. My next challenge is to prevent players from moving, but I can't find anything that satisfies me. I've been looking into EntityPlayerMP class hierachy and I've found the SPacketPlayerPosLook class, which is sent when a player wants to move. I wonder if there is a way to stop it. I've been looking from a triggered Event when a packet is sent but I did not find. I've also took a look at the doc and tried to understand how things work but I did not find yet a way to achieve it. I wonder if an override of the IMessageHandler::onMessage(SomeIMessage req, MessageContext ctx) method would make it. Any suggestions ? Thanks for your time. Edited November 12, 2018 by Sunser Quote
V0idWa1k3r Posted November 10, 2018 Posted November 10, 2018 The player movement happens entirely on the client, it just periodically sends packets to the server notifying it of the new position. So your options are either reset the player's position each tick on the server or cancel the input on the client. Quote
Cadiboo Posted November 10, 2018 Posted November 10, 2018 Take a look at what the slowness effect does Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
Sunser Posted November 10, 2018 Author Posted November 10, 2018 2 hours ago, V0idWa1k3r said: The player movement happens entirely on the client, it just periodically sends packets to the server notifying it of the new position. So your options are either reset the player's position each tick on the server or cancel the input on the client. I was afraid I have to do this. 2 hours ago, Cadiboo said: Take a look at what the slowness effect does Someone already recommanded it in another post. I'll take a look. Thank you both. I will update the post's status as soon as I get something functional. Quote
Sunser Posted November 12, 2018 Author Posted November 12, 2018 I've tried adding a huge Slowness effect to some players. This works great but they can still move by jumping. So I've been looking for the other idea but I did not find a way to make it being called every tick. I've been thinking about the onUpdate() method but I haven't found how to link my method and that. Any suggestions ? Thanks for your time. Quote
Animefan8888 Posted November 12, 2018 Posted November 12, 2018 1 hour ago, Sunser said: but I did not find a way to make it being called every tick. I've been thinking about the onUpdate() method but I haven't found how to link my method and that. Any suggestions ? Thanks for your time. Use the PlayerTickEvent. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
Sunser Posted November 12, 2018 Author Posted November 12, 2018 That was exactly what I was looking for. I should be fine. Thanks you ! Quote
Guest Posted November 13, 2018 Posted November 13, 2018 To have very aesthetic method, you can beside of cancelling it on server, handle it on client side by overriding MovementInput class. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.