类org.bukkit.entity.Ocelot源码实例Demo

下面列出了怎么用org.bukkit.entity.Ocelot的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: SonarPet   文件: EntityOcelotPet.java
@Override
public void initiateEntityPet() {
    super.initiateEntityPet();
    getBukkitEntity().setTamed(true);
    getBukkitEntity().setCatType(Ocelot.Type.BLACK_CAT);
    getBukkitEntity().setOwner(getPlayerOwner());
}
 
源代码2 项目: Shopkeepers   文件: CatShop.java
@Override
protected void load(ConfigurationSection config) {
	super.load(config);
	String catTypeName = config.getString("catType");
	try {
		catType = Ocelot.Type.valueOf(catTypeName);
	} catch (Exception e) {
	}
}
 
源代码3 项目: Shopkeepers   文件: CatShop.java
private short getSubItemData(Ocelot.Type catType) {
	switch (catType) {
	case BLACK_CAT:
		return DyeColor.BLACK.getWoolData();
	case RED_CAT:
		return DyeColor.RED.getWoolData();
	case SIAMESE_CAT:
		return DyeColor.SILVER.getWoolData();

	case WILD_OCELOT:
	default:
		return DyeColor.ORANGE.getWoolData();
	}
}
 
源代码4 项目: EntityAPI   文件: ControllableCreeperBase.java
@Override
public BehaviourItem[] getDefaultTargetingBehaviours() {
    return new BehaviourItem[]{
            new BehaviourItem(1, new BehaviourFloat(this)),
            new BehaviourItem(2, new BehaviourSwell(this)),
            new BehaviourItem(3, new BehaviourAvoidEntity(this, Ocelot.class, 6.0F, 1.0D, 1.2D)),
            new BehaviourItem(4, new BehaviourMeleeAttack(this, false, 1.0D)),
            new BehaviourItem(5, new BehaviourRandomStroll(this, 0.8D)),
            new BehaviourItem(6, new BehaviourLookAtNearestEntity(this, HumanEntity.class, 8F)),
            new BehaviourItem(7, new BehaviourLookAtRandom(this))
    };
}
 
源代码5 项目: StackMob-3   文件: BukkitCompat.java
@Override
public boolean checkFood(Entity entity, ItemStack food) {
    Material type = food.getType();
    switch (entity.getType()) {
        case COW:
        case SHEEP:
        case MUSHROOM_COW:
            return type == Material.WHEAT;
        case PIG:
            return (type == Material.CARROT || type == Material.BEETROOT || type == Material.POTATO);
        case CHICKEN:
            return type == Material.WHEAT_SEEDS
                    || type == Material.MELON_SEEDS
                    || type == Material.BEETROOT_SEEDS
                    || type == Material.PUMPKIN_SEEDS;
        case HORSE:
            return (type == Material.GOLDEN_APPLE || type == Material.GOLDEN_CARROT) && ((Horse)entity).isTamed();
        case WOLF:
            return (type == Material.BEEF
                    || type == Material.CHICKEN
                    || type == Material.COD
                    || type == Material.MUTTON
                    || type == Material.PORKCHOP
                    || type == Material.RABBIT
                    || type == Material.SALMON
                    || type == Material.COOKED_BEEF
                    || type == Material.COOKED_CHICKEN
                    || type == Material.COOKED_COD
                    || type == Material.COOKED_MUTTON
                    || type == Material.COOKED_PORKCHOP
                    || type == Material.COOKED_RABBIT
                    || type == Material.COOKED_SALMON)
                    && ((Wolf) entity).isTamed();
        case OCELOT:
            return (type == Material.SALMON
                    || type == Material.COD
                    || type == Material.PUFFERFISH
                    || type == Material.TROPICAL_FISH)
                    && ((Ocelot) entity).isTamed();
        case RABBIT:
            return type == Material.CARROT || type == Material.GOLDEN_CARROT || type == Material.DANDELION;
        case LLAMA:
            return type == Material.HAY_BLOCK;
        case TURTLE:
            return type == Material.SEAGRASS;
    }
    return false;
}
 
源代码6 项目: Skript   文件: OcelotData.java
@Override
protected boolean init(final @Nullable Class<? extends Ocelot> c, final @Nullable Ocelot e) {
	if (TAMEABLE)
		tamed = e == null ? 0 : ((Tameable) e).isTamed() ? 1 : -1;
	return true;
}
 
源代码7 项目: Skript   文件: OcelotData.java
@Override
public void set(final Ocelot entity) {
	if (TAMEABLE) {
		((Tameable) entity).setTamed(tamed != 0);
	}
}
 
源代码8 项目: Skript   文件: OcelotData.java
@Override
protected boolean match(final Ocelot entity) {
	return tamed == 0 || ((Tameable) entity).isTamed() == (tamed == 1);
}
 
源代码9 项目: Skript   文件: OcelotData.java
@Override
public Class<? extends Ocelot> getType() {
	return Ocelot.class;
}
 
源代码10 项目: SonarPet   文件: EntityOcelotPet.java
@Override
public void setCatType(int type) {
    getBukkitEntity().setCatType(Ocelot.Type.getType(type));
}
 
源代码11 项目: SonarPet   文件: EntityOcelotPet.java
@Override
public Ocelot getBukkitEntity() {
    return (Ocelot) super.getBukkitEntity();
}
 
