@@ -10,6 +10,8 @@ import com.lambda.mixin.world.MixinBlockSoulSand
10
10
import com.lambda.mixin.world.MixinBlockWeb
11
11
import net.minecraft.init.Blocks
12
12
import net.minecraft.item.*
13
+ import net.minecraft.network.play.client.CPacketClickWindow
14
+ import net.minecraft.network.play.client.CPacketEntityAction
13
15
import net.minecraft.network.play.client.CPacketPlayer
14
16
import net.minecraft.network.play.client.CPacketPlayerDigging
15
17
import net.minecraft.network.play.client.CPacketPlayerDigging.Action
@@ -28,6 +30,7 @@ object NoSlowDown : Module(
28
30
) {
29
31
private val ncpStrict by setting(" NCP Strict" , true )
30
32
private val sneak by setting(" Sneak" , false )
33
+ private val itemMovement by setting(" Item Movement" , false )
31
34
val soulSand by setting(" Soul Sand" , true )
32
35
val cobweb by setting(" Cobweb" , true )
33
36
private val slime by setting(" Slime" , true )
@@ -37,6 +40,7 @@ object NoSlowDown : Module(
37
40
private val potion by setting(" Potions" , true , { ! allItems })
38
41
private val shield by setting(" Shield" , true , { ! allItems })
39
42
43
+ private var savedClickWindow = CPacketClickWindow ()
40
44
/*
41
45
* InputUpdateEvent is called just before the player is slowed down @see EntityPlayerSP.onLivingUpdate)
42
46
* 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(
51
55
}
52
56
}
53
57
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
+
54
81
/* *
55
82
* @author ionar2
56
83
* Used with explicit permission and MIT license permission
0 commit comments