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 net.minecraft.client.Minecraft;
022import net.minecraft.client.gui.screens.DeathScreen;
023import net.minecraft.client.multiplayer.ClientLevel;
024import net.minecraft.client.player.LocalPlayer;
025import net.minecraft.network.protocol.Packet;
026import net.minecraft.world.entity.Entity;
027import net.minecraft.world.phys.Vec3;
028
029/**
030 * @author Brady
031 * @since 7/31/2018
032 */
033public interface IGameEventListener {
034
035    /**
036     * Run once per game tick before screen input is handled.
037     *
038     * @param event The event
039     * @see Minecraft#tick()
040     */
041    void onTick(TickEvent event);
042
043    /**
044     * Run once per game tick after the tick is completed
045     *
046     * @param event The event
047     * @see Minecraft#runTick()
048     */
049    void onPostTick(TickEvent event);
050
051    /**
052     * Run once per game tick from before and after the player rotation is sent to the server.
053     *
054     * @param event The event
055     * @see LocalPlayer#tick()
056     */
057    void onPlayerUpdate(PlayerUpdateEvent event);
058
059    /**
060     * Runs whenever the client player sends a message to the server.
061     *
062     * @param event The event
063     * @see LocalPlayer#chat(String)
064     */
065    void onSendChatMessage(ChatEvent event);
066
067    /**
068     * Runs whenever the client player tries to tab complete in chat.
069     *
070     * @param event The event
071     */
072    void onPreTabComplete(TabCompleteEvent event);
073
074    /**
075     * Runs before and after whenever a chunk is either loaded, unloaded, or populated.
076     *
077     * @param event The event
078     */
079    void onChunkEvent(ChunkEvent event);
080
081    /**
082     * Runs after a single or multi block change packet is received and processed.
083     *
084     * @param event The event
085     */
086    void onBlockChange(BlockChangeEvent event);
087
088    /**
089     * Runs once per world render pass.
090     *
091     * @param event The event
092     */
093    void onRenderPass(RenderEvent event);
094
095    /**
096     * Runs before and after whenever a new world is loaded
097     *
098     * @param event The event
099     * @see Minecraft#setLevel(ClientLevel)
100     */
101    void onWorldEvent(WorldEvent event);
102
103    /**
104     * Runs before a outbound packet is sent
105     *
106     * @param event The event
107     * @see Packet
108     */
109    void onSendPacket(PacketEvent event);
110
111    /**
112     * Runs before an inbound packet is processed
113     *
114     * @param event The event
115     * @see Packet
116     */
117    void onReceivePacket(PacketEvent event);
118
119    /**
120     * Run once per game tick from before and after the player's moveRelative method is called
121     * and before and after the player jumps.
122     *
123     * @param event The event
124     * @see Entity#moveRelative(float, Vec3)
125     */
126    void onPlayerRotationMove(RotationMoveEvent event);
127
128    /**
129     * Called whenever the sprint keybind state is checked in {@link LocalPlayer#aiStep}
130     *
131     * @param event The event
132     * @see LocalPlayer#aiStep()
133     */
134    void onPlayerSprintState(SprintStateEvent event);
135
136    /**
137     * Called when the local player interacts with a block, whether it is breaking or opening/placing.
138     *
139     * @param event The event
140     */
141    void onBlockInteract(BlockInteractEvent event);
142
143    /**
144     * Called when the local player dies, as indicated by the creation of the {@link DeathScreen} screen.
145     *
146     * @see DeathScreen
147     */
148    void onPlayerDeath();
149
150    /**
151     * When the pathfinder's state changes
152     *
153     * @param event The event
154     */
155    void onPathEvent(PathEvent event);
156}