当前位置: 首页>>代码示例>>Java>>正文


Java Ocelot类代码示例

本文整理汇总了Java中org.bukkit.entity.Ocelot的典型用法代码示例。如果您正苦于以下问题:Java Ocelot类的具体用法?Java Ocelot怎么用?Java Ocelot使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Ocelot类属于org.bukkit.entity包,在下文中一共展示了Ocelot类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: OcelotMenu

import org.bukkit.entity.Ocelot; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public OcelotMenu(Plot plot, Ocelot ocelot) {
    super(plot, ocelot);

    //type
    ItemStack type = new ItemStack(Material.BONE);
    ItemMeta typeMeta = type.getItemMeta();
    typeMeta.setDisplayName(ChatColor.GREEN + "Change type");
    type.setItemMeta(typeMeta);

    insertItem(type, event -> {
        new OcelotTypeMenu(ocelot).open((Player) event.getWhoClicked());

        event.setCancelled(true);
    }, 0);
}
 
开发者ID:stefvanschie,项目名称:buildinggame,代码行数:19,代码来源:OcelotMenu.java

示例4: freePet

import org.bukkit.entity.Ocelot; //导入依赖的package包/类
/**
 * Frees a pet; it will no longer be tamed.
 * 
 * @param event
 * @param oldOwner
 */
private void freePet(PlayerInteractEntityEvent event, AnimalTamer oldOwner) {
	if (chargePrice(event.getPlayer(), freePetPrice)) {
		Tameable tameableAnimal = (Tameable) event.getRightClicked();
		// Free pet.
		tameableAnimal.setTamed(false);
		// Make freed pet stand up.
		if (version >= 12 && tameableAnimal instanceof Sittable) {
			((Sittable) tameableAnimal).setSitting(false);
		} else if (tameableAnimal instanceof Wolf) {
			((Wolf) tameableAnimal).setSitting(false);
		} else if (tameableAnimal instanceof Ocelot) {
			((Ocelot) tameableAnimal).setSitting(false);
		}

		event.getPlayer().sendMessage(plugin.getChatHeader()
				+ plugin.getPluginLang().getString("pet-freed", "Say goodbye: this pet returned to the wild!"));

		// Create new event to allow other plugins to be aware of the freeing.
		PlayerChangeAnimalOwnershipEvent playerChangeAnimalOwnershipEvent = new PlayerChangeAnimalOwnershipEvent(
				oldOwner, null, tameableAnimal);
		Bukkit.getServer().getPluginManager().callEvent(playerChangeAnimalOwnershipEvent);
	}
}
 
开发者ID:PyvesB,项目名称:PetMaster,代码行数:30,代码来源:PlayerInteractListener.java

示例5: 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

示例6: 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

示例7: onLoad

import org.bukkit.entity.Ocelot; //导入依赖的package包/类
@Override
public void onLoad() {
    add(Ocelot.Type.WILD_OCELOT, "Wild Ocelot", "Wild", "WI", "W", "Untamed", "Default", "Def", "None");
    add(Ocelot.Type.BLACK_CAT, "Black Cat", "Black", "BL", "B");
    add(Ocelot.Type.RED_CAT, "Red Cat", "Red", "RE", "R");
    add(Ocelot.Type.SIAMESE_CAT, "Siamese Cat", "Siamese", "SI", "S", "Siam");
}
 
开发者ID:GameBoxx,项目名称:GameBoxx,代码行数:8,代码来源:OcelotTypes.java

示例8: initiateEntityPet

import org.bukkit.entity.Ocelot; //导入依赖的package包/类
@Override
public void initiateEntityPet() {
    super.initiateEntityPet();
    getBukkitEntity().setTamed(true);
    getBukkitEntity().setCatType(Ocelot.Type.BLACK_CAT);
    getBukkitEntity().setOwner(getPlayerOwner());
}
 
开发者ID:TechzoneMC,项目名称:SonarPet,代码行数:8,代码来源:EntityOcelotPet.java

示例9: rawset

import org.bukkit.entity.Ocelot; //导入依赖的package包/类
@Override
public void rawset(LuaValue key, LuaValue value) {
    if (key.isstring()) {
        switch (key.checkjstring()) {
            case "type":
                getOcelotTrait().setCatType(ScriptUtil.enumValue(value, Ocelot.Type.class));
                break;
        }
    }
    super.rawset(key, value);
}
 
