Search in sources :

Example 26 with InvokeEvent

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

the class FlipHandler method swapWorld.

@InvokeEvent
public void swapWorld(WorldChangeEvent event) {
    UUID id = UUIDUtil.getClientUUID();
    if (id == null)
        return;
    Integer integer = rotateState.get(id);
    rotateState.clear();
    if (integer != null)
        rotateState.put(id, integer);
}
Also used : UUID(java.util.UUID) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 27 with InvokeEvent

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

the class NotificationCenter method onClick.

@InvokeEvent
public void onClick(GuiClickEvent event) {
    if (currentNotification != null && currentNotification.clickedCallback != null) {
        ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft());
        int left = currentNotification.getX(sr);
        int top = currentNotification.getY(sr);
        int right = left + currentNotification.width;
        int bottom = top + currentNotification.height;
        int mouseX = event.getMouseX();
        int mouseY = event.getMouseY();
        if (mouseX > left && mouseX < right && mouseY > top && mouseY < bottom) {
            currentNotification.clickedCallback.run();
        }
    }
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 28 with InvokeEvent

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

the class MotionBlurMod method onClientTick.

@InvokeEvent
public void onClientTick(TickEvent event) {
    if (Settings.MOTION_BLUR_ENABLED && !Minecraft.getMinecraft().entityRenderer.isShaderActive() && mc.theWorld != null && !isFastRenderEnabled()) {
        applyShader();
    }
    if (domainResourceManagers == null) {
        try {
            Field[] var2 = SimpleReloadableResourceManager.class.getDeclaredFields();
            for (Field field : var2) {
                if (field.getType() == Map.class) {
                    field.setAccessible(true);
                    domainResourceManagers = (Map) field.get(Minecraft.getMinecraft().getResourceManager());
                    break;
                }
            }
        } catch (Exception var6) {
            throw new RuntimeException(var6);
        }
    }
    if (!domainResourceManagers.containsKey("motionblur")) {
        domainResourceManagers.put("motionblur", new MotionBlurResourceManager());
    }
}
Also used : Field(java.lang.reflect.Field) MotionBlurResourceManager(cc.hyperium.mods.motionblur.resource.MotionBlurResourceManager) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 29 with InvokeEvent

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

the class NickHider method profileCheck.

@InvokeEvent
public void profileCheck(TickEvent event) {
    if (nickHiderConfig.isMasterEnabled()) {
        EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
        if (player == null)
            return;
        NetHandlerPlayClient sendQueue = player.sendQueue;
        if (sendQueue == null)
            return;
        sendQueue.getPlayerInfoMap().stream().map(NetworkPlayerInfo::getGameProfile).forEach(gameProfile -> {
            if (gameProfile.getId() != null && gameProfile.getId().equals(Minecraft.getMinecraft().getSession().getProfile().getId())) {
                if (!gameProfile.getName().equalsIgnoreCase(Minecraft.getMinecraft().getSession().getProfile().getName())) {
                    remap(gameProfile.getName(), override == null ? Minecraft.getMinecraft().getSession().getProfile().getName() : override);
                }
            } else if (nickHiderConfig.isHideOtherNames()) {
                remap(gameProfile.getName(), getPseudo(gameProfile.getName()));
            }
        });
    }
}
Also used : NetHandlerPlayClient(net.minecraft.client.network.NetHandlerPlayClient) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 30 with InvokeEvent

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

the class NickHider method bookCheck.

@InvokeEvent
public void bookCheck(TickEvent event) {
    GuiScreen currentScreen = Minecraft.getMinecraft().currentScreen;
    if (currentScreen == null)
        return;
    if (currentScreen instanceof GuiScreenBook) {
        NBTTagList bookPages = ((IMixinGuiScreenBook) currentScreen).getBookPages();
        int currPage = ((IMixinGuiScreenBook) currentScreen).getCurrPage();
        if (currPage < bookPages.tagCount()) {
            try {
                String textWithoutFormattingCodes = EnumChatFormatting.getTextWithoutFormattingCodes(IChatComponent.Serializer.jsonToComponent(bookPages.getStringTagAt(currPage)).getUnformattedText().replace("\n", " "));
                Matcher matcher = newNick.matcher(textWithoutFormattingCodes);
                if (matcher.find()) {
                    String nick = matcher.group("nick");
                    remap(nick, override == null ? Minecraft.getMinecraft().getSession().getProfile().getName() : override);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) IMixinGuiScreenBook(cc.hyperium.mixins.client.gui.IMixinGuiScreenBook) Matcher(java.util.regex.Matcher) GuiScreen(net.minecraft.client.gui.GuiScreen) GuiScreenBook(net.minecraft.client.gui.GuiScreenBook) IMixinGuiScreenBook(cc.hyperium.mixins.client.gui.IMixinGuiScreenBook) 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