Posted November 2, 20186 yr Hi, I've tried several methods to get the player to sneak, including: mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_SNEAKING)); and mc.player.setSneaking(true); mc.player.onUpdate(); Neither seem to work. Am I missing something? It's not registering the sneaking on either the client or the server side.
November 2, 20186 yr Author I'm trying to make the player sneak when the client detects an AFK message in chat as an anti-afk mechanism. When the message is detected, the sneaking doesn't work so the player isn't taken out of AFK mode
November 3, 20186 yr 4 minutes ago, AntiRix said: It's literally what I put in the original post. Neither works. You haven't provided any context as to what you have. All we know is that is what you are calling. When are you calling it, where are you calling it, how often are you calling it? On the other hand what you posted isn't what diesieben said to do. 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.
November 3, 20186 yr Author "when the client detects an AFK message in chat" ClientChatReceivedEvent If the message equals something, do either of the two code blocks, neither of which works. I know the code is running, because otherwise I'd fix that before posting here. "On the other hand what you posted isn't what diesieben said to do." That is my updated code. I can't go any further. Edited November 3, 20186 yr by AntiRix
November 3, 20186 yr Author It's still not working for me. onInputUpdate is being fired and sneak = true, but the sneaking isn't working. @SubscribeEvent public void onChatMessageReceived(ClientChatReceivedEvent event) { String message = event.getMessage().getFormattedText().replaceAll("\u00a7.", ""); if (message.equals("You are AFK. Move around to return from AFK.")) { event.setCanceled(true); if (anti_afk) { sneak = true; } else { mc.player.sendMessage(new TextComponentString("")); mc.player.sendMessage(new TextComponentString("\u00a7c[HypixelAFK] You're AFK!")); mc.player.sendMessage(new TextComponentString("")); } return; } } @SubscribeEvent public void onInputUpdate(InputUpdateEvent event) { if (!sneak) return; event.getMovementInput().sneak = true; sneak = false; } Edited November 3, 20186 yr by AntiRix
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.