Implement SafeWalk

Closes #44
This commit is contained in:
zeroeightsix 2018-10-11 22:29:39 +02:00
parent 4249cbc95f
commit e736bc4442
2 changed files with 27 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package me.zeroeightsix.kami.mixin.client;
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 class MixinEntity {
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();
}
}

View File

@ -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();
}
}