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


Java Horse.setColor方法代码示例

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


在下文中一共展示了Horse.setColor方法的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;
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:23,代码来源:HorseManager.java

示例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;
}
 
开发者ID:JCThePants,项目名称:NucleusFramework,代码行数:17,代码来源:HorseAnimal.java

示例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);
	}
}
 
开发者ID:CodingBadgers,项目名称:MineKart,代码行数:23,代码来源:HorseMountData.java

示例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);
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:10,代码来源:HorseData.java

示例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);
}
 
开发者ID:leMaik,项目名称:RpgPlus,代码行数:11,代码来源:HorseTrait.java

示例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;
}
 
开发者ID:dmulloy2,项目名称:SwornAPI,代码行数:14,代码来源:SpecialEntities.java

示例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);
}
 
开发者ID:elBukkit,项目名称:MagicLib,代码行数:15,代码来源:EntityHorseData.java

示例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"));
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:72,代码来源:TamingManager.java

示例9: getHorseColor

import org.bukkit.entity.Horse; //导入方法依赖的package包/类
public void getHorseColor(Player p, Horse horse, int res)
{

    if (res == 1 && p.hasPermission("equestriandash.horsecolors.white"))
    {
        horse.setColor(Horse.Color.WHITE);
    }
    else if (res == 2 && p.hasPermission("equestriandash.horsecolors.black"))
    {
        horse.setColor(Horse.Color.BLACK);
    }
    else if (res == 3 && p.hasPermission("equestriandash.horsecolors.brown"))
    {
        horse.setColor(Horse.Color.BROWN);
    }
    else if (res == 4 && p.hasPermission("equestriandash.horsecolors.chestnut"))
    {
        horse.setColor(Horse.Color.CHESTNUT);
    }
    else if (res == 5 && p.hasPermission("equestriandash.horsecolors.creamy"))
    {
        horse.setColor(Horse.Color.CREAMY);
    }
    else if (res == 6 && p.hasPermission("equestriandash.horsecolors.dark_brown"))
    {
        horse.setColor(Horse.Color.DARK_BROWN);
    }
    else if (res == 7 && p.hasPermission("equestriandash.horsecolors.gray"))
    {
        horse.setColor(Horse.Color.GRAY);
    }
    else
    {
        horse.setColor(Horse.Color.WHITE);
    }
}
 
开发者ID:ColonelHedgehog,项目名称:Equestrian-Dash,代码行数:37,代码来源:PropertyHandler.java


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