當前位置: 首頁>>代碼示例>>Java>>正文


Java Ocelot.setCatType方法代碼示例

本文整理匯總了Java中org.bukkit.entity.Ocelot.setCatType方法的典型用法代碼示例。如果您正苦於以下問題:Java Ocelot.setCatType方法的具體用法?Java Ocelot.setCatType怎麽用?Java Ocelot.setCatType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.entity.Ocelot的用法示例。


在下文中一共展示了Ocelot.setCatType方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCommand

import org.bukkit.entity.Ocelot; //導入方法依賴的package包/類
@Override
protected void onCommand(CommandSender sender, String[] args) {
    Player p = (Player) sender;
    Ocelot cat = (Ocelot) p.getWorld().spawnEntity(p.getLocation(), EntityType.OCELOT);
    if (cat == null)
        return; // Probably in a protected area.

    cat.setCatType(Utils.randElement(Ocelot.Type.values()));
    cat.setTamed(true);
    cat.setBaby();
    cat.setVelocity(p.getEyeLocation().getDirection().multiply(2));

    Bukkit.getScheduler().runTaskLater(Core.getInstance(), () -> {
        cat.getWorld().createExplosion(cat.getLocation(), 0F);
        cat.remove();
    }, 20L);
}
 
開發者ID:Kneesnap,項目名稱:Kineticraft,代碼行數:18,代碼來源:CommandKittyCannon.java

示例2: run

import org.bukkit.entity.Ocelot; //導入方法依賴的package包/類
public void run(PAUser user, String label, String... args) {
    final Ocelot o = (Ocelot) user.getLoc().getWorld().spawnEntity(user.getLoc(), EntityType.OCELOT);
    o.setCatType(Ocelot.Type.values()[r.nextInt(Ocelot.Type.values().length)]);
    o.setSitting(true);
    o.setTamed(true);
    o.setAge(r.nextInt(2));
    o.setCustomName(Utils.colorize("&dGateteeeeeee"));
    o.setCustomNameVisible(true);
    o.setNoDamageTicks(Integer.MAX_VALUE);
    o.setVelocity(user.getPlayer().getLocation().getDirection().multiply(2));

    PAServer.users.forEach(u -> u.sendSound(Sounds.CAT_MEOW));

    plugin.getServer().getScheduler().runTaskLater(plugin, () -> {
        PAServer.users.forEach(u -> u.sendSound(Sounds.EXPLODE));
        ParticleEffect.EXPLOSION_HUGE.send(plugin.getServer().getOnlinePlayers(), o.getLocation(), 0, 0, 0, 1, 20, 50);
        o.remove();
    }, 60);
}
 
開發者ID:cadox8,項目名稱:PA,代碼行數:20,代碼來源:KittyCMD.java

示例3: throwKittyCannon

import org.bukkit.entity.Ocelot; //導入方法依賴的package包/類
private void throwKittyCannon(final World world, Player player, Location hookLoc) {
    int i = random.nextInt(Ocelot.Type.values().length);
    final Ocelot cat = (Ocelot) throwMob(world, player, hookLoc, EntityType.OCELOT);
    cat.setCatType(Ocelot.Type.values()[i]);
    cat.setTamed(true);
    cat.setBaby();
    
    mainInstance.scheduleSyncDelayedTask(new Runnable() {
        @Override
        public void run() {
            final Location catLoc = cat.getLocation();
            cat.remove();
            world.createExplosion(catLoc.getX(), catLoc.getY(), catLoc.getZ(), 2.0F, false, false);
        }
    }, 20);
}
 
開發者ID:YaLTeR,項目名稱:UnexpectedFishing,代碼行數:17,代碼來源:UnexpectedFishingListener.java

示例4: run

import org.bukkit.entity.Ocelot; //導入方法依賴的package包/類
@Override
protected void run(final IUser user, final String commandLabel, final String[] args) throws Exception
{
	final EntityType cat = EntityType.OCELOT;
	final Ocelot ocelot = (Ocelot)user.getPlayer().getWorld().spawn(user.getPlayer().getEyeLocation(), cat.getEntityClass());
	if (ocelot == null)
	{
		return;
	}
	final int i = random.nextInt(Ocelot.Type.values().length);
	ocelot.setCatType(Ocelot.Type.values()[i]);
	ocelot.setTamed(true);
	ocelot.setVelocity(user.getPlayer().getEyeLocation().getDirection().multiply(2));
	ess.getPlugin().scheduleSyncDelayedTask(
			new Runnable()
			{
				@Override
				public void run()
				{
					final Location loc = ocelot.getLocation();
					ocelot.remove();
					loc.getWorld().createExplosion(loc, 0F);
				}
			}, 20);
}
 
開發者ID:Curtis3321,項目名稱:Essentials,代碼行數:26,代碼來源:Commandkittycannon.java

示例5: apply

import org.bukkit.entity.Ocelot; //導入方法依賴的package包/類
@Override
public boolean apply(Entity entity) {
    PreCon.notNull(entity);
    PreCon.isValid(entity instanceof Ocelot, "org.bukkit.entity.Ocelot expected.");

    Ocelot ocelot = (Ocelot)entity;

    ocelot.setCatType(_type);
    ocelot.setSitting(_isSitting);

    return true;
}
 
開發者ID:JCThePants,項目名稱:NucleusFramework,代碼行數:13,代碼來源:OcelotAnimal.java

示例6: onSpawn

import org.bukkit.entity.Ocelot; //導入方法依賴的package包/類
@Override
public void onSpawn() {
    Ocelot ocelot = (Ocelot) getNPC().getEntity();
    if (catType != null) ocelot.setCatType(catType);
}
 
開發者ID:leMaik,項目名稱:RpgPlus,代碼行數:6,代碼來源:OcelotTrait.java


注:本文中的org.bukkit.entity.Ocelot.setCatType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。