import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleManager;
import net.ccbluex.liquidbounce.features.module.modules.movement.Speed;
import net.ccbluex.liquidbounce.ui.client.clickgui.IRenderer;
import net.ccbluex.liquidbounce.ui.client.clickgui.style.Style;
import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.GreenStyle;
import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.RedStyle;
import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.RoundedStyle;
import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.WhiteStyle;
import net.ccbluex.liquidbounce.ui.client.clickgui.style.styles.YellowStyle;
import net.ccbluex.liquidbounce.ui.client.clickgui.util.Button;
import net.ccbluex.liquidbounce.ui.client.clickgui.util.Colors;
import net.ccbluex.liquidbounce.utils.MinecraftInstance;
import net.ccbluex.liquidbounce.value.FloatValue;
import net.ccbluex.liquidbounce.value.IntegerValue;
import net.minecraft.util.ResourceLocation;
import java.util.ArrayList;
import java.util.List;
public class LongJumpScript extends MinecraftInstance {
// Rest of the code...
}
public class LongJumpScript extends MinecraftInstance {
private final FloatValue jumpSpeedSetting;
private final FloatValue normalSpeedSetting;
private final FloatValue jumpHeightSetting;
private final IntegerValue jumpLengthSetting;
private final FloatValue timerSpeedSetting;
private final Button<LongJumpButtonRenderer> longJumpButton;
public LongJumpScript() {
ModuleManager moduleManager = LiquidBounce.moduleManager;
// Create settings for jump speed, normal speed, jump height, jump length, and timer speed
jumpSpeedSetting = new FloatValue("Jump Speed", 2.5f);
normalSpeedSetting = new FloatValue("Normal Speed", 0.1f);
jumpHeightSetting = new FloatValue("Jump Height", 0.42f);
jumpLengthSetting = new IntegerValue("Jump Length", 15, 1, 100);
timerSpeedSetting = new FloatValue("Timer Speed", 1.0f);
// Create a button for enabling/disabling long jump
longJumpButton = new Button<>("Long Jump", new ResourceLocation("liquidbounce:icons/on.png"), new ResourceLocation("liquidbounce:icons/off.png"));
longJumpButton.setRenderer(new LongJumpButtonRenderer());
longJumpButton.addClickListener(button -> {
Speed speedModule = (Speed) moduleManager.getModule(Speed.class);
if (button.getValue()) {
// Enable long jump
setJumpSpeed(jumpSpeedSetting.get());
setJumpHeight(jumpHeightSetting.get());
speedModule.setState(true);
setTimerSpeed(timerSpeedSetting.get());
setJumpLength(jumpLengthSetting.get());
} else {
// Disable long jump
setJumpSpeed(normalSpeedSetting.get());
setJumpHeight(0.42f);
speedModule.setState(false);
setTimerSpeed(1.0f);
setJumpLength(15);
}
});
// Add the button to the mod's click GUI
moduleManager.getModule(ModuleCategory.MISC).getButtons().add(longJumpButton);
}
// Method for setting jump speed
public void setJumpSpeed(float speed) {
Speed speedModule = (Speed) LiquidBounce.moduleManager.getModule(Speed.class);
speedModule.setSpeed(speed);
}
// Method for setting jump height
public void setJumpHeight(float height) {
mc.thePlayer.motionY = height;
}
// Method for setting jump length
public void setJumpLength(int length) {
mc.thePlayer.distanceWalkedModified = length;
}
// Method for setting timer speed
public void setTimerSpeed(float speed) {
mc.timer.timerSpeed = speed;
}
// Renderer for the long jump button
private static class LongJumpButtonRenderer implements IRenderer<Button<LongJumpButtonRenderer>> {
private final List<Style> styles = new ArrayList<>();
public LongJumpButtonRenderer() {
styles.add(new GreenStyle());
styles.add(new RedStyle());
styles.add(new RoundedStyle());
styles.add(new WhiteStyle());
styles.add(new YellowStyle());
}
@Override
public void render(Button<LongJumpButtonRenderer> button, int mouseX, int mouseY) {
Style style = styles.get(Colors.Palette.getColorIndex());
style.renderButton(button, mouseX, mouseY);
}
@Override
public void handleMouseClick(Button<LongJumpButtonRenderer> button, int mouseX, int mouseY, int mouseButton) {
Style style = styles.get(Colors.Palette.getColorIndex());
style.handleMouseClick(button, mouseX, mouseY, mouseButton);
}
@Override
public void handleMouseRelease(Button<LongJumpButtonRenderer> button, int mouseX, int mouseY, int mouseButton) {
Style style = styles.get(Colors.Palette.getColorIndex());
style.handleMouseRelease(button, mouseX, mouseY, mouseButton);
}
}
}