Skip to content

Commit

Permalink
Added AirJump module. (CCBlueX#626)
Browse files Browse the repository at this point in the history
* Added AirJump module.

* Made NoJumpDelay conform to AirJump module jumping cool down values.
  • Loading branch information
mems01 authored Aug 12, 2021
1 parent 8a06ae6 commit bd72fd4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import net.ccbluex.liquidbounce.event.EventManager;
import net.ccbluex.liquidbounce.event.PlayerJumpEvent;
import net.ccbluex.liquidbounce.features.module.modules.movement.ModuleAirJump;
import net.ccbluex.liquidbounce.features.module.modules.movement.ModuleAntiLevitation;
import net.ccbluex.liquidbounce.features.module.modules.movement.ModuleNoJumpDelay;
import net.ccbluex.liquidbounce.features.module.modules.movement.ModuleNoPush;
Expand Down Expand Up @@ -60,6 +61,10 @@ public abstract class MixinLivingEntity extends MixinEntity {
@Shadow
private int jumpingCooldown;

@Shadow protected abstract void jump();

@Shadow protected boolean jumping;

/**
* Hook anti levitation module
*/
Expand Down Expand Up @@ -107,7 +112,15 @@ private void hookNoPush(CallbackInfo callbackInfo) {
@Inject(method = "tickMovement", at = @At("HEAD"), cancellable = true)
private void hookTickMovement(CallbackInfo callbackInfo) {
if (ModuleNoJumpDelay.INSTANCE.getEnabled()) {
jumpingCooldown = 0;
jumpingCooldown = ModuleAirJump.INSTANCE.getEnabled() ? 10 : 0;
}
}

@Inject(method = "tickMovement", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/LivingEntity;jumping:Z"))
private void hookJump(CallbackInfo callbackInfo) {
if (ModuleAirJump.INSTANCE.getEnabled() && jumping && jumpingCooldown == 0) {
this.jump();
jumpingCooldown = 10;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ object ModuleManager : Listenable, Iterable<Module> by modules {
ModuleNoSignRender,
ModuleAutoFish,
ModuleMobOwners,
ModuleGhostHand
ModuleGhostHand,
ModuleAirJump
)

builtin.apply {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package net.ccbluex.liquidbounce.features.module.modules.movement

import net.ccbluex.liquidbounce.features.module.Category
import net.ccbluex.liquidbounce.features.module.Module

object ModuleAirJump : Module("AirJump", Category.MOVEMENT)

0 comments on commit bd72fd4

Please sign in to comment.