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:
parent
aa4a072807
commit
aec70dca41
1 changed files with 12 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue