本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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"));
}