Add Vec#apply

This commit is contained in:
TheMode 2021-06-20 14:56:00 +02:00
parent 5a01c041cf
commit ab9e16dfe7

View File

@ -3,6 +3,8 @@ package net.minestom.server.utils.incubator;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import java.util.function.UnaryOperator;
public interface Vec {
Vec ZERO = new VecImpl();
@ -75,6 +77,11 @@ public interface Vec {
return with(Math.max(x(), vec.x()), Math.max(y(), vec.y()), Math.max(z(), vec.z()));
}
@Contract(pure = true)
default Vec apply(@NotNull UnaryOperator<@NotNull Vec> operator) {
return operator.apply(this);
}
@Contract(pure = true)
double x();