开发者ID:leMaik,项目名称:RpgPlus,代码行数:12,代码来源:OcelotEntityWrapper.java

示例10: callOfTheWild

import org.bukkit.entity.Ocelot; //导入依赖的package包/类
/**
 * Handle the Call of the Wild ability.
 *
 * @param type The type of entity to summon.
 * @param summonAmount The amount of material needed to summon the entity
 */
private void callOfTheWild(EntityType type, int summonAmount) {
    Player player = getPlayer();

    ItemStack heldItem = player.getItemInHand();
    int heldItemAmount = heldItem.getAmount();

    if (heldItemAmount < summonAmount) {
        player.sendMessage(LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(heldItem.getType())));
        return;
    }

    if (!rangeCheck(type)) {
        return;
    }

    int amount = Config.getInstance().getTamingCOTWAmount(type);

    for (int i = 0; i < amount; i++) {
        LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type);

        FakeEntityTameEvent event = new FakeEntityTameEvent(entity, player);
        mcMMO.p.getServer().getPluginManager().callEvent(event);

        if (event.isCancelled()) {
            continue;
        }

        entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
        ((Tameable) entity).setOwner(player);
        entity.setRemoveWhenFarAway(false);

        switch (type) {
            case OCELOT:
                ((Ocelot) entity).setCatType(Ocelot.Type.values()[1 + Misc.getRandom().nextInt(3)]);
                break;

            case WOLF:
                entity.setMaxHealth(20.0);
                entity.setHealth(entity.getMaxHealth());
                break;

            case HORSE:
                Horse horse = (Horse) entity;

                entity.setMaxHealth(15.0 + (Misc.getRandom().nextDouble() * 15));
                entity.setHealth(entity.getMaxHealth());
                horse.setColor(Horse.Color.values()[Misc.getRandom().nextInt(Horse.Color.values().length)]);
                horse.setStyle(Horse.Style.values()[Misc.getRandom().nextInt(Horse.Style.values().length)]);
                horse.setJumpStrength(Math.max(AdvancedConfig.getInstance().getMinHorseJumpStrength(), Math.min(Math.min(Misc.getRandom().nextDouble(), Misc.getRandom().nextDouble()) * 2, AdvancedConfig.getInstance().getMaxHorseJumpStrength())));
                //TODO: setSpeed, once available
                break;

            default:
                break;
        }

        if (Permissions.renamePets(player)) {
            entity.setCustomName(LocaleLoader.getString("Taming.Summon.Name.Format", player.getName(), StringUtils.getPrettyEntityTypeString(type)));
            entity.setCustomNameVisible(true);
        }
    }

    player.setItemInHand(heldItemAmount == summonAmount ? null : new ItemStack(heldItem.getType(), heldItemAmount - summonAmount));
    player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete"));
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:72,代码来源:TamingManager.java

示例11: OcelotAnimal

import org.bukkit.entity.Ocelot; //导入依赖的package包/类
public OcelotAnimal(Entity entity) {
    PreCon.isValid(entity instanceof Ocelot, "org.bukkit.entity.Ocelot expected.");

    Ocelot ocelot = (Ocelot)entity;

    _type = ocelot.getCatType();
    _isSitting = ocelot.isSitting();
}
 
开发者ID:JCThePants,项目名称:NucleusFramework,代码行数:9,代码来源:OcelotAnimal.java

示例12: 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

示例13: load

import org.bukkit.entity.Ocelot; //导入依赖的package包/类
@Override
protected void load(ConfigurationSection config) {
	super.load(config);
	String catTypeName = config.getString("catType");
	try {
		catType = Ocelot.Type.valueOf(catTypeName);
	} catch (Exception e) {
	}
}
 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:10,代码来源:CatShop.java

示例14: getSubItemData

import org.bukkit.entity.Ocelot; //导入依赖的package包/类
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();
	}
}
 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:15,代码来源:CatShop.java

示例15: getDefaultTargetingBehaviours

import org.bukkit.entity.Ocelot; //导入依赖的package包/类
@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))
    };
}
 
开发者ID:EntityAPIDev,项目名称:EntityAPI,代码行数:13,代码来源:ControllableCreeperBase.java


注:本文中的org.bukkit.entity.Ocelot类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。