Paper/Spigot-API-Patches/0007-Entity-Origin-API.patch

68 lines
2.5 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2016-02-29 23:09:49 +00:00
From: Byteflux <byte@byteflux.net>
Date: Mon, 29 Feb 2016 17:50:31 -0600
Subject: [PATCH] Entity Origin API
2016-02-29 23:09:49 +00:00
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 6b550dda2a107d08553544261f26c08b6cdfa648..4e4445d186303c06906fea68a867cc7985c69ba2 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 93e39ce1 Clarify documentation regarding getMaterial with legacyName = true c3aeaea0 Improve dependency tracker 14c9d275 Add support for transitive depends in load access warning c8afe560 SPIGOT-5526: Add EntityEnterBlockEvent 6bb6f07d SPIGOT-5548: Show error that hints towards plugins misusing reflection ed75537d SPIGOT-5546: Fix bad depend access using wrong provider in message 4e4c0ee9 Fix buggy classloader warning triggering for all classes 89586a4c Print warning when loading classes from depends that have not been specified d4fe9680 Fix bug where disablePlugin could remove ConfigurationSerializable classes from other plugins 85e683b7 Add additional checkstyle checks 612fd8e1 Correct max page count in BookMeta docs fa8a9781 Correct max title length in BookMeta docs CraftBukkit Changes: ab13a117 SPIGOT-5550: Cancelled ProjectileLaunchEvent still plays sound for eggs 44016b1d SPIGOT-5538: Using javaw to run GUI prints input error e653ae76 SPIGOT-5526: Call EntityEnterBlockEvent for bees trying to enter hives 6515ea49 SPIGOT-5537: Bee nests generated by growing trees near flower have no bees d82b3149 Remove unused CraftWorld.getId method 10763a88 Change some block == AIR checks to isAir to catch CAVE_AIR Spigot Changes: f2c1cd15 Rebuild patches bcd458ad Reformat patches
2020-01-28 19:43:57 +00:00
@@ -598,4 +598,16 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
2017-05-15 16:25:20 +00:00
@Override
Spigot spigot();
2017-05-15 16:25:20 +00:00
// 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
+ */
+ @Nullable
+ Location getOrigin();
+ // Paper end
}
2016-02-29 23:09:49 +00:00
diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java
index 64f9d3fd870d65afd2ee9a85625b149163eee144..14cb0d770561151570ab4399ca5facff43076819 100644
2016-02-29 23:09:49 +00:00
--- a/src/main/java/org/bukkit/entity/FallingBlock.java
+++ b/src/main/java/org/bukkit/entity/FallingBlock.java
@@ -54,4 +54,15 @@ public interface FallingBlock extends Entity {
2016-02-29 23:09:49 +00: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
+ * @deprecated replaced by {@link Entity#getOrigin()}
2016-02-29 23:09:49 +00:00
+ */
+ @Deprecated
2017-06-03 04:41:05 +00:00
+ default org.bukkit.Location getSourceLoc() {
+ return this.getOrigin();
+ }
2016-02-29 23:09:49 +00:00
}
diff --git a/src/main/java/org/bukkit/entity/TNTPrimed.java b/src/main/java/org/bukkit/entity/TNTPrimed.java
index 5a87893248d9cbeb7c431590e726fcb0f69f930d..3022b4a270e66c4654193c96faf35bee817e648a 100644
2016-02-29 23:09:49 +00:00
--- a/src/main/java/org/bukkit/entity/TNTPrimed.java
+++ b/src/main/java/org/bukkit/entity/TNTPrimed.java
@@ -39,4 +39,15 @@ public interface TNTPrimed extends Explosive {
2016-02-29 23:09:49 +00:00
*/
@Nullable
2016-02-29 23:09:49 +00:00
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()}
2016-02-29 23:09:49 +00:00
+ */
+ @Deprecated
2017-06-03 04:41:05 +00:00
+ default org.bukkit.Location getSourceLoc() {
+ return this.getOrigin();
+ }
2016-02-29 23:09:49 +00:00
}