Search in sources :

Example 6 with HudModule

use of dev.hypnotic.module.hud.HudModule in project Hypnotic-Client by Hypnotic-Development.

the class ClientPlayerEntityMixin method tick.

@Inject(method = "tick", at = @At("HEAD"), cancellable = true)
public void tick(CallbackInfo ci) {
    for (Mod mod : ModuleManager.INSTANCE.modules) {
        if (mc.player != null) {
            if (mod.isBinding() && mc.currentScreen == null) {
                try {
                    mc.setScreen(new BindingScreen(mod, null));
                } catch (Exception e) {
                }
            }
            if (mod.isEnabled())
                mod.onTick();
            mod.onTickDisabled();
        }
    }
    for (HudModule mod : HudManager.INSTANCE.hudModules) {
        if (mc.player != null) {
            if (mod.isEnabled())
                mod.onTick();
            mod.onTickDisabled();
        }
    }
    RenderUtils.INSTANCE.onTick();
    if (mc.world != null)
        BaritoneAPI.getSettings().chatControl.value = false;
    OptionsScreen options = OptionsScreen.INSTANCE;
    BaritoneAPI.getSettings().allowBreak.value = options.allowBreak.isEnabled();
    BaritoneAPI.getSettings().allowParkour.value = options.allowParkour.isEnabled();
    BaritoneAPI.getSettings().allowParkourAscend.value = options.allowParkour.isEnabled();
    BaritoneAPI.getSettings().allowParkourPlace.value = options.allowParkour.isEnabled();
    BaritoneAPI.getSettings().allowDownward.value = options.allowParkour.isEnabled();
    BaritoneAPI.getSettings().allowDiagonalAscend.value = options.allowParkour.isEnabled();
    BaritoneAPI.getSettings().allowDiagonalDescend.value = options.allowParkour.isEnabled();
    BaritoneAPI.getSettings().chatControl.value = options.chatControl.isEnabled();
    BaritoneAPI.getSettings().allowPlace.value = options.allowPlace.isEnabled();
    BaritoneAPI.getSettings().allowInventory.value = options.allowInventory.isEnabled();
    BaritoneAPI.getSettings().assumeWalkOnWater.value = options.assumeJesus.isEnabled();
    BaritoneAPI.getSettings().assumeWalkOnLava.value = options.assumeJesus.isEnabled();
    BaritoneAPI.getSettings().assumeStep.value = options.assumeStep.isEnabled();
    BaritoneAPI.getSettings().assumeSafeWalk.value = options.assumeSafewalk.isEnabled();
}
Also used : Mod(dev.hypnotic.module.Mod) OptionsScreen(dev.hypnotic.ui.OptionsScreen) BindingScreen(dev.hypnotic.ui.BindingScreen) HudModule(dev.hypnotic.module.hud.HudModule) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 7 with HudModule

use of dev.hypnotic.module.hud.HudModule in project Hypnotic-Client by Hypnotic-Development.

the class HUD method renderHUD.

@EventTarget
public void renderHUD(EventRenderGUI event) {
    if (mc.options.debugEnabled)
        return;
    if (TPSUtils.INSTANCE.getTimeSinceLastTick() >= 1) {
        String numColor = ColorUtils.green;
        if (TPSUtils.INSTANCE.getTimeSinceLastTick() >= 5 && TPSUtils.INSTANCE.getTimeSinceLastTick() < 10)
            numColor = ColorUtils.yellow;
        else if (TPSUtils.INSTANCE.getTimeSinceLastTick() >= 10)
            numColor = ColorUtils.red;
        fr.drawCenteredString(event.getMatrices(), "Server lagging for " + numColor + MathUtils.round(TPSUtils.INSTANCE.getTimeSinceLastTick(), 1) + " seconds", mc.getWindow().getScaledWidth() / 2, 50, -1, true);
    }
    for (HudModule element : HudManager.INSTANCE.hudModules) {
        if (element.isEnabled() && !(mc.currentScreen instanceof HudEditorScreen))
            element.render(event.getMatrices(), mc.getWindow().getScaledWidth(), mc.getWindow().getScaledHeight(), event.getTickDelta());
    }
}
Also used : HudModule(dev.hypnotic.module.hud.HudModule) EventTarget(dev.hypnotic.event.EventTarget)

Example 8 with HudModule

use of dev.hypnotic.module.hud.HudModule in project Hypnotic-Client by Hypnotic-Development.

the class HudEditorScreen method mouseClicked.

@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
    frame.mouseClicked(mouseX, mouseY, button);
    for (HudModule element : HudManager.INSTANCE.hudModules) {
        if (element.hovered((int) mouseX, (int) mouseY)) {
            if (button == 0) {
                element.setDragging(true);
                element.setDragX((int) (mouseX - element.getX()));
                element.setDragY((int) (mouseY - element.getY()));
            } else if (button == 2) {
                element.toggle();
            }
        }
        if (element.hovered((int) mouseX, (int) mouseY, element.getX() + element.getWidth(), element.getY() + element.getHeight(), element.getX() + element.getWidth() + 20, element.getY() + element.getHeight() + 20) && button == 0) {
        // broken
        // element.setScaling(true, (int)mouseX, (int)mouseY);
        }
    }
    menuBar.mouseClicked((int) mouseX, (int) mouseY, button);
    return super.mouseClicked(mouseX, mouseY, button);
}
Also used : HudModule(dev.hypnotic.module.hud.HudModule)

Example 9 with HudModule

use of dev.hypnotic.module.hud.HudModule in project Hypnotic-Client by Hypnotic-Development.

the class HudEditorScreen method render.

@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
    this.renderBackground(matrices);
    frame.render(matrices, mouseX, mouseY);
    frame.setWidth(120);
    frame.updatePosition(mouseX, mouseY);
    frame.updateButtons();
    for (HudModule element : HudManager.INSTANCE.hudModules) {
        element.render(matrices, mc.getWindow().getScaledWidth(), mc.getWindow().getScaledHeight(), delta);
        element.updatePosition(mouseX, mouseY);
    }
    menuBar.renderMenuBar(matrices, mouseX, mouseY, this.width, this.height);
    super.render(matrices, mouseX, mouseY, delta);
}
Also used : HudModule(dev.hypnotic.module.hud.HudModule)

Aggregations

HudModule (dev.hypnotic.module.hud.HudModule)9 Mod (dev.hypnotic.module.Mod)4 Gson (com.google.gson.Gson)2 GsonBuilder (com.google.gson.GsonBuilder)2 Setting (dev.hypnotic.settings.Setting)2 BooleanSetting (dev.hypnotic.settings.settingtypes.BooleanSetting)2 ColorSetting (dev.hypnotic.settings.settingtypes.ColorSetting)2 KeybindSetting (dev.hypnotic.settings.settingtypes.KeybindSetting)2 ModeSetting (dev.hypnotic.settings.settingtypes.ModeSetting)2 NumberSetting (dev.hypnotic.settings.settingtypes.NumberSetting)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Friend (dev.hypnotic.config.friends.Friend)1 EventTarget (dev.hypnotic.event.EventTarget)1 BindingScreen (dev.hypnotic.ui.BindingScreen)1 OptionsScreen (dev.hypnotic.ui.OptionsScreen)1 Frame (dev.hypnotic.ui.clickgui2.frame.Frame)1 Waypoint (dev.hypnotic.waypoint.Waypoint)1 FileNotFoundException (java.io.FileNotFoundException)1 PrintWriter (java.io.PrintWriter)1