Skip to content

Commit

Permalink
Update Step.java
Browse files Browse the repository at this point in the history
Fixed issue where Step would not actually work.
Added a onUpdate callback to apply changes.
  • Loading branch information
coltonk9043 committed Apr 27, 2024
1 parent 0481536 commit a67b7b9
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/main/java/net/aoba/module/modules/movement/Step.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@
package net.aoba.module.modules.movement;

import org.lwjgl.glfw.GLFW;

import net.aoba.Aoba;
import net.aoba.gui.font.FontManager;
import net.aoba.module.Module;
import net.aoba.settings.types.FloatSetting;
import net.aoba.settings.types.KeybindSetting;
import net.minecraft.client.util.InputUtil;
import net.minecraft.entity.attribute.EntityAttributeInstance;
import net.minecraft.entity.attribute.EntityAttributes;

public class Step extends Module {

Expand All @@ -40,22 +45,31 @@ public Step() {

stepHeight = new FloatSetting("step_height", "Height", "Height that the player will step up.", 1f, 0.0f, 2f, 0.5f);

stepHeight.setOnUpdate((i) -> {
if(this.getState()) {
EntityAttributeInstance attribute = MC.player.getAttributeInstance(EntityAttributes.GENERIC_STEP_HEIGHT);
attribute.setBaseValue(stepHeight.getValue());
}
});

this.addSetting(stepHeight);
}

@Override
public void onDisable() {

EntityAttributeInstance attribute = MC.player.getAttributeInstance(EntityAttributes.GENERIC_STEP_HEIGHT);
attribute.setBaseValue(0.5f);
}

@Override
public void onEnable() {

EntityAttributeInstance attribute = MC.player.getAttributeInstance(EntityAttributes.GENERIC_STEP_HEIGHT);
attribute.setBaseValue(stepHeight.getValue());
}

@Override
public void onToggle() {

}

public float getStepHeight() {
Expand Down

0 comments on commit a67b7b9

Please sign in to comment.