Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
Implement SafeWalk
Browse files Browse the repository at this point in the history
Closes #44
  • Loading branch information
zeroeightysix committed Oct 11, 2018
1 parent 4249cbc commit e736bc4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}

}
Original file line number Diff line number Diff line change
@@ -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();
}

}

0 comments on commit e736bc4

Please sign in to comment.