package me.deftware.mixin.mixins;

import me.deftware.client.framework.event.events.EventSlowdown;
import net.minecraft.util.MovementInputFromOptions;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import static org.spongepowered.asm.lib.Opcodes.GETFIELD;

@Mixin(MovementInputFromOptions.class)
public class MixinMovementInputFromOptions {

	@Redirect(method = "updatePlayerMoveState", at = @At(value = "FIELD", target = "Lnet/minecraft/util/MovementInputFromOptions;sneak:Z", opcode = GETFIELD))
	private boolean isSneaking(MovementInputFromOptions self) {
		return new EventSlowdown(EventSlowdown.SlowdownType.Sneak).send().isCanceled();
	}

}

@@ -39,117 +39,60 @@
 ort 
-me.deftware.client.framework.event.events.EventSlowdown;%0Aimport net.minecraft.util.MovementInputFromOptions
+static org.spongepowered.asm.lib.Opcodes.GETFIELD
 ;%0A
+%0A
 impo
@@ -245,57 +245,154 @@
 ort 
-static org.spongepowered.asm.lib.Opcodes.GETFIELD
+me.deftware.client.framework.event.events.EventSlowdown;%0Aimport net.minecraft.client.Minecraft;%0Aimport net.minecraft.util.MovementInputFromOptions
 ;%0A%0A@
@@ -698,14 +698,29 @@
 %7B%0A%09%09
-return
+EventSlowdown event =
  new
@@ -778,19 +778,128 @@
 nd()
-.isCanceled
+;%0A%09%09if (event.isCanceled()) %7B%0A%09%09%09return false;%0A%09%09%7D%0A%09%09return Minecraft.getMinecraft().gameSettings.keyBindSneak.isKeyDown
 ();%0A

Fix EventSlowdown->SlowdownType.Sneak