Search in sources :

Example 1 with Waypoint

use of dev.hypnotic.waypoint.Waypoint in project Hypnotic-Client by Hypnotic-Development.

the class SaveLoad method save.

public void save() {
    ArrayList<String> toSave = new ArrayList<String>();
    if (ModuleManager.INSTANCE == null || HudManager.INSTANCE == null)
        return;
    for (Mod mod : ModuleManager.INSTANCE.modules) {
        toSave.add("MOD:" + mod.getName() + ":" + mod.isEnabled() + ":" + mod.getKey());
    }
    for (HudModule element : HudManager.INSTANCE.hudModules) {
        toSave.add("HUD:" + element.getName() + ":" + element.getX() + ":" + element.getY());
    }
    for (Friend friend : FriendManager.INSTANCE.friends) {
        toSave.add("FRIEND:" + friend.name);
    }
    for (Frame frame : ClickGUI.INSTANCE.frames) {
        toSave.add("FRAME:" + frame.name + ":" + frame.getX() + ":" + frame.getY() + ":" + frame.isExtended());
    }
    toSave.add("FRAME:" + HudEditorScreen.INSTANCE.frame.name + ":" + HudEditorScreen.INSTANCE.frame.getX() + ":" + HudEditorScreen.INSTANCE.frame.getY() + ":" + HudEditorScreen.INSTANCE.frame.isExtended());
    toSave.add("CLICKGUI:X:" + dev.hypnotic.ui.clickgui.ClickGUI.INSTANCE.x + ":Y:" + dev.hypnotic.ui.clickgui.ClickGUI.INSTANCE.y);
    for (Waypoint waypoint : WaypointManager.INSTANCE.waypoints) {
        toSave.add("WAYPOINT:NAME:" + waypoint.getName() + ":X:" + waypoint.getX() + ":Y:" + waypoint.getY() + ":Z:" + waypoint.getZ());
    }
    try {
        PrintWriter pw = new PrintWriter(this.dataFile);
        for (String str : toSave) {
            pw.println(str);
        }
        pw.close();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
}
Also used : Frame(dev.hypnotic.ui.clickgui2.frame.Frame) Mod(dev.hypnotic.module.Mod) Friend(dev.hypnotic.config.friends.Friend) ArrayList(java.util.ArrayList) FileNotFoundException(java.io.FileNotFoundException) Waypoint(dev.hypnotic.waypoint.Waypoint) HudModule(dev.hypnotic.module.hud.HudModule) PrintWriter(java.io.PrintWriter)

Example 2 with Waypoint

use of dev.hypnotic.waypoint.Waypoint in project Hypnotic-Client by Hypnotic-Development.

the class WaypointManagerScreen method init.

@Override
protected void init() {
    menuBar = MenuBar.INSTANCE;
    this.addButton(addButton);
    int offset = 0;
    frame.buttons.clear();
    for (Waypoint waypoint : WaypointManager.INSTANCE.waypoints) {
        frame.buttons.add(new dev.hypnotic.ui.clickgui2.frame.button.Button(waypoint, 20, 20, offset, frame));
        offset += 20;
    }
    super.init();
}
Also used : Waypoint(dev.hypnotic.waypoint.Waypoint) Waypoint(dev.hypnotic.waypoint.Waypoint)

Example 3 with Waypoint

use of dev.hypnotic.waypoint.Waypoint in project Hypnotic-Client by Hypnotic-Development.

the class WaypointScreen method render.

@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
    this.renderBackground(matrices);
    RenderUtils.drawRoundedRect(matrices, width / 2 - 190, height / 2 - 150, width / 2 + 190, height / 2 + 150, 10, new Color(50, 50, 50));
    xBox.render(matrices, mouseX, mouseY, delta);
    if (xBox.getText().isEmpty())
        font.drawWithShadow(matrices, "X", width / 2, height / 2 - 20, Color.gray.getRGB());
    yBox.render(matrices, mouseX, mouseY, delta);
    if (yBox.getText().isEmpty())
        font.drawWithShadow(matrices, "Y", width / 2, height / 2, Color.gray.getRGB());
    zBox.render(matrices, mouseX, mouseY, delta);
    if (zBox.getText().isEmpty())
        font.drawWithShadow(matrices, "Z", width / 2, height / 2 + 20, Color.gray.getRGB());
    nameBox.render(matrices, mouseX, mouseY, delta);
    if (nameBox.getText().isEmpty())
        font.drawWithShadow(matrices, "Name", width / 2 - 180, height / 2 - 140, Color.gray.getRGB());
    colorPicker.render(matrices, mouseX, mouseY);
    doneButton.render(matrices, mouseX, mouseY, delta);
    for (Waypoint wp : WaypointManager.INSTANCE.waypoints) {
    }
    super.render(matrices, mouseX, mouseY, delta);
}
Also used : Color(java.awt.Color) Waypoint(dev.hypnotic.waypoint.Waypoint)

