Search in sources :

Example 1 with NettyClient

use of cc.hyperium.netty.NettyClient in project Hyperium by HyperiumClient.

the class LocationHandler method serverJoinEvent.

@InvokeEvent
public void serverJoinEvent(ServerJoinEvent event) {
    NettyClient client = NettyClient.getClient();
    if (client != null) {
        location = event.getServer();
        client.write(UpdateLocationPacket.build("Other"));
    }
}
Also used : NettyClient(cc.hyperium.netty.NettyClient)

Example 2 with NettyClient

use of cc.hyperium.netty.NettyClient in project Hyperium by HyperiumClient.

the class ShopTab method addComponents.

private void addComponents() {
    CollapsibleTabComponent infoTab = new CollapsibleTabComponent(this, new ArrayList<>(), "Info");
    infoTab.setCollapsed(false);
    infoTab.addChild(new LabelComponent(this, new ArrayList<>(), "Total Credits: " + personData.optInt("total_credits")));
    infoTab.addChild(new LabelComponent(this, new ArrayList<>(), "Remaining Credits: " + personData.optInt("remaining_credits")));
    infoTab.addChild(new ButtonComponent(this, new ArrayList<>(), "Capes", () -> Hyperium.INSTANCE.getHandlers().getGuiDisplayHandler().setDisplayNextTick(new CapesGui())));
    infoTab.addChild(new ButtonComponent(this, new ArrayList<>(), "Particles", () -> new ParticleGui().show()));
    infoTab.addChild(new ButtonComponent(this, new ArrayList<>(), "Open in browser", () -> {
        Desktop desktop = Desktop.getDesktop();
        if (desktop != null) {
            try {
                desktop.browse(new URI("https://hyperium.sk1er.club"));
            } catch (IOException | URISyntaxException e) {
                e.printStackTrace();
            }
        }
    }));
    infoTab.addChild(new ButtonComponent(this, new ArrayList<>(), "Purchase credits", () -> {
        Desktop desktop = Desktop.getDesktop();
        if (desktop != null) {
            try {
                desktop.browse(new URI("https://purchase.sk1er.club/category/1125808"));
            } catch (IOException | URISyntaxException e) {
                e.printStackTrace();
            }
        }
    }));
    infoTab.addChild(new ButtonComponent(this, new ArrayList<>(), "Refresh", this::refreshData));
    CollapsibleTabComponent purchaseTab = new CollapsibleTabComponent(this, Arrays.asList("Purchase", "Shop"), "Purchase");
    cosmeticCallback.getKeys().forEach(key -> {
        JsonHolder cosmetic = cosmeticCallback.optJSONObject(key);
        if (cosmetic.optBoolean("cape") || key.toLowerCase().startsWith("particle") || cosmetic.optString("name").toLowerCase().endsWith("animation")) {
            return;
        }
        CollapsibleTabComponent purchase = new CollapsibleTabComponent(this, new ArrayList<>(), cosmetic.optString("name"));
        purchase.addChild(new LabelComponent(this, new ArrayList<>(), cosmetic.optString("name") + " (" + cosmetic.optInt("cost") + " credits)"));
        purchase.addChild(new LabelComponent(this, new ArrayList<>(), cosmetic.optString("description")));
        purchase.addChild(new ButtonComponent(this, new ArrayList<>(), cosmetic.optBoolean("purchased") ? "PURCHASED" : "PURCHASE", () -> {
            if (cosmetic.optBoolean("purchased")) {
                Hyperium.INSTANCE.getHandlers().getGeneralChatHandler().sendMessage("You have already purchased " + cosmetic.optString("name") + ".");
                return;
            }
            Hyperium.LOGGER.info("Attempting to purchase {}", key);
            NettyClient client = NettyClient.getClient();
            if (client != null) {
                client.write(ServerCrossDataPacket.build(new JsonHolder().put("internal", true).put("cosmetic_purchase", true).put("value", key)));
            }
        }));
        purchaseTab.addChild(purchase);
    });
    components.addAll(Arrays.asList(infoTab, purchaseTab));
}
Also used : JsonHolder(cc.hyperium.utils.JsonHolder) NettyClient(cc.hyperium.netty.NettyClient) CapesGui(cc.hyperium.gui.CapesGui) ArrayList(java.util.ArrayList) CollapsibleTabComponent(cc.hyperium.gui.hyperium.components.CollapsibleTabComponent) ParticleGui(cc.hyperium.gui.ParticleGui) URI(java.net.URI) ButtonComponent(cc.hyperium.gui.hyperium.components.ButtonComponent) LabelComponent(cc.hyperium.gui.hyperium.components.LabelComponent)

