@@ -10,6 +10,8 @@ import com.lambda.mixin.world.MixinBlockSoulSand
1010import com.lambda.mixin.world.MixinBlockWeb
1111import net.minecraft.init.Blocks
1212import net.minecraft.item.*
13+ import net.minecraft.network.play.client.CPacketClickWindow
14+ import net.minecraft.network.play.client.CPacketEntityAction
1315import net.minecraft.network.play.client.CPacketPlayer
1416import net.minecraft.network.play.client.CPacketPlayerDigging
1517import net.minecraft.network.play.client.CPacketPlayerDigging.Action
@@ -28,6 +30,7 @@ object NoSlowDown : Module(
2830) {
2931 private val ncpStrict by setting(" NCP Strict" , true )
3032 private val sneak by setting(" Sneak" , false )
33+ private val itemMovement by setting(" Item Movement" , false )
3134 val soulSand by setting(" Soul Sand" , true )
3235 val cobweb by setting(" Cobweb" , true )
3336 private val slime by setting(" Slime" , true )
@@ -37,6 +40,7 @@ object NoSlowDown : Module(
3740 private val potion by setting(" Potions" , true , { ! allItems })
3841 private val shield by setting(" Shield" , true , { ! allItems })
3942
43+ private var savedClickWindow = CPacketClickWindow ()
4044 /*
4145 * InputUpdateEvent is called just before the player is slowed down @see EntityPlayerSP.onLivingUpdate)
4246 * We'll abuse this fact, and multiply moveStrafe and moveForward by 5 to nullify the *0.2f hardcoded by Mojang.
@@ -51,6 +55,29 @@ object NoSlowDown : Module(
5155 }
5256 }
5357
58+ safeListener<PacketEvent .Send > {
59+ if (itemMovement
60+ && player.onGround
61+ && it.packet is CPacketClickWindow
62+ && it.packet != savedClickWindow
63+ ) {
64+ savedClickWindow = it.packet
65+
66+ it.cancel()
67+
68+ if (player.isSprinting) {
69+ player.connection.sendPacket(CPacketEntityAction (player, CPacketEntityAction .Action .STOP_SPRINTING ))
70+ }
71+
72+ player.connection.sendPacket(CPacketPlayer .Position (player.posX, player.posY + 0.0626 , player.posZ, false ))
73+ player.connection.sendPacket(it.packet)
74+
75+ if (player.isSprinting) {
76+ player.connection.sendPacket(CPacketEntityAction (player, CPacketEntityAction .Action .START_SPRINTING ))
77+ }
78+ }
79+ }
80+
5481 /* *
5582 * @author ionar2
5683 * Used with explicit permission and MIT license permission
0 commit comments