mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 12:36:07 +01:00
ef0e5a642d
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: 9ae3f10f SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API 48c0c547 PR-786: Add methods to get sounds from entities CraftBukkit Changes: 5cc9c022a SPIGOT-7152: Handle hand item changing during air interact event 4ffa1acf6 SPIGOT-7154: Players get kicked when interacting with a conversation 4daa21123 SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API e5d6a9bbf PR-1100: Add methods to get sounds from entities b7e9f1c8b SPIGOT-7146: Reduce use of Material switch in ItemMeta Spigot Changes: 4c157bb4 Rebuild patches
49 lines
2.0 KiB
Diff
49 lines
2.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: TwoLeggedCat <80929284+TwoLeggedCat@users.noreply.github.com>
|
|
Date: Sat, 29 May 2021 14:33:18 -0500
|
|
Subject: [PATCH] Add more line of sight methods
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java
|
|
index aa534b1a9a1fb84a2fbd4b372f313bb4b63325fa..43b53c21af01e0f496c8aaacff82dfdfadaf40f6 100644
|
|
--- a/src/main/java/org/bukkit/RegionAccessor.java
|
|
+++ b/src/main/java/org/bukkit/RegionAccessor.java
|
|
@@ -392,5 +392,13 @@ public interface RegionAccessor extends Keyed { // Paper
|
|
@NotNull
|
|
@Override
|
|
NamespacedKey getKey();
|
|
+
|
|
+ /**
|
|
+ * Tell whether a line of sight exists between the given locations
|
|
+ * @param from Location to start at
|
|
+ * @param to target Location
|
|
+ * @return whether a line of sight exists between {@code from} and {@code to}
|
|
+ */
|
|
+ public boolean lineOfSightExists(@NotNull Location from, @NotNull Location to);
|
|
// Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
|
index a6c0b5e55adadd78619d251d979e9e46068a637e..d47706a915ae1bfaa3187a83cb6d35ea202c03d0 100644
|
|
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
|
@@ -484,6 +484,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
|
*/
|
|
public boolean hasLineOfSight(@NotNull Entity other);
|
|
|
|
+ // Paper start
|
|
+ /**
|
|
+ * Checks whether the living entity has block line of sight to the given block.
|
|
+ * <p>
|
|
+ * This uses the same algorithm that hostile mobs use to find the closest
|
|
+ * player.
|
|
+ *
|
|
+ * @param location the location to determine line of sight to
|
|
+ * @return true if there is a line of sight, false if not
|
|
+ */
|
|
+ public boolean hasLineOfSight(@NotNull Location location);
|
|
+ // Paper end
|
|
+
|
|
/**
|
|
* Returns if the living entity despawns when away from players or not.
|
|
* <p>
|