diff --git a/paper-api/src/main/java/org/bukkit/entity/Entity.java b/paper-api/src/main/java/org/bukkit/entity/Entity.java index d7f9586392..411297f665 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Entity.java +++ b/paper-api/src/main/java/org/bukkit/entity/Entity.java @@ -791,5 +791,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()))); } + + /** + * 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/paper-api/src/main/java/org/bukkit/entity/FallingBlock.java b/paper-api/src/main/java/org/bukkit/entity/FallingBlock.java index 5d7d940cda..315dcf9da2 100644 --- a/paper-api/src/main/java/org/bukkit/entity/FallingBlock.java +++ b/paper-api/src/main/java/org/bukkit/entity/FallingBlock.java @@ -126,4 +126,15 @@ public interface FallingBlock extends Entity { * @param damage the max damage to set. Must be >= 0 */ void setMaxDamage(int damage); + + /** + * 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/paper-api/src/main/java/org/bukkit/entity/TNTPrimed.java b/paper-api/src/main/java/org/bukkit/entity/TNTPrimed.java index a23cfdf668..0813bd913c 100644 --- a/paper-api/src/main/java/org/bukkit/entity/TNTPrimed.java +++ b/paper-api/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(); + } }