Stop sprinting for criticals

This commit is contained in:
Charlotte Som 2022-02-04 13:47:50 +00:00
parent 0632528416
commit 3736a86842

View file

@ -6,6 +6,7 @@ import codes.som.hibiscus.events.SendPacketEvent
import codes.som.hibiscus.mixins.MixinExtPlayerInteractEntityC2SPacket
import codes.som.hibiscus.player
import codes.som.hibiscus.util.ext.requireExtension
import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket
@ -19,6 +20,14 @@ class Criticals : Feature("Criticals", FeatureCategory.COMBAT) {
if (packet.typeHandler.type != PlayerInteractEntityC2SPacket.InteractType.ATTACK)
return@on
player.isSprinting = false
player.networkHandler.sendPacket(
ClientCommandC2SPacket(
player,
ClientCommandC2SPacket.Mode.STOP_SPRINTING
)
)
player.networkHandler.sendPacket(
PlayerMoveC2SPacket.PositionAndOnGround(
player.x,