2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2016-03-01 00:09:49 +01:00
|
|
|
From: Byteflux <byte@byteflux.net>
|
|
|
|
Date: Mon, 29 Feb 2016 17:50:31 -0600
|
2016-03-25 10:02:35 +01:00
|
|
|
Subject: [PATCH] Entity Origin API
|
2016-03-01 00:09:49 +01:00
|
|
|
|
|
|
|
|
2016-03-25 10:02:35 +01:00
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
2021-02-21 20:45:33 +01:00
|
|
|
index 41a1bc45cc5eb7f19374115ade7f5328c7fc1dae..e9d0d507b47b0347b975b1a83f5ae70dca5587b8 100644
|
2016-03-25 10:02:35 +01:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Entity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
2021-02-21 20:45:33 +01:00
|
|
|
@@ -609,5 +609,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
|
|
|
default net.kyori.adventure.text.event.HoverEvent<net.kyori.adventure.text.event.HoverEvent.ShowEntity> asHoverEvent(final @NotNull java.util.function.UnaryOperator<net.kyori.adventure.text.event.HoverEvent.ShowEntity> op) {
|
|
|
|
return net.kyori.adventure.text.event.HoverEvent.showEntity(op.apply(net.kyori.adventure.text.event.HoverEvent.ShowEntity.of(this.getType().getKey(), this.getUniqueId(), this.customName())));
|
|
|
|
}
|
2016-03-25 10:02:35 +01:00
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 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
|
|
|
|
+ */
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @Nullable
|
2016-03-25 10:02:35 +01:00
|
|
|
+ Location getOrigin();
|
2021-02-21 20:45:33 +01:00
|
|
|
// Paper end
|
2016-03-25 10:02:35 +01:00
|
|
|
}
|
2016-03-01 00:09:49 +01:00
|
|
|
diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java
|
2020-05-06 11:48:49 +02:00
|
|
|
index 64f9d3fd870d65afd2ee9a85625b149163eee144..14cb0d770561151570ab4399ca5facff43076819 100644
|
2016-03-01 00:09:49 +01:00
|
|
|
--- a/src/main/java/org/bukkit/entity/FallingBlock.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/FallingBlock.java
|
2019-03-20 01:28:15 +01:00
|
|
|
@@ -54,4 +54,15 @@ public interface FallingBlock extends Entity {
|
2016-03-01 00:09:49 +01:00
|
|
|
* @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
|
2016-03-25 10:02:35 +01:00
|
|
|
+ * @deprecated replaced by {@link Entity#getOrigin()}
|
2016-03-01 00:09:49 +01:00
|
|
|
+ */
|
2016-03-25 10:02:35 +01:00
|
|
|
+ @Deprecated
|
2017-06-03 06:41:05 +02:00
|
|
|
+ default org.bukkit.Location getSourceLoc() {
|
|
|
|
+ return this.getOrigin();
|
|
|
|
+ }
|
2016-03-01 00:09:49 +01:00
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/TNTPrimed.java b/src/main/java/org/bukkit/entity/TNTPrimed.java
|
2020-10-26 16:02:55 +01:00
|
|
|
index a23cfdf66877f0a61eae700de084c76e6ee7b431..0813bd913c8fdb2001963ce3e82c07c2af105418 100644
|
2016-03-01 00:09:49 +01:00
|
|
|
--- a/src/main/java/org/bukkit/entity/TNTPrimed.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/TNTPrimed.java
|
2020-10-26 16:02:55 +01:00
|
|
|
@@ -53,4 +53,15 @@ public interface TNTPrimed extends Explosive {
|
|
|
|
* @param source the source of this primed TNT
|
2016-03-01 00:09:49 +01:00
|
|
|
*/
|
2020-10-26 16:02:55 +01:00
|
|
|
public void setSource(@Nullable Entity source);
|
2016-03-01 00:09:49 +01:00
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Gets the source block location of the TNTPrimed
|
|
|
|
+ *
|
|
|
|
+ * @return the source block location the TNTPrimed was spawned from
|
2016-03-25 10:02:35 +01:00
|
|
|
+ * @deprecated replaced by {@link Entity#getOrigin()}
|
2016-03-01 00:09:49 +01:00
|
|
|
+ */
|
2016-03-25 10:02:35 +01:00
|
|
|
+ @Deprecated
|
2017-06-03 06:41:05 +02:00
|
|
|
+ default org.bukkit.Location getSourceLoc() {
|
|
|
|
+ return this.getOrigin();
|
|
|
|
+ }
|
2016-03-01 00:09:49 +01:00
|
|
|
}
|