001/*
002 * This file is part of Baritone.
003 *
004 * Baritone is free software: you can redistribute it and/or modify
005 * it under the terms of the GNU Lesser General Public License as published by
006 * the Free Software Foundation, either version 3 of the License, or
007 * (at your option) any later version.
008 *
009 * Baritone is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012 * GNU Lesser General Public License for more details.
013 *
014 * You should have received a copy of the GNU Lesser General Public License
015 * along with Baritone.  If not, see <https://www.gnu.org/licenses/>.
016 */
017
018package baritone.api.event.listener;
019
020import baritone.api.event.events.*;
021import io.netty.util.concurrent.GenericFutureListener;
022import net.minecraft.client.Minecraft;
023import net.minecraft.client.entity.EntityPlayerSP;
024import net.minecraft.client.gui.GuiGameOver;
025import net.minecraft.client.multiplayer.WorldClient;
026import net.minecraft.client.settings.GameSettings;
027import net.minecraft.entity.Entity;
028import net.minecraft.network.Packet;
029
030/**
031 * @author Brady
032 * @since 7/31/2018
033 */
034public interface IGameEventListener {
035
036    /**
037     * Run once per game tick before screen input is handled.
038     *
039     * @param event The event
040     * @see Minecraft#runTick()
041     */
042    void onTick(TickEvent event);
043
044    /**
045     * Run once per game tick from before and after the player rotation is sent to the server.
046     *
047     * @param event The event
048     * @see EntityPlayerSP#onUpdate()
049     */
050    void onPlayerUpdate(PlayerUpdateEvent event);
051
052    /**
053     * Runs whenever the client player sends a message to the server.
054     *
055     * @param event The event
056     * @see EntityPlayerSP#sendChatMessage(String)
057     */
058    void onSendChatMessage(ChatEvent event);
059
060    /**
061     * Runs whenever the client player tries to tab complete in chat.
062     *
063     * @param event The event
064     */
065    void onPreTabComplete(TabCompleteEvent event);
066
067    /**
068     * Runs before and after whenever a chunk is either loaded, unloaded, or populated.
069     *
070     * @param event The event
071     * @see WorldClient#doPreChunk(int, int, boolean)
072     */
073    void onChunkEvent(ChunkEvent event);
074
075    /**
076     * Runs once per world render pass. Two passes are made when {@link GameSettings#anaglyph} is on.
077     * <p>
078     * <b>Note:</b> {@link GameSettings#anaglyph} has been removed in Minecraft 1.13
079     *
080     * @param event The event
081     */
082    void onRenderPass(RenderEvent event);
083
084    /**
085     * Runs before and after whenever a new world is loaded
086     *
087     * @param event The event
088     * @see Minecraft#loadWorld(WorldClient, String)
089     */
090    void onWorldEvent(WorldEvent event);
091
092    /**
093     * Runs before a outbound packet is sent
094     *
095     * @param event The event
096     * @see Packet
097     * @see GenericFutureListener
098     */
099    void onSendPacket(PacketEvent event);
100
101    /**
102     * Runs before an inbound packet is processed
103     *
104     * @param event The event
105     * @see Packet
106     * @see GenericFutureListener
107     */
108    void onReceivePacket(PacketEvent event);
109
110    /**
111     * Run once per game tick from before and after the player's moveRelative method is called
112     * and before and after the player jumps.
113     *
114     * @param event The event
115     * @see Entity#moveRelative(float, float, float, float)
116     */
117    void onPlayerRotationMove(RotationMoveEvent event);
118
119    /**
120     * Called whenever the sprint keybind state is checked in {@link EntityPlayerSP#onLivingUpdate}
121     *
122     * @param event The event
123     * @see EntityPlayerSP#onLivingUpdate()
124     */
125    void onPlayerSprintState(SprintStateEvent event);
126
127    /**
128     * Called when the local player interacts with a block, whether it is breaking or opening/placing.
129     *
130     * @param event The event
131     */
132    void onBlockInteract(BlockInteractEvent event);
133
134    /**
135     * Called when the local player dies, as indicated by the creation of the {@link GuiGameOver} screen.
136     *
137     * @see GuiGameOver
138     */
139    void onPlayerDeath();
140
141    /**
142     * When the pathfinder's state changes
143     *
144     * @param event The event
145     */
146    void onPathEvent(PathEvent event);
147}