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.events;
019
020import baritone.api.event.events.type.EventState;
021
022/**
023 * @author Brady
024 * @since 8/2/2018
025 */
026public final class ChunkEvent {
027
028    /**
029     * The state of the event
030     */
031    private final EventState state;
032
033    /**
034     * The type of chunk event that occurred
035     *
036     * @see Type
037     */
038    private final Type type;
039
040    /**
041     * The Chunk X position.
042     */
043    private final int x;
044
045    /**
046     * The Chunk Z position.
047     */
048    private final int z;
049
050    public ChunkEvent(EventState state, Type type, int x, int z) {
051        this.state = state;
052        this.type = type;
053        this.x = x;
054        this.z = z;
055    }
056
057    /**
058     * @return The state of the event
059     */
060    public final EventState getState() {
061        return this.state;
062    }
063
064    /**
065     * @return The type of chunk event that occurred;
066     */
067    public final Type getType() {
068        return this.type;
069    }
070
071    /**
072     * @return The Chunk X position.
073     */
074    public final int getX() {
075        return this.x;
076    }
077
078    /**
079     * @return The Chunk Z position.
080     */
081    public final int getZ() {
082        return this.z;
083    }
084
085    public enum Type {
086
087        /**
088         * When the chunk is constructed.
089         */
090        LOAD,
091
092        /**
093         * When the chunk is deconstructed.
094         */
095        UNLOAD,
096
097        /**
098         * When the chunk is being populated with blocks, tile entities, etc.
099         * <p>
100         * And it's a full chunk
101         */
102        POPULATE_FULL,
103
104        /**
105         * When the chunk is being populated with blocks, tile entities, etc.
106         * <p>
107         * And it's a partial chunk
108         */
109        POPULATE_PARTIAL
110    }
111}