Add Entity Origin API
This replaces the TNT and Falling Block Source Location API with a more general purpose API that works with all entities.
This commit is contained in:
parent
a6a5b12b9e
commit
ced183982a
17 changed files with 253 additions and 344 deletions
|
@ -1,14 +1,34 @@
|
|||
From 77c518b68d30af9a16dee08c8352fdeb2c9ad371 Mon Sep 17 00:00:00 2001
|
||||
From b63b68858570e7fa3b29c47c4124fcc69bd87098 Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Mon, 29 Feb 2016 17:50:31 -0600
|
||||
Subject: [PATCH] FallingBlock and TNTPrimed source location API
|
||||
Subject: [PATCH] Entity Origin API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||
index 9f4d48b..b82d112 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -374,4 +374,15 @@ public interface Entity extends Metadatable, CommandSender {
|
||||
|
||||
Spigot spigot();
|
||||
// Spigot End
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the location where this entity originates from.
|
||||
+ * <p>
|
||||
+ * This value can be null if the entity hasn't yet been added to the world.
|
||||
+ *
|
||||
+ * @return Location where entity originates or null if not yet added
|
||||
+ */
|
||||
+ Location getOrigin();
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java
|
||||
index bc56fa2..ae9033c 100644
|
||||
index bc56fa2..360e149 100644
|
||||
--- a/src/main/java/org/bukkit/entity/FallingBlock.java
|
||||
+++ b/src/main/java/org/bukkit/entity/FallingBlock.java
|
||||
@@ -59,4 +59,11 @@ public interface FallingBlock extends Entity {
|
||||
@@ -59,4 +59,13 @@ public interface FallingBlock extends Entity {
|
||||
* @param hurtEntities whether entities will be damaged by this block.
|
||||
*/
|
||||
void setHurtEntities(boolean hurtEntities);
|
||||
|
@ -17,14 +37,16 @@ index bc56fa2..ae9033c 100644
|
|||
+ * Gets the source block location of the FallingBlock
|
||||
+ *
|
||||
+ * @return the source block location the FallingBlock was spawned from
|
||||
+ * @deprecated replaced by {@link Entity#getOrigin()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public org.bukkit.Location getSourceLoc();
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/TNTPrimed.java b/src/main/java/org/bukkit/entity/TNTPrimed.java
|
||||
index 3ce322d..74b82f9 100644
|
||||
index 3ce322d..69df487 100644
|
||||
--- a/src/main/java/org/bukkit/entity/TNTPrimed.java
|
||||
+++ b/src/main/java/org/bukkit/entity/TNTPrimed.java
|
||||
@@ -35,4 +35,11 @@ public interface TNTPrimed extends Explosive {
|
||||
@@ -35,4 +35,13 @@ public interface TNTPrimed extends Explosive {
|
||||
* @return the source of this primed TNT
|
||||
*/
|
||||
public Entity getSource();
|
||||
|
@ -33,7 +55,9 @@ index 3ce322d..74b82f9 100644
|
|||
+ * Gets the source block location of the TNTPrimed
|
||||
+ *
|
||||
+ * @return the source block location the TNTPrimed was spawned from
|
||||
+ * @deprecated replaced by {@link Entity#getOrigin()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public org.bukkit.Location getSourceLoc();
|
||||
}
|
||||
--
|
Loading…
Add table
Add a link
Reference in a new issue