本文整理汇总了Java中org.bukkit.entity.Horse.setStyle方法的典型用法代码示例。如果您正苦于以下问题:Java Horse.setStyle方法的具体用法?Java Horse.setStyle怎么用?Java Horse.setStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Horse
的用法示例。
在下文中一共展示了Horse.setStyle方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: applyMountData
import org.bukkit.entity.Horse; //导入方法依赖的package包/类
@Override
public void applyMountData(Entity npc) {
super.applyMountData(npc);
if (!(npc instanceof Horse)) {
return;
}
Horse horse = (Horse) npc;
if (colour != null) {
horse.setColor(colour);
}
if (style != null) {
horse.setStyle(style);
}
if (variant != null) {
horse.setVariant(variant);
}
}
示例4: set
import org.bukkit.entity.Horse; //导入方法依赖的package包/类
@Override
public void set(final Horse entity) {
if (variant != null)
entity.setVariant(variant);
if (color != null)
entity.setColor(color);
if (style != null)
entity.setStyle(style);
}
示例5: 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);
}
示例6: spawnHorse
import org.bukkit.entity.Horse; //导入方法依赖的package包/类
@Override
public LivingEntity spawnHorse(Location loc, HorseType type, Color color, Style style, boolean tame, boolean chest)
{
Horse horse = (Horse) loc.getWorld().spawnEntity(loc, type.getEntity());
horse.setColor(color);
horse.setStyle(style);
horse.setTamed(tame);
if (chest && horse instanceof ChestedHorse)
((ChestedHorse) horse).setCarryingChest(true);
return horse;
}
示例7: 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);
}
示例8: 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"));
}
示例9: getHorsePattern
import org.bukkit.entity.Horse; //导入方法依赖的package包/类
public void getHorsePattern(Player p, Horse horse, int res)
{
if (res == 1 && p.hasPermission("equestriandash.horsestyles.black_dots"))
{
horse.setStyle(Horse.Style.BLACK_DOTS);
}
else if (res == 2 && p.hasPermission("equestriandash.horsestyles.none"))
{
horse.setStyle(Horse.Style.NONE);
}
else if (res == 3 && p.hasPermission("equestriandash.horsestyles.white"))
{
horse.setStyle(Horse.Style.WHITE);
}
else if (res == 4 && p.hasPermission("equestriandash.horsestyles.whitefield"))
{
horse.setStyle(Horse.Style.WHITEFIELD);
}
else if (res == 5 && p.hasPermission("equestriandash.horsestyles.white_Dots"))
{
horse.setStyle(Horse.Style.WHITE_DOTS);
}
else if (res == 6 && p.hasPermission("equestriandash.horsestyles.skeleton"))
{
horse.setVariant(Horse.Variant.SKELETON_HORSE);
}
else if (res == 7 && p.hasPermission("equestriandash.horsestyles.zombie"))
{
horse.setVariant(Horse.Variant.UNDEAD_HORSE);
}
else
{
horse.setStyle(Horse.Style.NONE);
}
}