mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 03:25:15 +01:00
Implement World.getNearbyEntities
This commit is contained in:
parent
7d020a7041
commit
96c2c39245
@ -3,6 +3,7 @@ package org.bukkit.craftbukkit;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -703,6 +704,21 @@ public class CraftWorld implements World {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<Entity> getNearbyEntities(Location location, double x, double y, double z) {
|
||||||
|
if (location == null || !location.getWorld().equals(this)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
AxisAlignedBB bb = new AxisAlignedBB(location.getX() - x, location.getY() - y, location.getZ() - z, location.getX() + x, location.getY() + y, location.getZ() + z);
|
||||||
|
List<net.minecraft.server.Entity> entityList = getHandle().getEntities(null, bb);
|
||||||
|
List<Entity> bukkitEntityList = new ArrayList<org.bukkit.entity.Entity>(entityList.size());
|
||||||
|
for (Object entity : entityList) {
|
||||||
|
bukkitEntityList.add(((net.minecraft.server.Entity) entity).getBukkitEntity());
|
||||||
|
}
|
||||||
|
return bukkitEntityList;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Player> getPlayers() {
|
public List<Player> getPlayers() {
|
||||||
List<Player> list = new ArrayList<Player>();
|
List<Player> list = new ArrayList<Player>();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user