Search in sources :

Example 36 with InvokeEvent

use of cc.hyperium.event.InvokeEvent in project Hyperium by HyperiumClient.

the class EventClientConnection method playerLoggedIn.

@InvokeEvent
public void playerLoggedIn(ServerJoinEvent event) {
    TaskManager taskManager = autotip.getTaskManager();
    SessionManager manager = autotip.getSessionManager();
    autotip.getMessageUtil().clearQueues();
    serverIp = UniversalUtil.getRemoteAddress(event).toLowerCase();
    lastLogin = System.currentTimeMillis();
    taskManager.getExecutor().execute(() -> {
        Object header;
        int attempts = 0;
        while ((header = getHeader()) == null) {
            if (attempts > 15)
                return;
            try {
                Thread.sleep(500);
            } catch (InterruptedException ignored) {
            }
            attempts++;
        }
        if (UniversalUtil.getUnformattedText(header).equals(hypixelHeader)) {
            manager.setOnHypixel(true);
            if (autotip.getConfig().isEnabled()) {
                taskManager.executeTask(TaskType.LOGIN, manager::login);
            }
        } else {
            manager.setOnHypixel(false);
        }
    });
}
Also used : TaskManager(me.semx11.autotip.core.TaskManager) SessionManager(me.semx11.autotip.core.SessionManager) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 37 with InvokeEvent

use of cc.hyperium.event.InvokeEvent in project Hyperium by HyperiumClient.

the class ParticleAuraHandler method renderPlayer.

@InvokeEvent
public void renderPlayer(RenderPlayerEvent event) {
    if (Minecraft.getMinecraft().isGamePaused())
        return;
    if (event.getEntity().isInvisible())
        return;
    if (Minecraft.getMinecraft().currentScreen instanceof GuiHyperiumScreenIngameMenu)
        return;
    if (Minecraft.getMinecraft().theWorld == null || Minecraft.getMinecraft().thePlayer == null)
        return;
    if (!Settings.SHOW_PARTICLES)
        return;
    AbstractClientPlayer entity = event.getEntity();
    if (!entity.equals(Minecraft.getMinecraft().thePlayer) && (entity.posX != entity.prevPosZ || entity.posY != entity.prevPosY || entity.posZ != entity.prevPosZ)) {
        return;
    }
    ParticleAura particleAura = auras.get(entity.getUniqueID());
    if (particleAura != null && !entity.isInvisible()) {
        double x = entity.prevPosX + (entity.posX - entity.prevPosX) * event.getPartialTicks();
        double y = entity.posY + (entity.posY - entity.prevPosY) * event.getPartialTicks();
        double z = entity.posZ + (entity.posZ - entity.prevPosZ) * event.getPartialTicks();
        List<Vec3> render = particleAura.render(entity, x, y, z);
        render.forEach(vec3 -> {
            IParticle type = particleAura.getType();
            if (type != null) {
                EntityFX entityFX = type.spawn(entity.worldObj, vec3.xCoord, vec3.yCoord, vec3.zCoord);
                int particleMaxAge = particleAura.getParticleMaxAge();
                IMixinEntityFX e = (IMixinEntityFX) entityFX;
                if (particleAura.isChroma()) {
                    int i = Color.HSBtoRGB(System.currentTimeMillis() % 1000L / 1000.0f, 0.8f, 0.8f);
                    Color color = new Color(i);
                    entityFX.setRBGColorF(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F);
                } else if (particleAura.isRgb()) {
                    entityFX.setRBGColorF(particleAura.getRed() / 255F, particleAura.getBlue() / 255F, particleAura.getBlue() / 255F);
                }
                e.setParticleGravity(10);
                e.setParticleMaxAge(particleMaxAge);
                Minecraft.getMinecraft().effectRenderer.addEffect(entityFX);
            }
        });
    }
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) IMixinEntityFX(cc.hyperium.mixins.client.particle.IMixinEntityFX) GuiHyperiumScreenIngameMenu(cc.hyperium.gui.GuiHyperiumScreenIngameMenu) Vec3(net.minecraft.util.Vec3) IMixinEntityFX(cc.hyperium.mixins.client.particle.IMixinEntityFX) EntityFX(net.minecraft.client.particle.EntityFX) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 38 with InvokeEvent

use of cc.hyperium.event.InvokeEvent in project Hyperium by HyperiumClient.

the class VanillaEnhancementsHud method renderEnchantments.

