Search in sources :

Example 1 with GuiGameOverMP

use of stevekung.mods.moreplanets.util.client.gui.GuiGameOverMP in project MorePlanets by SteveKunG.

the class ClientEventHandler method onClientTick.

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onClientTick(ClientTickEvent event) {
    if (MorePlanetsCore.isObfuscatedEnvironment()) {
        if (Keyboard.isKeyDown(Keyboard.KEY_F7)) {
            try {
                // used for real time debugging item description
                Object proxy = Class.forName("mezz.jei.JustEnoughItems").getDeclaredMethod("getProxy").invoke(Class.forName("mezz.jei.startup.ProxyCommonClient"));
                Field pluginsField = proxy.getClass().getDeclaredField("plugins");
                pluginsField.setAccessible(true);
                Class<?> starter = Class.forName("mezz.jei.startup.JeiStarter");
                Object obj = starter.newInstance();
                Method method = obj.getClass().getDeclaredMethod("start", List.class);
                method.invoke(obj, (ArrayList<Object>) pluginsField.get(proxy));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (Keyboard.isKeyDown(Keyboard.KEY_NUMPAD5) && !this.mc.player.getHeldItemMainhand().isEmpty()) {
            this.mc.displayGuiScreen(new GuiGetItemName());
        }
    }
    if (ClientEventHandler.loadRenderers) {
        if (--this.loadRendererTick == 0) {
            MPLog.debug("Reload renderer");
            this.mc.renderGlobal.loadRenderers();
            this.loadRendererTick = 30;
            ClientEventHandler.loadRenderers = false;
        }
    }
    if (this.mc.player != null) {
        if (ConfigManagerMP.enableStartedPlanet && this.mc.player.dimension == -1 && this.mc.currentScreen instanceof GuiGameOver && !(this.mc.currentScreen instanceof GuiGameOverMP)) {
            this.mc.displayGuiScreen(new GuiGameOverMP());
        }
    }
    if (this.mc.currentScreen instanceof GuiMainMenu) {
        ClientEventHandler.receiverRenderPos.clear();
        ClientEventHandler.wasteRenderPos.clear();
        ClientEventHandler.entityId.clear();
        ClientEventHandler.bossList.clear();
        ClientEventHandler.itemRendererTicks = 0;
    }
    if (event.phase == Phase.START) {
        ClientEventHandler.itemRendererTicks++;
        this.partialTicks++;
        WeatherRendererNibiru.INSTANCE.runRenderTick();
        CloudRendererNibiru.INSTANCE.runRenderTick();
    }
}
Also used : Field(java.lang.reflect.Field) GuiGameOver(net.minecraft.client.gui.GuiGameOver) GuiMainMenu(net.minecraft.client.gui.GuiMainMenu) GuiGameOverMP(stevekung.mods.moreplanets.util.client.gui.GuiGameOverMP) Method(java.lang.reflect.Method) GuiGetItemName(stevekung.mods.moreplanets.util.debug.GuiGetItemName) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

Field (java.lang.reflect.Field)1 Method (java.lang.reflect.Method)1 GuiGameOver (net.minecraft.client.gui.GuiGameOver)1 GuiMainMenu (net.minecraft.client.gui.GuiMainMenu)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1 GuiGameOverMP (stevekung.mods.moreplanets.util.client.gui.GuiGameOverMP)1 GuiGetItemName (stevekung.mods.moreplanets.util.debug.GuiGetItemName)1