5b6dfb3463
This work is 100% unfinished. I am pushing it up so that we as a team can work on this update. Do not try to use this branch. You will fail.
69 lines
2.4 KiB
Diff
69 lines
2.4 KiB
Diff
From 6930a5ac9c5a9fba958a9d72769f6be40c406fd0 Mon Sep 17 00:00:00 2001
|
|
From: Byteflux <byte@byteflux.net>
|
|
Date: Mon, 29 Feb 2016 17:50:31 -0600
|
|
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 28b169d2..9b0f97f1 100644
|
|
--- a/src/main/java/org/bukkit/entity/Entity.java
|
|
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
|
@@ -497,4 +497,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable {
|
|
@Override
|
|
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 9d34e691..b0b1defc 100644
|
|
--- a/src/main/java/org/bukkit/entity/FallingBlock.java
|
|
+++ b/src/main/java/org/bukkit/entity/FallingBlock.java
|
|
@@ -52,4 +52,15 @@ public interface FallingBlock extends Entity {
|
|
* @param hurtEntities whether entities will be damaged by this block.
|
|
*/
|
|
void setHurtEntities(boolean hurtEntities);
|
|
+
|
|
+ /**
|
|
+ * 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
|
|
+ default org.bukkit.Location getSourceLoc() {
|
|
+ return this.getOrigin();
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/entity/TNTPrimed.java b/src/main/java/org/bukkit/entity/TNTPrimed.java
|
|
index fcd0a9b2..2abef57c 100644
|
|
--- a/src/main/java/org/bukkit/entity/TNTPrimed.java
|
|
+++ b/src/main/java/org/bukkit/entity/TNTPrimed.java
|
|
@@ -35,4 +35,15 @@ public interface TNTPrimed extends Explosive {
|
|
* @return the source of this primed TNT
|
|
*/
|
|
public Entity getSource();
|
|
+
|
|
+ /**
|
|
+ * 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
|
|
+ default org.bukkit.Location getSourceLoc() {
|
|
+ return this.getOrigin();
|
|
+ }
|
|
}
|
|
--
|
|
2.18.0
|
|
|