2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 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
|
2023-04-09 02:00:50 +02:00
|
|
|
index 598abaa82c634178043a29f6caa6ac5221659d06..70a32f89c16439c575d8928332cfed64d1d6ab7e 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Entity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
2023-04-09 02:00:50 +02:00
|
|
|
@@ -725,5 +725,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
2021-06-11 14:02:28 +02:00
|
|
|
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())));
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 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
|
|
|
|
+ */
|
|
|
|
+ @Nullable
|
|
|
|
+ Location getOrigin();
|
|
|
|
// Paper end
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java
|
2023-07-04 10:22:56 +02:00
|
|
|
index d96fd494b523491fcf1ac54d164351fd487f65d6..ae1ce2ee2deb82f3f4144ec54b3ba119b437c5e9 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/entity/FallingBlock.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/FallingBlock.java
|
2023-07-04 10:22:56 +02:00
|
|
|
@@ -126,4 +126,15 @@ public interface FallingBlock extends Entity {
|
2023-04-14 01:52:42 +02:00
|
|
|
* @param damage the max damage to set. Must be >= 0
|
2021-06-11 14:02:28 +02:00
|
|
|
*/
|
2023-04-14 01:52:42 +02:00
|
|
|
void setMaxDamage(int damage);
|
2021-06-11 14:02:28 +02:00
|
|
|
+
|
2023-04-14 01:52:42 +02:00
|
|
|
+ /**
|
2021-06-11 14:02:28 +02:00
|
|
|
+ * 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 a23cfdf66877f0a61eae700de084c76e6ee7b431..0813bd913c8fdb2001963ce3e82c07c2af105418 100644
|
|
|
|
--- a/src/main/java/org/bukkit/entity/TNTPrimed.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/TNTPrimed.java
|
|
|
|
@@ -53,4 +53,15 @@ public interface TNTPrimed extends Explosive {
|
|
|
|
* @param source the source of this primed TNT
|
|
|
|
*/
|
|
|
|
public void setSource(@Nullable Entity source);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 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();
|
|
|
|
+ }
|
|
|
|
}
|