    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     * Not fired
    035     */
    036    @Deprecated
    037    GUI,
    038    /**
    039     * Not fired
    040     */
    041    @Deprecated
    042    CLIENTGUI,
    043    /**
    044     * server side
    045     * Fired once as the world loads from disk
    046     */
    047    WORLDLOAD,
    048    /**
    049     * client side only
    050     * Fired once per client tick loop.
    051     */
    052    CLIENT,
    053    /**
    054     * client and server side.
    055     * Fired whenever the players update loop runs.
    056     * arg 0 : the player
    057     * arg 1 : the world the player is in
    058     */
    059    PLAYER,
    060    /**
    061     * server side only.
    062     * This is the server game tick.
    063     * Fired once per tick loop on the server.
    064     */
    065    SERVER;
    066
    067    /**
    068     * Partner ticks that are also cancelled by returning false from onTickInGame
    069     */
    070    public EnumSet<TickType> partnerTicks()
    071    {
    072        if (this==CLIENT) return EnumSet.of(RENDER);
    073        if (this==RENDER) return EnumSet.of(CLIENT);
    074        if (this==GUI) return EnumSet.of(CLIENTGUI);
    075        if (this==CLIENTGUI) return EnumSet.of(GUI);
    076        return EnumSet.noneOf(TickType.class);
    077    }
    078}