Tiny comment for Projectile#getShooter

This commit is contained in:
Konstantin Shandurenko 2021-02-22 16:42:52 +03:00
parent bcdd1bb70a
commit 1053cb33b1

View File

@ -6,6 +6,7 @@ import net.minestom.server.utils.Position;
import net.minestom.server.utils.Vector;
import net.minestom.server.utils.validate.Check;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
@ -28,10 +29,10 @@ public interface Projectile {
@SuppressWarnings("ConstantConditions")
static void shoot(@NotNull Projectile projectile, @NotNull Position from, @NotNull Position to, double power, double spread) {
Check.argCondition(!(projectile instanceof Entity), "Projectile must be an instance of Entity!");
Entity proj = (Entity) projectile;
double dx = to.getX() - from.getX();
double dy = to.getY() - from.getY();
double dz = to.getZ() - from.getZ();
Entity proj = (Entity) projectile;
double dx = to.getX() - from.getX();
double dy = to.getY() - from.getY();
double dz = to.getZ() - from.getZ();
double xzLength = Math.sqrt(dx * dx + dz * dz);
dy += xzLength * 0.20000000298023224D;
@ -55,6 +56,12 @@ public interface Projectile {
);
}
/**
* Gets the shooter of this projectile.
*
* @return the shooter of this projectile.
*/
@Nullable
Entity getShooter();
}