Example 4 with Waypoint

use of dev.hypnotic.waypoint.Waypoint in project Hypnotic-Client by Hypnotic-Development.

the class Waypoints method render.

@EventTarget
public void render(EventRender3D event) {
    MatrixStack matrices = event.getMatrices();
    for (Waypoint waypoint : WaypointManager.INSTANCE.waypoints) {
        if (waypoint.isEnabled()) {
            Camera c = mc.gameRenderer.getCamera();
            Vec3d vv = new Vec3d(waypoint.getX() + .5, c.getPos().y, waypoint.getZ() + .5);
            double distance = vv.distanceTo(mc.player.getPos());
            int a = 255;
            float scale = 3f;
            scale /= 50f;
            scale *= 0.55f;
            if (distance < 100) {
                a = (int) ((distance / 100) * 255);
            } else
                scale *= distance / 100d;
            RenderUtils.drawBoxOutline(new Box(new BlockPos(waypoint.getX(), 0, waypoint.getZ())).stretch(0, 500, 0), QuadColor.single(ColorUtils.defaultClientColor), 1);
            RenderUtils.drawBoxFill(new Box(new BlockPos(waypoint.getX(), 0, waypoint.getZ())).stretch(0, 500, 0), QuadColor.single(new Color(ColorUtils.defaultClientColor().getRed(), ColorUtils.defaultClientColor().getGreen(), ColorUtils.defaultClientColor().getBlue(), a).getRGB()));
            Vec3d textPos = new Vec3d(waypoint.getX() + 0.5, c.getPos().y, waypoint.getZ() + 0.25);
            matrices.push();
            matrices.translate(textPos.x - c.getPos().x - 1, textPos.y - c.getPos().y + 2, textPos.z - c.getPos().z - 0.5);
            matrices.translate(0, scale * 6, 0);
            matrices.scale(-scale, -scale, scale);
            Quaternion qu = mc.getEntityRenderDispatcher().getRotation();
            qu = new Quaternion(-qu.getX(), -qu.getY(), qu.getZ(), qu.getW());
            matrices.multiply(qu);
            VertexConsumerProvider.Immediate immediate = VertexConsumerProvider.immediate(Tessellator.getInstance().getBuffer());
            RenderSystem.disableDepthTest();
            RenderSystem.polygonOffset(1, -15000000);
            RenderSystem.enablePolygonOffset();
            FontManager.robotoBig.drawCenteredString(matrices, waypoint.getName() + " " + Math.round(PlayerUtils.distanceTo(new BlockPos(waypoint.getX(), mc.player.getY(), waypoint.getZ()))) + "m", 0, 0, -1, true);
            RenderSystem.polygonOffset(1, 15000000);
            RenderSystem.disablePolygonOffset();
            RenderSystem.enableDepthTest();
            immediate.draw();
            matrices.pop();
        }
    }
}
Also used : Quaternion(net.minecraft.util.math.Quaternion) MatrixStack(net.minecraft.client.util.math.MatrixStack) Color(java.awt.Color) QuadColor(dev.hypnotic.utils.render.QuadColor) Box(net.minecraft.util.math.Box) Vec3d(net.minecraft.util.math.Vec3d) Waypoint(dev.hypnotic.waypoint.Waypoint) Waypoint(dev.hypnotic.waypoint.Waypoint) BlockPos(net.minecraft.util.math.BlockPos) Camera(net.minecraft.client.render.Camera) VertexConsumerProvider(net.minecraft.client.render.VertexConsumerProvider) EventTarget(dev.hypnotic.event.EventTarget)

Example 5 with Waypoint

use of dev.hypnotic.waypoint.Waypoint in project Hypnotic-Client by Hypnotic-Development.

the class SaveLoad method load.

