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.utils.Rotation;
021import net.minecraft.world.entity.Entity;
022import net.minecraft.world.entity.LivingEntity;
023import net.minecraft.world.phys.Vec3;
024
025/**
026 * @author Brady
027 * @since 8/21/2018
028 */
029public final class RotationMoveEvent {
030
031    /**
032     * The type of event
033     */
034    private final Type type;
035
036    private final Rotation original;
037
038    /**
039     * The yaw rotation
040     */
041    private float yaw;
042
043    /**
044     * The pitch rotation
045     */
046    private float pitch;
047
048    public RotationMoveEvent(Type type, float yaw, float pitch) {
049        this.type = type;
050        this.original = new Rotation(yaw, pitch);
051        this.yaw = yaw;
052        this.pitch = pitch;
053    }
054
055    public Rotation getOriginal() {
056        return this.original;
057    }
058
059    /**
060     * Set the yaw movement rotation
061     *
062     * @param yaw Yaw rotation
063     */
064    public void setYaw(float yaw) {
065        this.yaw = yaw;
066    }
067
068    /**
069     * @return The yaw rotation
070     */
071    public float getYaw() {
072        return this.yaw;
073    }
074
075    /**
076     * Set the pitch movement rotation
077     *
078     * @param pitch Pitch rotation
079     */
080    public void setPitch(float pitch) {
081        this.pitch = pitch;
082    }
083
084    /**
085     * @return The pitch rotation
086     */
087    public float getPitch() {
088        return pitch;
089    }
090
091    /**
092     * @return The type of the event
093     */
094    public Type getType() {
095        return this.type;
096    }
097
098    public enum Type {
099
100        /**
101         * Called when the player's motion is updated.
102         *
103         * @see Entity#moveRelative(float, Vec3)
104         */
105        MOTION_UPDATE,
106
107        /**
108         * Called when the player jumps.
109         *
110         * @see LivingEntity
111         */
112        JUMP
113    }
114}