Fix some NPE for EntityCompostItemEvent (#9169)

This commit is contained in:
Lulu13022002 2023-05-03 13:07:51 +02:00 committed by GitHub
parent 83da4b6101
commit 9846d0d89e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 23 deletions

View file

@ -6,20 +6,20 @@ Subject: [PATCH] More Teleport API
diff --git a/src/main/java/io/papermc/paper/entity/LookAnchor.java b/src/main/java/io/papermc/paper/entity/LookAnchor.java
new file mode 100644
index 0000000000000000000000000000000000000000..7713a5b7e06da185685f18e79eae2c972e588696
index 0000000000000000000000000000000000000000..c8312691c27ae436029ec5011ddf073582b12cba
--- /dev/null
+++ b/src/main/java/io/papermc/paper/entity/LookAnchor.java
@@ -0,0 +1,25 @@
+package io.papermc.paper.entity;
+
+import org.bukkit.Location;
+import io.papermc.paper.math.Position;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.LivingEntity;
+
+/**
+ * Represents what part of the entity should be used when determining where to face a location/entity.
+ * Represents what part of the entity should be used when determining where to face a position/entity.
+ *
+ * @see org.bukkit.entity.Player#lookAt(Location, LookAnchor)
+ * @see org.bukkit.entity.Player#lookAt(Position, LookAnchor)
+ * @see org.bukkit.entity.Player#lookAt(Entity, LookAnchor, LookAnchor)
+ */
+@org.jetbrains.annotations.ApiStatus.Experimental
@ -165,7 +165,7 @@ index ab0ceaba9ddcbe20a8b8a1fc3ed19cb3c64ecd3d..97f0bc6573c8ba09de77061b6312b91c
* Teleports this entity to the given location. If this entity is riding a
* vehicle, it will be dismounted prior to teleportation.
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 2e1bd95fdce4571cb9d288e4dea495126834ee31..51e427992bc673b733971c34bb9f0df7c26ba653 100644
index 2e1bd95fdce4571cb9d288e4dea495126834ee31..84b79db95c433a469e972e6dfec8e2c5ee8ce9ce 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2840,6 +2840,49 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@ -194,10 +194,10 @@ index 2e1bd95fdce4571cb9d288e4dea495126834ee31..51e427992bc673b733971c34bb9f0df7
+ void lookAt(double x, double y, double z, @NotNull io.papermc.paper.entity.LookAnchor playerAnchor);
+
+ /**
+ * Causes the player to look towards the given location.
+ * Causes the player to look towards the given position.
+ *
+ * @param position Position to look at in the player's current world
+ * @param playerAnchor What part of player should face the location
+ * @param playerAnchor What part of the player should face the given position
+ */
+ @org.jetbrains.annotations.ApiStatus.Experimental
+ default void lookAt(@NotNull io.papermc.paper.math.Position position, @NotNull io.papermc.paper.entity.LookAnchor playerAnchor) {