geforkt von Mirrors/Paper
18f0f8d1ca
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 312281ea PR-742: Make World implement Keyed CraftBukkit Changes: 2ac7fa7a SPIGOT-7014: getLootTable API should not persistently update loot table 7fdd7941 PR-1046: Make World implement Keyed 7bc728a6 PR-1045: Revert changes to persistence required checks Spigot Changes: b6d12d17 Rebuild patches
65 Zeilen
3.2 KiB
Diff
65 Zeilen
3.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: BillyGalbreath <blake.galbreath@gmail.com>
|
|
Date: Fri, 14 May 2021 13:42:17 -0500
|
|
Subject: [PATCH] Add Mob#lookAt API
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
|
index 881bb11507eafe87522ad4131ea7859f42918b3e..d9008049188c1933f2b6b39b9219983ff947b4bf 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
|
@@ -82,5 +82,53 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
|
|
public boolean isInDaylight() {
|
|
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
|
|
}
|