001/*
002 * The FML Forge Mod Loader suite.
003 * Copyright (C) 2012 cpw
004 *
005 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
006 * Software Foundation; either version 2.1 of the License, or any later version.
007 *
008 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
009 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
010 *
011 * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
012 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
013 */
014
015package cpw.mods.fml.common;
016
017import java.util.EnumSet;
018
019public enum TickType {
020    /**
021     * Fired during the world evaluation loop
022     * server and client side
023     *
024     * arg 0 : The world that is ticking
025     */
026    WORLD,
027    /**
028     * client side
029     * Fired during the render processing phase
030     * arg 0 : float "partial render time"
031     */
032    RENDER,
033    /**
034     * client side
035     * Fired during the render processing phase if a GUI is open
036     * arg 0 : float "partial render time"
037     * arg 1 : the open gui or null if no gui is open
038     */
039    GUI,
040    /**
041     * client side
042     * Fired during the client evaluation loop
043     * arg 0 : The open gui or null if no gui is open
044     */
045    CLIENTGUI,
046    /**
047     * server side
048     * Fired once as the world loads from disk
049     */
050    WORLDLOAD,
051    /**
052     * client side only
053     * Fired once per client tick loop.
054     */
055    CLIENT,
056    /**
057     * client and server side.
058     * Fired whenever the players update loop runs.
059     * arg 0 : the player
060     * arg 1 : the world the player is in
061     */
062    PLAYER,
063    /**
064     * server side only.
065     * This is the server game tick.
066     * Fired once per tick loop on the server.
067     */
068    SERVER;
069
070    /**
071     * Partner ticks that are also cancelled by returning false from onTickInGame
072     */
073    public EnumSet<TickType> partnerTicks()
074    {
075        if (this==CLIENT) return EnumSet.of(RENDER);
076        if (this==RENDER) return EnumSet.of(CLIENT);
077        if (this==GUI) return EnumSet.of(CLIENTGUI);
078        if (this==CLIENTGUI) return EnumSet.of(GUI);
079        return EnumSet.noneOf(TickType.class);
080    }
081}