package noppes.npcs.client; import net.minecraft.client.Minecraft; import net.minecraft.inventory.ContainerPlayer; import net.minecraft.world.World; import noppes.npcs.CustomNpcs; import noppes.npcs.NoppesUtilPlayer; import noppes.npcs.client.controllers.MusicController; import noppes.npcs.client.gui.player.GuiQuestLog; import noppes.npcs.client.renderer.RenderNPCInterface; import noppes.npcs.constants.EnumPlayerPacket; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.InputEvent; import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.common.gameevent.TickEvent.Phase; public class ClientTickHandler{ private World prevWorld; private boolean otherContainer = false; @SubscribeEvent(priority = EventPriority.LOWEST) public void onClientTick(TickEvent.ClientTickEvent event){ if(event.phase == Phase.END) return; Minecraft mc = Minecraft.getMinecraft(); if(mc.thePlayer != null && mc.thePlayer.openContainer instanceof ContainerPlayer){ if(otherContainer){ NoppesUtilPlayer.sendData(EnumPlayerPacket.CheckQuestCompletion); otherContainer = false; } } else otherContainer = true; CustomNpcs.ticks++; RenderNPCInterface.LastTextureTick++; if(prevWorld != mc.theWorld){ prevWorld = mc.theWorld; MusicController.Instance.stopMusic(); } } @SubscribeEvent public void onKey(InputEvent.KeyInputEvent event){ if(ClientProxy.QuestLog.isPressed()){ Minecraft mc = Minecraft.getMinecraft(); if(mc.currentScreen == null) NoppesUtil.openGUI(mc.thePlayer, new GuiQuestLog(mc.thePlayer)); else if(mc.currentScreen instanceof GuiQuestLog) mc.setIngameFocus(); } } }