mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Add Mob#lookAt API
This commit is contained in:
parent
5392798da4
commit
1ccedf3a03
1 changed files with 48 additions and 0 deletions
|
@ -97,5 +97,53 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
|
||||||
public boolean isInDaylight() {
|
public boolean isInDaylight() {
|
||||||
return getHandle().isSunBurnTick();
|
return getHandle().isSunBurnTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void lookAt(@org.jetbrains.annotations.NotNull org.bukkit.Location location) {
|
||||||
|
com.google.common.base.Preconditions.checkNotNull(location, "location cannot be null");
|
||||||
|
com.google.common.base.Preconditions.checkArgument(location.getWorld().equals(getWorld()), "location in a different world");
|
||||||
|
getHandle().getLookControl().setLookAt(location.getX(), location.getY(), location.getZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void lookAt(@org.jetbrains.annotations.NotNull org.bukkit.Location location, float headRotationSpeed, float maxHeadPitch) {
|
||||||
|
com.google.common.base.Preconditions.checkNotNull(location, "location cannot be null");
|
||||||
|
com.google.common.base.Preconditions.checkArgument(location.getWorld().equals(getWorld()), "location in a different world");
|
||||||
|
getHandle().getLookControl().setLookAt(location.getX(), location.getY(), location.getZ(), headRotationSpeed, maxHeadPitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void lookAt(@org.jetbrains.annotations.NotNull org.bukkit.entity.Entity entity) {
|
||||||
|
com.google.common.base.Preconditions.checkNotNull(entity, "entity cannot be null");
|
||||||
|
com.google.common.base.Preconditions.checkArgument(entity.getWorld().equals(getWorld()), "entity in a different world");
|
||||||
|
getHandle().getLookControl().setLookAt(((CraftEntity) entity).getHandle());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void lookAt(@org.jetbrains.annotations.NotNull org.bukkit.entity.Entity entity, float headRotationSpeed, float maxHeadPitch) {
|
||||||
|
com.google.common.base.Preconditions.checkNotNull(entity, "entity cannot be null");
|
||||||
|
com.google.common.base.Preconditions.checkArgument(entity.getWorld().equals(getWorld()), "entity in a different world");
|
||||||
|
getHandle().getLookControl().setLookAt(((CraftEntity) entity).getHandle(), headRotationSpeed, maxHeadPitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void lookAt(double x, double y, double z) {
|
||||||
|
getHandle().getLookControl().setLookAt(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void lookAt(double x, double y, double z, float headRotationSpeed, float maxHeadPitch) {
|
||||||
|
getHandle().getLookControl().setLookAt(x, y, z, headRotationSpeed, maxHeadPitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHeadRotationSpeed() {
|
||||||
|
return getHandle().getHeadRotSpeed();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxHeadPitch() {
|
||||||
|
return getHandle().getMaxHeadXRot();
|
||||||
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue