Deprecate TargetBlock/EntityInfo and assocated methods (#7381)

This commit is contained in:
Jake Potrebic 2022-12-15 09:10:03 -08:00 committed by GitHub
parent 3aec8630bb
commit 0262de0ddb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 158 additions and 110 deletions

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Add LivingEntity#getTargetEntity
diff --git a/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java b/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java
new file mode 100644
index 0000000000000000000000000000000000000000..f52644fab1522bdf83ff4f489e9805b274421094
index 0000000000000000000000000000000000000000..af8765b213390cf75fe02a6eb68aecf7a06d5acf
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java
@@ -0,0 +1,38 @@
@@ -0,0 +1,40 @@
+package com.destroystokyo.paper.entity;
+
+import org.bukkit.entity.Entity;
@ -18,7 +18,9 @@ index 0000000000000000000000000000000000000000..f52644fab1522bdf83ff4f489e9805b2
+
+/**
+ * Represents information about a targeted entity
+ * @deprecated use {@link org.bukkit.util.RayTraceResult}
+ */
+@Deprecated(forRemoval = true)
+public class TargetEntityInfo {
+ private final Entity entity;
+ private final Vector hitVec;
@ -49,11 +51,11 @@ index 0000000000000000000000000000000000000000..f52644fab1522bdf83ff4f489e9805b2
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index c29846df0469535870e1743eee25325a4f092a6d..63b39fe0f2c8c529e289c69969588a98dd7fc758 100644
index 70c0512a5875533c9b8ce7a1b21cc799772c5ef4..98484c748db12dbdcdbe456befa30ad87864420b 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -152,6 +152,50 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
*/
@@ -173,6 +173,77 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
@Deprecated(forRemoval = true)
@Nullable
public com.destroystokyo.paper.block.TargetBlockInfo getTargetBlockInfo(int maxDistance, @NotNull com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode);
+
@ -84,7 +86,9 @@ index c29846df0469535870e1743eee25325a4f092a6d..63b39fe0f2c8c529e289c69969588a98
+ * @param maxDistance this is the maximum distance to scan
+ * @return TargetEntityInfo about the entity being targeted,
+ * or null if no entity is targeted
+ * @deprecated use {@link #rayTraceEntities(int)}
+ */
+ @Deprecated(forRemoval = true)
+ @Nullable
+ public default com.destroystokyo.paper.entity.TargetEntityInfo getTargetEntityInfo(int maxDistance) {
+ return getTargetEntityInfo(maxDistance, false);
@ -94,12 +98,37 @@ index c29846df0469535870e1743eee25325a4f092a6d..63b39fe0f2c8c529e289c69969588a98
+ * Gets information about the entity being targeted
+ *
+ * @param maxDistance this is the maximum distance to scan
+ * @param ignoreBlocks true to scan through blocks
+ * @return TargetEntityInfo about the entity being targeted,
+ * @return RayTraceResult about the entity being targeted,
+ * or null if no entity is targeted
+ */
+ @Nullable
+ default RayTraceResult rayTraceEntities(int maxDistance) {
+ return this.rayTraceEntities(maxDistance, false);
+ }
+
+ /**
+ * Gets information about the entity being targeted
+ *
+ * @param maxDistance this is the maximum distance to scan
+ * @param ignoreBlocks true to scan through blocks
+ * @return TargetEntityInfo about the entity being targeted,
+ * or null if no entity is targeted
+ * @deprecated use {@link #rayTraceEntities(int, boolean)}
+ */
+ @Deprecated(forRemoval = true)
+ @Nullable
+ public com.destroystokyo.paper.entity.TargetEntityInfo getTargetEntityInfo(int maxDistance, boolean ignoreBlocks);
+
+ /**
+ * Gets information about the entity being targeted
+ *
+ * @param maxDistance this is the maximum distance to scan
+ * @param ignoreBlocks true to scan through blocks
+ * @return RayTraceResult about the entity being targeted,
+ * or null if no entity is targeted
+ */
+ @Nullable
+ RayTraceResult rayTraceEntities(int maxDistance, boolean ignoreBlocks);
// Paper end
/**