本文整理汇总了Java中org.bukkit.entity.LivingEntity.isDead方法的典型用法代码示例。如果您正苦于以下问题:Java LivingEntity.isDead方法的具体用法?Java LivingEntity.isDead怎么用?Java LivingEntity.isDead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.LivingEntity
的用法示例。
在下文中一共展示了LivingEntity.isDead方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: autoCheck
import org.bukkit.entity.LivingEntity; //导入方法依赖的package包/类
private void autoCheck(Player player)
{
LivingEntity[] livingEntities = this.balloons.get(player.getUniqueId());
if (livingEntities == null)
return;
for (LivingEntity livingEntity : livingEntities)
{
if (livingEntity.isDead() || !livingEntity.isLeashed())
{
this.hub.getCosmeticManager().getBalloonManager().disableCosmetic(player, this, false, false);
break ;
}
}
}
示例2: goPetToPlayer
import org.bukkit.entity.LivingEntity; //导入方法依赖的package包/类
public static void goPetToPlayer(final Player player, final LivingEntity entity) {
if (!InventoryManager.playerIsLoaded(player) || !player.isOnline() || entity.isDead()) {
return;
}
Location target = player.getLocation();
if (target.distance(entity.getLocation()) > 20) {
PetManager.respawnPet(player);
} else if (target.distance(entity.getLocation()) < 4) {
return;
}
PetType petType = PetManager.getPetFromEntity(entity, player);
double speedModifier = petType == null ? 1.0 : 0.4 / petType.getSpeed();
Class<?> entityInsentientClass = MinecraftReflection.getMinecraftClass("EntityInsentient");
Class<?> navigationAbstractClass = MinecraftReflection.getMinecraftClass("NavigationAbstract");
try {
Method getHandle = MinecraftReflection.getCraftEntityClass().getDeclaredMethod("getHandle");
Object insentient = entityInsentientClass.cast(getHandle.invoke(entity));
Object navigation = entityInsentientClass.getDeclaredMethod("getNavigation").invoke(insentient);
navigationAbstractClass.getDeclaredMethod("a", double.class, double.class, double.class, double.class)
.invoke(navigation, target.getX(), target.getY(), target.getZ(), speedModifier);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
e.printStackTrace();
}
}
示例3: isValid
import org.bukkit.entity.LivingEntity; //导入方法依赖的package包/类
@Override
public boolean isValid(LivingEntity key) {
return key != null && !key.isDead();
}