001/*
002 * Forge Mod Loader
003 * Copyright (c) 2012-2013 cpw.
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser Public License v2.1
006 * which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
008 *
009 * Contributors:
010 *     cpw - implementation
011 */
012
013package cpw.mods.fml.common;
014
015import java.util.EnumSet;
016
017public enum TickType {
018    /**
019     * Fired during the world evaluation loop
020     * server and client side
021     *
022     * arg 0 : The world that is ticking
023     */
024    WORLD,
025    /**
026     * client side
027     * Fired during the render processing phase
028     * arg 0 : float "partial render time"
029     */
030    RENDER,
031    /**
032     * server side
033     * Fired once as the world loads from disk
034     */
035    WORLDLOAD,
036    /**
037     * client side only
038     * Fired once per client tick loop.
039     */
040    CLIENT,
041    /**
042     * client and server side.
043     * Fired whenever the players update loop runs.
044     * arg 0 : the player
045     * arg 1 : the world the player is in
046     */
047    PLAYER,
048    /**
049     * server side only.
050     * This is the server game tick.
051     * Fired once per tick loop on the server.
052     */
053    SERVER;
054
055    /**
056     * Partner ticks that are also cancelled by returning false from onTickInGame
057     */
058    public EnumSet<TickType> partnerTicks()
059    {
060        if (this==CLIENT) return EnumSet.of(RENDER);
061        if (this==RENDER) return EnumSet.of(CLIENT);
062        return EnumSet.noneOf(TickType.class);
063    }
064}