All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.kosmx.bendylib.impl.RememberingPos Maven / Gradle / Ivy

The newest version!
package io.github.kosmx.bendylib.impl;


import java.util.Objects;
import net.minecraft.class_1160;

public class RememberingPos implements IPosWithOrigin{
    final class_1160 originPos;
    class_1160 currentPos = null;

    public RememberingPos(class_1160 originPos) {
        this.originPos = originPos;
    }

    public RememberingPos(float x, float y, float z){
        this(new class_1160(x, y, z));
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof RememberingPos)) return false;

        RememberingPos that = (RememberingPos) o;

        if (!originPos.equals(that.originPos)) return false;
        return Objects.equals(currentPos, that.currentPos);
    }

    @Override
    public int hashCode() {
        int result = originPos.hashCode();
        result = 31 * result + (currentPos != null ? currentPos.hashCode() : 0);
        return result;
    }

    /**
     * It will return with a copy
     * @return copy of the original pos
     */
    @Override
    public class_1160 getOriginalPos() {
        return originPos.method_23850(); //I won't let anyone to change it.
    }

    @Override
    public class_1160 getPos() {
        return currentPos;
    }

    @Override
    public void setPos(class_1160 vector3f) {
        this.currentPos = vector3f;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy