Package cofh.core.util

Source Code of cofh.core.util.TickHandlerEnderRegistry

package cofh.core.util;

import cofh.api.transport.RegistryEnderAttuned;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiMainMenu;

@SideOnly(Side.CLIENT)
public class TickHandlerEnderRegistry {

  public static TickHandlerEnderRegistry instance = new TickHandlerEnderRegistry();

  public boolean needsMenu = false;

  @SubscribeEvent
  public void tickEnd(ClientTickEvent evt) {

    Minecraft mc = Minecraft.getMinecraft();

    if (evt.phase == Phase.END) {
      if (mc.currentScreen instanceof GuiMainMenu) {
        if (needsMenu) {
          onMainMenu();
          needsMenu = false;
        }
      } else if (mc.inGameHasFocus) {
        needsMenu = true;
      }
    }
  }

  public void onMainMenu() {

    RegistryEnderAttuned.clear();
  }

}
TOP

Related Classes of cofh.core.util.TickHandlerEnderRegistry

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.