Paper/patches/api/0285-Add-Mob-lookAt-API.patch
Nassim Jahnke 71c84c8132
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
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:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD

CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor

Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00

100 lines
3.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Fri, 14 May 2021 13:42:06 -0500
Subject: [PATCH] Add Mob#lookAt API
diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java
index 7eee2e561346ac1d672f9652edb78e76c910fc9d..11b6d1aba7d1f6ae1f3c822193486f5a1478e105 100644
--- a/src/main/java/org/bukkit/entity/Mob.java
+++ b/src/main/java/org/bukkit/entity/Mob.java
@@ -27,6 +27,88 @@ public interface Mob extends LivingEntity, Lootable {
* @return True if mob is exposed to daylight
*/
boolean isInDaylight();
+
+ /**
+ * Instruct this Mob to look at a specific Location
+ * <p>
+ * Useful when implementing custom mob goals
+ *
+ * @param location location to look at
+ */
+ void lookAt(@NotNull org.bukkit.Location location);
+
+ /**
+ * Instruct this Mob to look at a specific Location
+ * <p>
+ * Useful when implementing custom mob goals
+ *
+ * @param location location to look at
+ * @param headRotationSpeed head rotation speed
+ * @param maxHeadPitch max head pitch rotation
+ */
+ void lookAt(@NotNull org.bukkit.Location location, float headRotationSpeed, float maxHeadPitch);
+
+ /**
+ * Instruct this Mob to look at a specific Entity
+ * <p>
+ * If a LivingEntity, look at eye location
+ * <p>
+ * Useful when implementing custom mob goals
+ *
+ * @param entity entity to look at
+ */
+ void lookAt(@NotNull Entity entity);
+
+ /**
+ * Instruct this Mob to look at a specific Entity
+ * <p>
+ * If a LivingEntity, look at eye location
+ * <p>
+ * Useful when implementing custom mob goals
+ *
+ * @param entity entity to look at
+ * @param headRotationSpeed head rotation speed
+ * @param maxHeadPitch max head pitch rotation
+ */
+ void lookAt(@NotNull Entity entity, float headRotationSpeed, float maxHeadPitch);
+
+ /**
+ * Instruct this Mob to look at a specific position
+ * <p>
+ * Useful when implementing custom mob goals
+ *
+ * @param x x coordinate
+ * @param y y coordinate
+ * @param z z coordinate
+ */
+ void lookAt(double x, double y, double z);
+
+ /**
+ * Instruct this Mob to look at a specific position
+ * <p>
+ * Useful when implementing custom mob goals
+ *
+ * @param x x coordinate
+ * @param y y coordinate
+ * @param z z coordinate
+ * @param headRotationSpeed head rotation speed
+ * @param maxHeadPitch max head pitch rotation
+ */
+ void lookAt(double x, double y, double z, float headRotationSpeed, float maxHeadPitch);
+
+ /**
+ * Gets the head rotation speed
+ *
+ * @return the head rotation speed
+ */
+ int getHeadRotationSpeed();
+
+ /**
+ * Gets the max head pitch rotation
+ *
+ * @return the max head pitch rotation
+ */
+ int getMaxHeadPitch();
// Paper end
/**
* Instructs this Mob to set the specified LivingEntity as its target.