@InvokeEvent
public void renderEnchantments(RenderHUDEvent e) {
    if (Settings.ENCHANTMENTS_ABOVE_HOTBAR) {
        ItemStack heldItemStack = mc.thePlayer.inventory.getCurrentItem();
        if (heldItemStack != null) {
            String toDraw = heldItemStack.getItem() instanceof ItemPotion ? getPotionEffectString(heldItemStack) : getEnchantmentString(heldItemStack);
            GL11.glPushMatrix();
            GL11.glScalef(0.5f, 0.5f, 0.5f);
            ScaledResolution res = ResolutionUtil.current();
            int y = res.getScaledHeight() - 59;
            y += (mc.playerController.shouldDrawHUD() ? -2 : 14);
            y = y + mc.fontRendererObj.FONT_HEIGHT;
            y <<= 1;
            int x = res.getScaledWidth() - (mc.fontRendererObj.getStringWidth(toDraw) >> 1);
            mc.fontRendererObj.drawString(toDraw, x, y, 13421772);
            GL11.glScalef(2.0f, 2.0f, 2.0f);
            GL11.glPopMatrix();
        }
    }
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 39 with InvokeEvent

use of cc.hyperium.event.InvokeEvent in project Hyperium by HyperiumClient.

the class VanillaEnhancementsHud method renderDamage.

@InvokeEvent
public void renderDamage(RenderHUDEvent e) {
    if (Settings.DAMAGE_ABOVE_HOTBAR) {
        ItemStack heldItemStack = mc.thePlayer.inventory.getCurrentItem();
        if (heldItemStack != null) {
            GL11.glPushMatrix();
            GL11.glScalef(0.5f, 0.5f, 0.5f);
            ScaledResolution res = ResolutionUtil.current();
            String attackDamage = getAttackDamageString(heldItemStack);
            int y = res.getScaledHeight() - 59;
            y += (mc.playerController.shouldDrawHUD() ? -1 : 14);
            y = y + mc.fontRendererObj.FONT_HEIGHT;
            y <<= 1;
            y += mc.fontRendererObj.FONT_HEIGHT;
            int x = res.getScaledWidth() - (mc.fontRendererObj.getStringWidth(attackDamage) >> 1);
            mc.fontRendererObj.drawString(attackDamage, x, y, 13421772);
            GL11.glScalef(2.0f, 2.0f, 2.0f);
            GL11.glPopMatrix();
        }
    }
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 40 with InvokeEvent

use of cc.hyperium.event.InvokeEvent in project Hyperium by HyperiumClient.

the class VanillaEnhancementsHud method renderHotbarNumbers.

@InvokeEvent
public void renderHotbarNumbers(RenderHUDEvent event) {
    if (Settings.HOTBAR_KEYS) {
        ScaledResolution resolution = ResolutionUtil.current();
        int x = resolution.getScaledWidth() / 2 - 87;
        int y = resolution.getScaledHeight() - 18;
        int[] hotbarKeys = getHotbarKeys();
        for (int slot = 0; slot < 9; slot++) {
            mc.fontRendererObj.drawString(getKeyString(hotbarKeys[slot]), x + slot * 20, y, -1);
        }
    }
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) InvokeEvent(cc.hyperium.event.InvokeEvent)

Aggregations

InvokeEvent (cc.hyperium.event.InvokeEvent)44 HyperiumPurchase (cc.hyperium.purchases.HyperiumPurchase)7 AbstractClientPlayer (net.minecraft.client.entity.AbstractClientPlayer)6 UUID (java.util.UUID)4 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)4 ScaledResolution (net.minecraft.client.gui.ScaledResolution)4 RenderManager (net.minecraft.client.renderer.entity.RenderManager)4 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 IMixinModelBiped (cc.hyperium.mixinsimp.client.model.IMixinModelBiped)3 ChatComponentText (net.minecraft.util.ChatComponentText)3 EventBus (cc.hyperium.event.EventBus)2 AutoGG (cc.hyperium.mods.autogg.AutoGG)2 ChatColor (cc.hyperium.utils.ChatColor)2 IOException (java.io.IOException)2 Field (java.lang.reflect.Field)2 URI (java.net.URI)2 URISyntaxException (java.net.URISyntaxException)2 Map (java.util.Map)2 Matcher (java.util.regex.Matcher)2 Minecraft (net.minecraft.client.Minecraft)2