1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-02-16 18:31:53 +01:00

Entity#getChunk API

Get the chunk the entity is currently registered to
This commit is contained in:
Aikar 2018-07-04 02:25:48 -04:00
parent aa4a072807
commit aec70dca41

View file

@ -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;
@ -812,5 +813,16 @@ 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
default Chunk getChunk() {
// TODO remove impl here
return getLocation().getChunk();
}
// Paper end
}