Example 3 with NettyClient

use of cc.hyperium.netty.NettyClient in project Hyperium by HyperiumClient.

the class CapesGui method drawScreen.

// 22x17
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    try {
        if (!texturesImage.isEmpty()) {
            texturesImage.forEach((s, value) -> {
                if (!textures.containsKey(s))
                    textures.put(s, new DynamicTexture(value));
            });
        }
        super.drawScreen(mouseX, mouseY, partialTicks);
        int oldScale = mc.gameSettings.guiScale;
        mc.gameSettings.guiScale = 2;
        ScaledResolution current = new ScaledResolution(Minecraft.getMinecraft());
        mc.gameSettings.guiScale = oldScale;
        float v = 2F / (oldScale);
        GlStateManager.scale(v, v, v);
        int blockWidth = 128;
        int blockHeight = 256;
        int blocksPerLine = (int) (current.getScaledWidth() / (1.5D * blockWidth));
        if (blocksPerLine % 2 == 1)
            blocksPerLine--;
        JsonHolder capeAtlas = PurchaseApi.getInstance().getCapeAtlas();
        int totalRows = (capeAtlas.getKeys().size() / blocksPerLine + (capeAtlas.getKeys().size() % blocksPerLine == 0 ? 0 : 1));
        int row = 0;
        int pos = 1;
        int printY = 15 - offset;
        GlStateManager.scale(2F, 2F, 2F);
        fontRendererObj.drawString("Capes", (current.getScaledWidth() / 2F - fontRendererObj.getStringWidth("Capes")) / 2, printY / 2F, new Color(249, 99, 0).getRGB(), true);
        String s1;
        try {
            s1 = PurchaseApi.getInstance().getSelf().getPurchaseSettings().optJSONObject("cape").optString("type");
        } catch (NullPointerException ignored) {
            return;
        }
        String s2 = capeAtlas.optJSONObject(s1).optString("name");
        if (s2.isEmpty())
            s2 = "NONE";
        String text = "Active Cape: " + s2;
        fontRendererObj.drawString(text, (current.getScaledWidth() / 2F - fontRendererObj.getStringWidth(text)) / 2, (printY + 20) / 2F, new Color(249, 99, 0).getRGB(), true);
        text = "Need more credits? Click here";
        int stringWidth1 = fontRendererObj.getStringWidth(text);
        int i2 = current.getScaledWidth() / 2 - stringWidth1;
        int i3 = printY + 40;
        fontRendererObj.drawString(text, i2 / 2F, i3 / 2F, new Color(97, 132, 249).getRGB(), true);
        GuiBlock block1 = new GuiBlock(i2, i2 + stringWidth1 * 2, i3, i3 + 15);
        GlStateManager.scale(.5F, .5F, .5F);
        actions.put(block1, () -> {
            Desktop desktop = Desktop.getDesktop();
            if (desktop != null) {
                try {
                    desktop.browse(new URL("https://purchase.sk1er.club/category/1125808").toURI());
                } catch (IOException | URISyntaxException e) {
                    e.printStackTrace();
                }
            }
        });
        printY += 25;
        printY += 35;
        int scaledWidth = current.getScaledWidth();
        RenderUtils.drawSmoothRect(scaledWidth / 2 - (blockWidth + 16) * blocksPerLine / 2, printY - 4, scaledWidth / 2 + (blockWidth + 16) * blocksPerLine / 2, printY + (blockHeight + 16) * totalRows + 4, new Color(53, 106, 110).getRGB());
        for (String s : capeAtlas.getKeys()) {
            JsonHolder cape = capeAtlas.optJSONObject(s);
            if (cape.optBoolean("private"))
                continue;
            if (pos > blocksPerLine) {
                pos = 1;
                row++;
            }
            int thisBlocksCenter = (int) (scaledWidth / 2 - ((blocksPerLine / 2) - pos + .5) * (blockWidth + 16));
            int thisTopY = printY + row * (16 + blockHeight);
            RenderUtils.drawSmoothRect(thisBlocksCenter - blockWidth / 2, thisTopY, (thisBlocksCenter + blockWidth / 2), thisTopY + blockHeight, -1);
            DynamicTexture dynamicTexture = textures.get(s);
            if (dynamicTexture != null) {
                int imgW = 120;
                int imgH = 128;
                GlStateManager.bindTexture(dynamicTexture.getGlTextureId());
                float capeScale = .75F;
                int topLeftX = (int) (thisBlocksCenter - imgW / (2F / capeScale));
                int topLeftY = thisTopY + 4;
                GlStateManager.translate(topLeftX, topLeftY, 0);
                GlStateManager.scale(capeScale, capeScale, capeScale);
                drawTexturedModalRect(0, 0, imgW / 12, 0, imgW, imgH * 2);
                GlStateManager.scale(1F / capeScale, 1F / capeScale, 1F / capeScale);
                GlStateManager.translate(-topLeftX, -topLeftY, 0);
            }
            String nameCape = cape.optString("name");
            GlStateManager.scale(2F, 2F, 2F);
            int x = thisBlocksCenter - fontRendererObj.getStringWidth(nameCape);
            fontRendererObj.drawString(nameCape, x / 2F, (thisTopY - 8 + blockHeight / 2F + 64 + 16) / 2, new Color(249, 99, 0).getRGB(), true);
            GlStateManager.scale(.5F, .5F, .5F);
            if (cosmeticCallback.getKeys().size() == 0 || purchasing) {
                String string = "Loading";
                fontRendererObj.drawString(string, thisBlocksCenter - fontRendererObj.getStringWidth(string), (thisTopY - 8 + (blockHeight >> 1) + 64 + 48), new Color(91, 102, 249).getRGB(), true);
                return;
            }
            JsonHolder jsonHolder = cosmeticCallback.optJSONObject(s);
            boolean purchased = jsonHolder.optBoolean("purchased");
            if (purchased) {
                String string = "Purchased";
                int widthThing3 = fontRendererObj.getStringWidth(string) / 2;
                int leftThing3 = thisBlocksCenter - widthThing3;
                int topThing3 = thisTopY - 8 + blockHeight / 2 + 64 + 36;
                fontRendererObj.drawString(string, leftThing3, topThing3, new Color(41, 249, 18).getRGB(), true);
                if (s.equalsIgnoreCase(s1)) {
                    string = "Active";
                    int stringWidth = fontRendererObj.getStringWidth(string);
                    int i = thisBlocksCenter - stringWidth;
                    int i1 = thisTopY - 8 + blockHeight / 2 + 64 + 48;
                    GlStateManager.scale(2F, 2F, 2F);
                    fontRendererObj.drawString(string, i / 2F, i1 / 2F, new Color(249, 55, 241).getRGB(), true);
                } else {
                    int stringWidth = fontRendererObj.getStringWidth(string);
                    int i = thisBlocksCenter - stringWidth;
                    int i1 = thisTopY - 8 + blockHeight / 2 + 64 + 48;
                    string = "Make Active";
                    GuiBlock block = new GuiBlock(i, i + stringWidth * 2, i1, i1 + 20);
                    actions.put(block, () -> {
                        JsonHolder purchaseSettings = PurchaseApi.getInstance().getSelf().getPurchaseSettings();
                        if (!purchaseSettings.has("cape")) {
                            purchaseSettings.put("cape", new JsonHolder());
                        }
                        purchaseSettings.optJSONObject("cape").put("type", s);
                        NettyClient client = NettyClient.getClient();
                        if (client != null) {
                            client.write(ServerCrossDataPacket.build(new JsonHolder().put("internal", true).put("set_cape", true).put("value", s)));
                        }
                        Hyperium.INSTANCE.getHandlers().getGeneralChatHandler().sendMessage("You may need to switch worlds to update your cape.");
                    });
                    GlStateManager.scale(2F, 2F, 2F);
                    fontRendererObj.drawString(string, i / 2F, i1 / 2F, new Color(249, 55, 241).getRGB(), true);
                }
                GlStateManager.scale(.5F, .5F, .5F);
            } else {
                if (jsonHolder.optBoolean("enough")) {
                    String string = "Click to purchase";
                    int stringWidth = fontRendererObj.getStringWidth(string);
                    int left = thisBlocksCenter - stringWidth / 2;
                    int i = thisTopY - 8 + blockHeight / 2 + 64 + 48;
                    fontRendererObj.drawString(string, left, i, new Color(249, 76, 238).getRGB(), true);
                    GuiBlock block = new GuiBlock(left, left + stringWidth, i, i + 10);
                    actions.put(block, () -> {
                        Hyperium.LOGGER.debug("Attempting to purchase " + s);
                        purchasing = true;
                        Integer integer = intMap.computeIfAbsent(s, s3 -> ++purchaseIds);
                        GuiYesNo gui = new GuiYesNo(this, "Purchase " + s, "", integer);
                        Hyperium.INSTANCE.getHandlers().getGuiDisplayHandler().setDisplayNextTick(gui);
                        ids.put(integer, () -> {
                            GeneralChatHandler.instance().sendMessage("Attempting to purchase " + s);
                            NettyClient client = NettyClient.getClient();
                            if (client != null) {
                                client.write(ServerCrossDataPacket.build(new JsonHolder().put("internal", true).put("cosmetic_purchase", true).put("value", s)));
                            }
                        });
                    });
                } else {
                    String string = "Insufficient Credits";
                    int stringWidth = fontRendererObj.getStringWidth(string);
                    int left = thisBlocksCenter - stringWidth / 2;
                    int i = thisTopY - 8 + blockHeight / 2 + 64 + 48;
                    fontRendererObj.drawString(string, left, i, new Color(249, 9, 0).getRGB(), true);
                }
            }
            pos++;
        }
        GlStateManager.scale(1F / v, 1F / v, 1F / v);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : JsonHolder(cc.hyperium.utils.JsonHolder) GuiYesNo(net.minecraft.client.gui.GuiYesNo) DynamicTexture(net.minecraft.client.renderer.texture.DynamicTexture) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) URL(java.net.URL) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) NettyClient(cc.hyperium.netty.NettyClient) ScaledResolution(net.minecraft.client.gui.ScaledResolution)