源代码12 项目: DungeonsXL   文件: DMobType.java
@Override
public Entity toEntity(Location loc) {
    World world = loc.getWorld();
    GameWorld gameWorld = plugin.getGameWorld(world);
    if (gameWorld == null) {
        return null;
    }
    LivingEntity entity = (LivingEntity) world.spawnEntity(loc, type);

    /* Set the Items */
    entity.getEquipment().setItemInHand(itemHand);
    entity.getEquipment().setHelmet(itemHelmet);
    entity.getEquipment().setChestplate(itemChestplate);
    entity.getEquipment().setLeggings(itemLeggings);
    entity.getEquipment().setBoots(itemBoots);

    /* Check mob specified stuff */
    if (type == EntityType.SKELETON) {
        if (witherSkeleton) {
            ((Skeleton) entity).setSkeletonType(SkeletonType.WITHER);
        } else {
            ((Skeleton) entity).setSkeletonType(SkeletonType.NORMAL);
        }
    }

    if (type == EntityType.OCELOT) {
        Ocelot ocelot = (Ocelot) entity;
        if (EnumUtil.isValidEnum(Ocelot.Type.class, ocelotType.toUpperCase())) {
            ocelot.setCatType(Ocelot.Type.valueOf(ocelotType.toUpperCase()));
        }
    }

    /* Set Health */
    if (maxHealth > 0) {
        entity.setMaxHealth(maxHealth);
        entity.setHealth(maxHealth);
    }

    /* Disable Despawning */
    entity.setRemoveWhenFarAway(false);

    /* Spawn Mob */
    new DMob(entity, gameWorld, this);
    return entity;
}
 
源代码13 项目: PetMaster   文件: PlayerInteractListener.java
/**
 * Displays a hologram, and automatically delete it after a given delay.
 * 
 * @param player
 * @param owner
 * @param tameable
 */
@SuppressWarnings("deprecation")
private void displayHologramAndMessage(Player player, AnimalTamer owner, Tameable tameable) {
	if (hologramMessage) {
		double offset = HORSE_OFFSET;
		if (tameable instanceof Ocelot || version >= 14 && tameable instanceof Cat) {
			if (!displayCat || !player.hasPermission("petmaster.showowner.cat")) {
				return;
			}
			offset = CAT_OFFSET;
		} else if (tameable instanceof Wolf) {
			if (!displayDog || !player.hasPermission("petmaster.showowner.dog")) {
				return;
			}
			offset = DOG_OFFSET;
		} else if (version >= 11 && tameable instanceof Llama) {
			if (!displayLlama || !player.hasPermission("petmaster.showowner.llama")) {
				return;
			}
			offset = LLAMA_OFFSET;
		} else if (version >= 12 && tameable instanceof Parrot) {
			if (!displayParrot || !player.hasPermission("petmaster.showowner.parrot")) {
				return;
			}
			offset = PARROT_OFFSET;
		} else if (!displayHorse || !player.hasPermission("petmaster.showowner.horse")) {
			return;
		}

		Location eventLocation = tameable.getLocation();
		// Create location with offset.
		Location hologramLocation = new Location(eventLocation.getWorld(), eventLocation.getX(),
				eventLocation.getY() + offset, eventLocation.getZ());

		final Hologram hologram = HologramsAPI.createHologram(plugin, hologramLocation);
		hologram.appendTextLine(
				ChatColor.GRAY + plugin.getPluginLang().getString("petmaster-hologram", "Pet owned by ")
						+ ChatColor.GOLD + owner.getName());

		// Runnable to delete hologram.
		new BukkitRunnable() {

			@Override
			public void run() {

				hologram.delete();
			}
		}.runTaskLater(plugin, hologramDuration);
	}

	String healthInfo = "";
	if (showHealth) {
		Animals animal = (Animals) tameable;
		String currentHealth = String.format("%.1f", animal.getHealth());
		String maxHealth = version < 9 ? String.format("%.1f", animal.getMaxHealth())
				: String.format("%.1f", animal.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
		healthInfo = ChatColor.GRAY + ". " + plugin.getPluginLang().getString("petmaster-health", "Health: ")
				+ ChatColor.GOLD + currentHealth + "/" + maxHealth;
	}

	if (chatMessage) {
		player.sendMessage(plugin.getChatHeader() + plugin.getPluginLang().getString("petmaster-chat", "Pet owned by ")
				+ ChatColor.GOLD + owner.getName() + healthInfo);
	}

	if (actionBarMessage) {
		try {
			FancyMessageSender.sendActionBarMessage(player, "&o" + ChatColor.GRAY
					+ plugin.getPluginLang().getString("petmaster-action-bar", "Pet owned by ") + ChatColor.GOLD
					+ owner.getName() + healthInfo);
		} catch (Exception e) {
			plugin.getLogger().warning("Errors while trying to display action bar message for pet ownership.");
		}
	}
}
 
源代码14 项目: SonarPet   文件: IOcelotPet.java
public Ocelot.Type getCatType(); 
源代码15 项目: SonarPet   文件: IOcelotPet.java
public void setCatType(Ocelot.Type t); 
源代码16 项目: EchoPet   文件: IOcelotPet.java
public Ocelot.Type getCatType(); 
源代码17 项目: EchoPet   文件: IOcelotPet.java
public void setCatType(Ocelot.Type t); 
 类所在包
 类方法
 同包方法