mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-01 04:31:58 +01:00
9df2066642
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: dfe1fb48 PR-906: Add missing MinecraftExperimental annotation to Bundles 825ab30d PR-905: Add missing MapCursor.Type and update documentation e03d10e6 PR-903: Make BARRIER Waterlogged 1961ead6 PR-898: Use Java Consumer instead of Bukkit Consumer CraftBukkit Changes: f71a799f0 Make BARRIER Waterlogged 172f76a45 Upgrade specialsource-maven-plugin f0702775c SPIGOT-7486: Alternate approach to null profile names 069495671 SPIGOT-7485: Allow air entity items since required for Vanilla logic 5dfd33dc2 SPIGOT-7484: Cancelling PlayerEditBookEvent does not update client's book contents 02d490788 PR-1250: Standardize and centralize Bukkit / Minecraft registry conversion 9024a09b9 PR-1251: Use Java Consumer instead of Bukkit Consumer 6d4b25bf1 Increase diff stability
48 lines
2 KiB
Diff
48 lines
2 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 58b81f30f9e29ab481ae96c7eea40ad976a4b192..63503cf17847a85264c930a9fc23a5aab5955c3c 100644
|
|
--- a/src/main/java/org/bukkit/RegionAccessor.java
|
|
+++ b/src/main/java/org/bukkit/RegionAccessor.java
|
|
@@ -437,5 +437,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 9763cf4720e1278061e3ba139b824147e9540945..b665b99ca6de3a35c3296a500db1527a8513a711 100644
|
|
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
|
@@ -570,6 +570,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>
|