Example 4 with NettyClient

use of cc.hyperium.netty.NettyClient in project Hyperium by HyperiumClient.

the class ParticleGui method rebuild.

private void rebuild() {
    EnumParticleType[] values = EnumParticleType.values();
    int length = values.length;
    HyperiumPurchase self = PurchaseApi.getInstance().getSelf();
    if (self == null) {
        queueBuild = true;
        return;
    }
    JsonHolder purchaseSettings = self.getPurchaseSettings();
    if (!purchaseSettings.has("particle"))
        purchaseSettings.put("particle", new JsonHolder());
    JsonHolder particle = purchaseSettings.optJSONObject("particle");
    CarouselItem[] particles = new CarouselItem[length];
    for (int i = 0; i < length; i++) {
        EnumParticleType value = values[i];
        final boolean flag = self.hasPurchased("PARTICLE_" + value.name());
        particles[i] = new CarouselItem(value.getName(), flag, false, carouselItem -> {
            if (!flag) {
                if (credits < 300) {
                    GeneralChatHandler.instance().sendMessage(I18n.format("message.insufficientcredits"));
                    return;
                }
                int i4 = ++purchaseIds;
                GuiYesNo gui = new GuiYesNo(this, I18n.format("message.purchase", value.getName()), "", i4);
                Hyperium.INSTANCE.getHandlers().getGuiDisplayHandler().setDisplayNextTick(gui);
                ids.put(i4, () -> {
                    GeneralChatHandler.instance().sendMessage(I18n.format("message.attemptingpurchase", value.getName()));
                    NettyClient client = NettyClient.getClient();
                    if (client != null) {
                        client.write(ServerCrossDataPacket.build(new JsonHolder().put("internal", true).put("cosmetic_purchase", true).put("value", "PARTICLE_" + value.name())));
                    }
                });
            } else {
                GeneralChatHandler.instance().sendMessage(I18n.format("message.alreadypurchased", value.getName()));
            }
        }, carouselItem -> {
            if (!flag)
                return;
            overlay = new HyperiumOverlay("Particles");
            String s = particle.optBoolean("rgb") ? "RGB" : particle.optBoolean("chroma") ? "CHROMA" : "DEFAULT";
            overlay.getComponents().add(new OverlaySelector<>("Color Type", s, s1 -> {
                if (s1.equals("DEFAULT")) {
                    particle.put("chroma", false);
                    particle.put("rgb", false);
                } else if (s1.equals("CHROMA")) {
                    particle.put("chroma", true);
                    particle.put("rgb", false);
                } else if (s1.equalsIgnoreCase("RGB")) {
                    particle.put("rgb", true);
                    particle.put("chroma", false);
                }
                NettyClient client = NettyClient.getClient();
                if (client != null) {
                    client.write(ServerCrossDataPacket.build(new JsonHolder().put("internal", true).put("particle_update", true).put("color_type", s1)));
                }
            // Rebuild auto called on purchase update
            }, () -> new String[] { "DEFAULT", "RGB", "CHROMA" }));
            overlay.getComponents().add(new OverlaySlider(I18n.format("gui.cosmetics.red"), 0, 255, particle.optInt("red", 255), aFloat -> {
                particle.put("red", aFloat);
                EventBus.INSTANCE.post(new PurchaseLoadEvent(Objects.requireNonNull(UUIDUtil.getClientUUID()), self, true));
                NettyClient client = NettyClient.getClient();
                if (client != null) {
                    client.write(ServerCrossDataPacket.build(new JsonHolder().put("internal", true).put("particle_update", true).put("red", aFloat.intValue())));
                }
            }, true));
            overlay.getComponents().add(new OverlaySlider(I18n.format("gui.cosmetics.green"), 0, 255, particle.optInt("green", 255), aFloat -> {
                particle.put("green", aFloat);
                EventBus.INSTANCE.post(new PurchaseLoadEvent(Objects.requireNonNull(UUIDUtil.getClientUUID()), self, true));
                NettyClient client = NettyClient.getClient();
                if (client != null) {
                    client.write(ServerCrossDataPacket.build(new JsonHolder().put("internal", true).put("particle_update", true).put("green", aFloat.intValue())));
                }
            }, true));
            overlay.getComponents().add(new OverlaySlider(I18n.format("gui.cosmetics.blue"), 0, 255, particle.optInt("blue", 255), aFloat -> {
                particle.put("blue", aFloat);
                EventBus.INSTANCE.post(new PurchaseLoadEvent(Objects.requireNonNull(UUIDUtil.getClientUUID()), self, true));
                NettyClient client = NettyClient.getClient();
                if (client != null) {
                    client.write(ServerCrossDataPacket.build(new JsonHolder().put("internal", true).put("particle_update", true).put("blue", aFloat.intValue())));
                }
            }, true));
            overlay.getComponents().add(new OverlaySlider(I18n.format("gui.cosmetics.maxage"), 2, 100, particle.optInt("max_age", 10), aFloat -> {
                NettyClient client = NettyClient.getClient();
                if (client != null) {
                    client.write(ServerCrossDataPacket.build(new JsonHolder().put("internal", true).put("particle_update", true).put("max_age", aFloat.intValue())));
                }
            }, true));
        }, carouselItem -> {
            particle.put("type", value.name());
            NettyClient client = NettyClient.getClient();
            if (client != null) {
                client.write(ServerCrossDataPacket.build(new JsonHolder().put("internal", true).put("particle_update", true).put("active_type", value.name())));
            }
            Arrays.stream(particles).forEach(item -> item.setActive(false));
            carouselItem.setActive(true);
        });
    }
    int spot = 0;
    try {
        spot = EnumParticleType.valueOf(particle.optString("type")).ordinal();
    } catch (Exception e) {
        e.printStackTrace();
    }
    if (particles[spot].isPurchased())
        particles[spot].setPurchased(true);
    particleType = PurchaseCarousel.create(spot, particles);
    ParticleAuraHandler particleAuraHandler = Hyperium.INSTANCE.getHandlers().getParticleAuraHandler();
    HashMap<String, AbstractAnimation> animations = particleAuraHandler.getAnimations();
    String[] keys = { "Double Twirl", "Tornado", "Double Helix", "Triple Twirl", "Quad Twirl", "Static Trail", "Explode", "Vortex of doom" };
    CarouselItem[] animationItems = new CarouselItem[animations.size()];
    int c = 0;
    int g = 0;
    for (String s : keys) {
        boolean flag = self.hasPurchased("ANIMATION_" + s.replace(" ", "_".toUpperCase()));
        boolean flag1 = particle.optString("particle_animation").equalsIgnoreCase(s);
        if (flag1)
            g = c;
        animationItems[c] = new CarouselItem(s, flag, flag1, carouselItem -> {
            if (!flag) {
                int i4 = ++purchaseIds;
                GuiYesNo gui = new GuiYesNo(this, I18n.format("message.purchase", s), "", i4);
                Hyperium.INSTANCE.getHandlers().getGuiDisplayHandler().setDisplayNextTick(gui);
                ids.put(i4, () -> {
                    GeneralChatHandler.instance().sendMessage(I18n.format("message.attemptingpurchase", s));
                    NettyClient client = NettyClient.getClient();
                    if (client != null) {
                        client.write(ServerCrossDataPacket.build(new JsonHolder().put("internal", true).put("cosmetic_purchase", true).put("value", "ANIMATION_" + s.replace(" ", "_").toUpperCase())));
                    }
                });
            } else {
                GeneralChatHandler.instance().sendMessage(I18n.format("message.alreadypurchased", s));
            }
        }, carouselItem -> {
        // No settings as of now
        }, carouselItem -> {
            particle.put("particle_animation", s);
            NettyClient client = NettyClient.getClient();
            if (client != null) {
                client.write(ServerCrossDataPacket.build(new JsonHolder().put("internal", true).put("particle_update", true).put("particle_animation", s)));
            }
            Arrays.stream(animationItems).forEach(animationItem -> animationItem.setActive(false));
            carouselItem.setActive(true);
        });
        c++;
    }
    particleAnimation = PurchaseCarousel.create(g, animationItems);
}
Also used : JsonHolder(cc.hyperium.utils.JsonHolder) OverlaySelector(cc.hyperium.gui.main.components.OverlaySelector) Arrays(java.util.Arrays) GuiYesNo(net.minecraft.client.gui.GuiYesNo) HashMap(java.util.HashMap) Keyboard(org.lwjgl.input.Keyboard) OverlaySlider(cc.hyperium.gui.main.components.OverlaySlider) I18n(net.minecraft.client.resources.I18n) AbstractAnimation(cc.hyperium.handlers.handlers.particle.AbstractAnimation) Minecraft(net.minecraft.client.Minecraft) Multithreading(cc.hyperium.mods.sk1ercommon.Multithreading) GuiYesNoCallback(net.minecraft.client.gui.GuiYesNoCallback) Hyperium(cc.hyperium.Hyperium) PurchaseCarousel(cc.hyperium.gui.carousel.PurchaseCarousel) ServerCrossDataPacket(cc.hyperium.netty.packet.packets.serverbound.ServerCrossDataPacket) JsonHolder(cc.hyperium.utils.JsonHolder) InvokeEvent(cc.hyperium.event.InvokeEvent) CarouselItem(cc.hyperium.gui.carousel.CarouselItem) GeneralChatHandler(cc.hyperium.handlers.handlers.chat.GeneralChatHandler) ResolutionUtil(cc.hyperium.mods.sk1ercommon.ResolutionUtil) GuiButton(net.minecraft.client.gui.GuiButton) ScaledResolution(net.minecraft.client.gui.ScaledResolution) EventBus(cc.hyperium.event.EventBus) GlStateManager(net.minecraft.client.renderer.GlStateManager) UUIDUtil(cc.hyperium.utils.UUIDUtil) PurchaseLoadEvent(cc.hyperium.event.network.PurchaseLoadEvent) IOException(java.io.IOException) NettyClient(cc.hyperium.netty.NettyClient) java.awt(java.awt) Objects(java.util.Objects) HyperiumOverlay(cc.hyperium.gui.main.HyperiumOverlay) EnumParticleType(cc.hyperium.handlers.handlers.particle.EnumParticleType) ParticleAuraHandler(cc.hyperium.handlers.handlers.particle.ParticleAuraHandler) PurchaseApi(cc.hyperium.purchases.PurchaseApi) HyperiumPurchase(cc.hyperium.purchases.HyperiumPurchase) PurchaseLoadEvent(cc.hyperium.event.network.PurchaseLoadEvent) GuiYesNo(net.minecraft.client.gui.GuiYesNo) HyperiumPurchase(cc.hyperium.purchases.HyperiumPurchase) AbstractAnimation(cc.hyperium.handlers.handlers.particle.AbstractAnimation) HyperiumOverlay(cc.hyperium.gui.main.HyperiumOverlay) EnumParticleType(cc.hyperium.handlers.handlers.particle.EnumParticleType) OverlaySelector(cc.hyperium.gui.main.components.OverlaySelector) IOException(java.io.IOException) NettyClient(cc.hyperium.netty.NettyClient) ParticleAuraHandler(cc.hyperium.handlers.handlers.particle.ParticleAuraHandler) CarouselItem(cc.hyperium.gui.carousel.CarouselItem) OverlaySlider(cc.hyperium.gui.main.components.OverlaySlider)

