Paper/Spigot-API-Patches/0118-Entity-getChunk-API.patch
Spottedleaf c68dbb864c Updated Upstream (Bukkit/CraftBukkit/Spigot) (#2576)
* 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:
6527cb58 SPIGOT-5329: Clarify isGlowing documentation
5ddb414f Make Lantern extend BlockData
cb888903 Fix typos in previous commits
2a5e0ca2 Bring EnchantItemEvent documentation in line with EnchantmentOffer
3c5fcea2 SPIGOT-5317: Create accessors for player absorption hearts
c6e0d625 SPIGOT-5320: Clarify scope of ExactChoice

CraftBukkit Changes:
a3fdef8c SPIGOT-5331: Add support for Java 13
6ddeb980 SPIGOT-5317: Create accessors for player absorption hearts
5d335e96 SPIGOT-5315: Cannot serialize armor stand ItemMeta

Spigot Changes:
94af569b SPIGOT-5319: Async catcher for getNearbyEntities
2019-09-21 23:12:45 -05:00

37 lines
1.1 KiB
Diff

From aad3f10a51d870c9362a602a3dad7e9472880a8d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 4 Jul 2018 02:25:48 -0400
Subject: [PATCH] Entity#getChunk API
Get the chunk the entity is currently registered to
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index ade1bf5f1..5a7776fa4 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -3,6 +3,7 @@ package org.bukkit.entity;
import java.util.List;
import java.util.Set;
import java.util.UUID;
+import org.bukkit.Chunk; // Paper
import org.bukkit.EntityEffect;
import org.bukkit.Location;
import org.bukkit.Nameable;
@@ -630,5 +631,13 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
* @return True if entity spawned from a mob spawner
*/
boolean fromMobSpawner();
+
+ /**
+ * Gets the latest chunk an entity is currently or was in.
+ *
+ * @return The current, or most recent chunk if the entity is invalid (which may load the chunk)
+ */
+ @NotNull
+ Chunk getChunk();
// Paper end
}
--
2.22.1