public void load() {
    ArrayList<String> lines = new ArrayList<String>();
    try {
        BufferedReader reader = new BufferedReader(new FileReader(this.dataFile));
        String line = reader.readLine();
        while (line != null) {
            lines.add(line);
            line = reader.readLine();
        }
        reader.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
    for (String s : lines) {
        String[] args = s.split(":");
        if (s.toLowerCase().startsWith("mod:")) {
            Mod m = ModuleManager.INSTANCE.getModuleByName(args[1]);
            if (m != null) {
                m.setKey(Integer.parseInt(args[3]));
            }
        } else if (s.toLowerCase().startsWith("friend:")) {
            FriendManager.INSTANCE.add(new Friend(args[1]));
        } else if (s.toLowerCase().startsWith("frame:")) {
            for (Frame frame : ClickGUI.INSTANCE.frames) {
                if (frame.name.equalsIgnoreCase(args[1])) {
                    frame.setX(Integer.parseInt(args[2]));
                    frame.setY(Integer.parseInt(args[3]));
                    frame.setExtended(Boolean.parseBoolean(args[4]));
                }
            }
            HudEditorScreen.INSTANCE.frame.setX(Integer.parseInt(args[2]));
            HudEditorScreen.INSTANCE.frame.setY(Integer.parseInt(args[3]));
            HudEditorScreen.INSTANCE.frame.setExtended(Boolean.parseBoolean(args[4]));
        } else if (s.toLowerCase().startsWith("waypoint:")) {
            for (Waypoint waypoint : WaypointManager.INSTANCE.waypoints) {
                if (waypoint.getName().equalsIgnoreCase(args[1])) {
                    int x = Integer.parseInt(args[2]);
                    int y = Integer.parseInt(args[3]);
                    int z = Integer.parseInt(args[4]);
                    waypoint.setX(x);
                    waypoint.setY(y);
                    waypoint.setZ(z);
                    waypoint.setPos(new BlockPos(x, y, z));
                }
            }
        } else if (s.toLowerCase().startsWith("clickgui:")) {
            dev.hypnotic.ui.clickgui.ClickGUI.INSTANCE.x = Integer.parseInt(args[2]);
            dev.hypnotic.ui.clickgui.ClickGUI.INSTANCE.y = Integer.parseInt(args[4]);
        } else if (s.toLowerCase().startsWith("settingpos:")) {
            for (ModuleButton mb : dev.hypnotic.ui.clickgui.ClickGUI.INSTANCE.buttons) {
                if (mb.mod.name.equalsIgnoreCase(args[1])) {
                    mb.settingsWindow.x = Integer.parseInt(args[3]);
                    mb.settingsWindow.y = Integer.parseInt(args[5]);
                }
            }
        }
    /*else if (s.toLowerCase().startsWith("message:")) {
            	ModuleManager.INSTANCE.chatSpammer.custom.add(args[1]);
            }*/
    }
}
Also used : Frame(dev.hypnotic.ui.clickgui2.frame.Frame) Mod(dev.hypnotic.module.Mod) ArrayList(java.util.ArrayList) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) Friend(dev.hypnotic.config.friends.Friend) ModuleButton(dev.hypnotic.ui.clickgui.ModuleButton) BufferedReader(java.io.BufferedReader) FileReader(java.io.FileReader) Waypoint(dev.hypnotic.waypoint.Waypoint) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

Waypoint (dev.hypnotic.waypoint.Waypoint)8 Friend (dev.hypnotic.config.friends.Friend)2 Mod (dev.hypnotic.module.Mod)2 Frame (dev.hypnotic.ui.clickgui2.frame.Frame)2 Color (java.awt.Color)2 FileNotFoundException (java.io.FileNotFoundException)2 ArrayList (java.util.ArrayList)2 BlockPos (net.minecraft.util.math.BlockPos)2 EventTarget (dev.hypnotic.event.EventTarget)1 HudModule (dev.hypnotic.module.hud.HudModule)1 BindingScreen (dev.hypnotic.ui.BindingScreen)1 WaypointScreen (dev.hypnotic.ui.WaypointScreen)1 ModuleButton (dev.hypnotic.ui.clickgui.ModuleButton)1 Component (dev.hypnotic.ui.clickgui2.frame.button.settings.Component)1 QuadColor (dev.hypnotic.utils.render.QuadColor)1 BufferedReader (java.io.BufferedReader)1 FileReader (java.io.FileReader)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 Camera (net.minecraft.client.render.Camera)1