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


Java Horse.setJumpStrength方法代码示例

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


在下文中一共展示了Horse.setJumpStrength方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createHorse

import org.bukkit.entity.Horse; //导入方法依赖的package包/类
public static Horse createHorse(Player p, PlayerDataRPG pd) {
    Horse horse = (Horse) REntities.createLivingEntity(CustomHorse.class, p.getLocation());
    horse.setTamed(true);
    setHorseSpeed(horse, getSpeed(pd.horseSpeed));
    horse.setJumpStrength(getJump(pd.horseJump));
    horse.setColor(getColor(pd));
    horse.setStyle(getStyle(pd));
    horse.setVariant(getVariant(pd));
    horse.getInventory().setSaddle(new ItemStack(Material.SADDLE));
    if (pd.horseArmor != null)
        horse.getInventory().setArmor(new ItemStack(pd.horseArmor));
    if (pd.horseBaby) {
        horse.setBaby();
        horse.setAgeLock(true);
    }
    horse.setCustomName(p.getName() + "'s Horse");
    horse.setCustomNameVisible(true);
    pd.riding = true;
    horse.setPassenger(p);
    horseUUIDs.add(horse.getUniqueId());
    return horse;
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:23,代码来源:HorseManager.java

示例2: createHorse

import org.bukkit.entity.Horse; //导入方法依赖的package包/类
private void createHorse(Player player, Location spawn) {
    player.teleport(spawn);
    Horse horse = spawn.getWorld().spawn(spawn, Horse.class);
    horse.setJumpStrength(0);

    double speed = this.getAPI().getGameManager().getGameState() == GameState.STARTING ? 0D : 0.7D;

    // TODO Fix this for 1.8
    horse.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(speed);

    Bukkit.getScheduler().runTaskLater(getAPI().getPlugin(), () -> {
        horse.addPassenger(player);
        horse.setTamed(true);
        horse.getInventory().setSaddle(new ItemStack(Material.SADDLE));
        horse.setAdult();
        horse.setOwner(player);
    }, 1L);
}
 
开发者ID:ArcadiaPlugins,项目名称:Arcadia-Spigot,代码行数:19,代码来源:HorseRaceGame.java

示例3: apply

import org.bukkit.entity.Horse; //导入方法依赖的package包/类
@Override
public boolean apply(Entity entity) {
    PreCon.notNull(entity);
    PreCon.isValid(entity instanceof Horse, "org.bukkit.entity.Horse expected.");

    Horse horse = (Horse) entity;

    horse.setColor(_color);
    horse.setVariant(_variant);
    horse.setStyle(_style);
    horse.setMaxDomestication(_maxDomestication);
    horse.setDomestication(_domestication);
    horse.setCarryingChest(_hasChest);
    horse.setJumpStrength(_jumpStrength);
    return true;
}
 
开发者ID:JCThePants,项目名称:NucleusFramework,代码行数:17,代码来源:HorseAnimal.java

示例4: onSpawn

import org.bukkit.entity.Horse; //导入方法依赖的package包/类
@Override
public void onSpawn() {
    Horse horse = (Horse) getNPC().getEntity();
    if (color != null) horse.setColor(color);
    if (variant != null) horse.setVariant(variant);
    if (style != null) horse.setStyle(style);
    if (jumpStrength != null) horse.setJumpStrength(jumpStrength);
    if (domestication != null) horse.setDomestication(domestication);
    if (maxDomestication != null) horse.setMaxDomestication(maxDomestication);
}
 
开发者ID:leMaik,项目名称:RpgPlus,代码行数:11,代码来源:HorseTrait.java

示例5: apply

import org.bukkit.entity.Horse; //导入方法依赖的package包/类
@Override
public void apply(Entity entity) {
    if (!(entity instanceof Horse)) return;
    Horse horse = (Horse)entity;

    horse.setColor(color);
    horse.setVariant(variant);
    horse.setStyle(style);
    horse.getInventory().setSaddle(saddle);
    horse.getInventory().setArmor(armor);
    horse.setDomestication(domestication);
    horse.setMaxDomestication(maxDomestication);
    horse.setJumpStrength(jumpStrength);
}
 
开发者ID:elBukkit,项目名称:MagicLib,代码行数:15,代码来源:EntityHorseData.java

示例6: callOfTheWild

import org.bukkit.entity.Horse; //导入方法依赖的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


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