本文整理汇总了Java中org.bukkit.World.getLivingEntities方法的典型用法代码示例。如果您正苦于以下问题:Java World.getLivingEntities方法的具体用法?Java World.getLivingEntities怎么用?Java World.getLivingEntities使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.World
的用法示例。
在下文中一共展示了World.getLivingEntities方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkAndCleanMobFarm
import org.bukkit.World; //导入方法依赖的package包/类
private void checkAndCleanMobFarm() {
for (World world : Bukkit.getWorlds()) {
for (LivingEntity entity : world.getLivingEntities()) {
if (entity instanceof Monster || entity instanceof Animals || entity instanceof Villager || entity.getType() == EntityType.SQUID) {
if (NeverLagUtils.checkCustomNpc(entity)) {
continue;
}
if (this.getNearbyEntityCount(entity, false) >= cm.mobCollisionLargeLimit || this.getNearbyEntityCount(entity, true) >= cm.mobCollisionSmallLimit) {
entity.remove();
}
}
}
}
}
示例2: countTotalEntity
import org.bukkit.World; //导入方法依赖的package包/类
private void countTotalEntity() {
int count = 0;
for (World world : Bukkit.getWorlds()) {
for (LivingEntity entity : world.getLivingEntities()) {
if (entity instanceof Monster || entity instanceof Animals || entity instanceof Villager || entity.getType() == EntityType.SQUID || entity.getType() == EntityType.BAT) {
count++;
}
}
}
this.cachedMobCount = count;
this.lastCountTime = System.currentTimeMillis();
}