Example 5 with NettyClient

use of cc.hyperium.netty.NettyClient in project Hyperium by HyperiumClient.

the class DabKeybind method onRelease.

@Override
public void onRelease() {
    if (Settings.DAB_TOGGLE)
        return;
    Hyperium.INSTANCE.getHandlers().getDabHandler().stopAnimation(UUIDUtil.getClientUUID());
    NettyClient client = NettyClient.getClient();
    if (client != null) {
        client.write(ServerCrossDataPacket.build(new JsonHolder().put("type", "dab_update").put("dabbing", false)));
    }
}
Also used : JsonHolder(cc.hyperium.utils.JsonHolder) NettyClient(cc.hyperium.netty.NettyClient)

Aggregations

NettyClient (cc.hyperium.netty.NettyClient)16 JsonHolder (cc.hyperium.utils.JsonHolder)13 AbstractAnimationHandler (cc.hyperium.handlers.handlers.animation.AbstractAnimationHandler)3 EventBus (cc.hyperium.event.EventBus)2 InvokeEvent (cc.hyperium.event.InvokeEvent)2 Multithreading (cc.hyperium.mods.sk1ercommon.Multithreading)2 HyperiumPurchase (cc.hyperium.purchases.HyperiumPurchase)2 PurchaseApi (cc.hyperium.purchases.PurchaseApi)2 IOException (java.io.IOException)2 UUID (java.util.UUID)2 GuiYesNo (net.minecraft.client.gui.GuiYesNo)2 ScaledResolution (net.minecraft.client.gui.ScaledResolution)2 Hyperium (cc.hyperium.Hyperium)1 InternalAddons (cc.hyperium.addons.InternalAddons)1 HyperiumCommandHandler (cc.hyperium.commands.HyperiumCommandHandler)1 cc.hyperium.commands.defaults (cc.hyperium.commands.defaults)1 DefaultConfig (cc.hyperium.config.DefaultConfig)1 Settings (cc.hyperium.config.Settings)1 HyperiumCosmetics (cc.hyperium.cosmetics.HyperiumCosmetics)1 Priority (cc.hyperium.event.Priority)1