diff --git a/src/main/java/me/zeroeightsix/kami/mixin/client/MixinEntity.java b/src/main/java/me/zeroeightsix/kami/mixin/client/MixinEntity.java index 4b167ad22..be2705783 100644 --- a/src/main/java/me/zeroeightsix/kami/mixin/client/MixinEntity.java +++ b/src/main/java/me/zeroeightsix/kami/mixin/client/MixinEntity.java @@ -2,6 +2,7 @@ import me.zeroeightsix.kami.KamiMod; import me.zeroeightsix.kami.event.events.EntityEvent; +import me.zeroeightsix.kami.module.modules.movement.SafeWalk; import net.minecraft.entity.Entity; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -26,4 +27,9 @@ public void addVelocity(Entity entity, double x, double y, double z) { entity.isAirBorne = true; } + @Redirect(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;isSneaking()Z")) + public boolean isSneaking(Entity entity) { + return SafeWalk.shouldSafewalk() || entity.isSneaking(); + } + } diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/movement/SafeWalk.java b/src/main/java/me/zeroeightsix/kami/module/modules/movement/SafeWalk.java new file mode 100644 index 000000000..ec984e66a --- /dev/null +++ b/src/main/java/me/zeroeightsix/kami/module/modules/movement/SafeWalk.java @@ -0,0 +1,21 @@ +package me.zeroeightsix.kami.module.modules.movement; + +import me.zeroeightsix.kami.module.Module; + +/** + * Created by 086 on 11/10/2018. + */ +@Module.Info(name = "SafeWalk", category = Module.Category.MOVEMENT, description = "Keeps you from walking off edges") +public class SafeWalk extends Module { + + private static SafeWalk INSTANCE; + + public SafeWalk() { + INSTANCE = this; + } + + public static boolean shouldSafewalk() { + return INSTANCE.isEnabled(); + } + +}