本文整理匯總了Java中org.bukkit.entity.EntityType.HORSE屬性的典型用法代碼示例。如果您正苦於以下問題:Java EntityType.HORSE屬性的具體用法?Java EntityType.HORSE怎麽用?Java EntityType.HORSE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.bukkit.entity.EntityType
的用法示例。
在下文中一共展示了EntityType.HORSE屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onMountPet
@EventHandler
public void onMountPet(VehicleEnterEvent event) {
if (event.getEntered().getType() != EntityType.PLAYER || event.getVehicle().getType() != EntityType.HORSE) {
return;
}
Player player = (Player) event.getEntered();
if (!InventoryManager.playerIsLoaded(player)) {
return;
}
Horse vehicle = (Horse) event.getVehicle();
if (PetManager.getPetFromEntity(vehicle, player) != null && player != vehicle.getOwner()) {
PlayerUtils.sendMessage(player, RPGInventory.getLanguage().getMessage("error.mount.owner", vehicle.getOwner().getName()));
event.setCancelled(true);
}
}
示例2: onEntitySpawn
@EventHandler
public void onEntitySpawn(CreatureSpawnEvent e) {
if (e.getEntityType().isAlive() && e.getEntityType() != EntityType.PLAYER
&& e.getEntityType() != EntityType.ZOMBIE && e.getEntityType() != EntityType.ENDERMAN
&& e.getEntityType() != EntityType.PIG && e.getEntityType() != EntityType.COW
&& e.getEntityType() != EntityType.SHEEP && e.getEntityType() != EntityType.HORSE
&& e.getEntityType() != EntityType.SQUID) {
e.setCancelled(true);
e.getLocation().getWorld().spawn(e.getLocation(), Zombie.class);
}
}
示例3: getType
public EntityType getType() {
return EntityType.HORSE;
}
示例4: isHorse
public boolean isHorse(Entity e) {
return e.getType() == EntityType.HORSE;
}