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


Java HorseInventory类代码示例

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


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

示例1: onPetInventoryOpened

import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onPetInventoryOpened(InventoryOpenEvent event) {
    Player player = (Player) event.getPlayer();
    if (!InventoryManager.playerIsLoaded(player)) {
        return;
    }

    final PlayerWrapper playerWrapper = InventoryManager.get(player);
    if (playerWrapper.hasPet() && event.getInventory().getHolder() == playerWrapper.getPet()) {
        playerWrapper.openInventory();
        event.setCancelled(true);

        new BukkitRunnable() {
            @Override
            public void run() {
                HorseInventory horseInv = ((Horse) playerWrapper.getPet()).getInventory();
                horseInv.setSaddle(new ItemStack(Material.SADDLE));
            }
        }.runTaskLater(RPGInventory.getInstance(), 1);
    }
}
 
开发者ID:EndlessCodeGroup,项目名称:RPGInventory,代码行数:22,代码来源:PetListener.java

示例2: getSaddle

import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
public static ItemStack getSaddle(final Entity entity) {
    if (!Sddls.isHorse(entity)) return null;
    final Inventory inv = ((InventoryHolder) entity).getInventory();;
    if (inv instanceof HorseInventory)
        return ((HorseInventory) inv).getSaddle();
    return inv.getItem(0);
}
 
开发者ID:piratjsk,项目名称:Sddls,代码行数:8,代码来源:Sddls.java

示例3: equip

import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
@Override
public boolean equip(Entity entity, ItemStack item) {
    PreCon.notNull(entity);
    PreCon.notNull(item);

    if (!(entity instanceof Horse))
        return false;

    Horse horse = (Horse)entity;

    HorseInventory inventory = horse.getInventory();

    Material material = item.getType();
    if (material == Material.SADDLE) {

        inventory.setSaddle(item);
    }
    else {

        if (Materials.hasProperty(material, MaterialProperty.HORSE_ARMOR)) {
            inventory.setArmor(item);
        }
        else {
            return false;
        }
    }

    return true;
}
 
开发者ID:JCThePants,项目名称:NucleusFramework,代码行数:30,代码来源:HorseEquipper.java

示例4: clear

import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
@Override
public List<ItemStack> clear(Entity entity) {
    PreCon.notNull(entity);

    if (!(entity instanceof Horse))
        return new ArrayList<>(0);

    Horse horse = (Horse)entity;

    HorseInventory inventory = horse.getInventory();

    List<ItemStack> result = new ArrayList<>(2);

    ItemStack saddle = inventory.getSaddle();
    if (saddle != null) {
        result.add(saddle);
        inventory.setSaddle(null);
    }

    ItemStack armor = inventory.getArmor();
    if (armor != null) {
        result.add(armor);
        inventory.setArmor(null);
    }

    return result;
}
 
开发者ID:JCThePants,项目名称:NucleusFramework,代码行数:28,代码来源:HorseEquipper.java

示例5: getInventory

import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
public HorseInventory getInventory() {
    return new CraftInventoryHorse(getHandle().horseChest);
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:4,代码来源:CraftHorse.java

示例6: getInventory

import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
@Override
public HorseInventory getInventory();
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:3,代码来源:Horse.java

示例7: setArmour

import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
@Override
public void setArmour(HorseArmour a) {
    ((HorseInventory) ((InventoryHolder) getBukkitEntity()).getInventory())
            .setArmor(a.getMaterial() == null ? null : new ItemStack(a.getMaterial(), 1));
}
 
开发者ID:TechzoneMC,项目名称:SonarPet,代码行数:6,代码来源:EntityHorsePet.java

示例8: getInventory

import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
public HorseInventory getInventory() {
    throw new NotImplementedException("getInventory()");
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:4,代码来源:CanaryHorse.java

示例9: getInventory

import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
public HorseInventory getInventory() {
    return new CraftInventoryHorse(getHandle().inventoryChest);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:4,代码来源:CraftHorse.java

示例10: getInventory

import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
@Override
public HorseInventory getInventory() {
    return PoreHorseInventory.of(getHandle().getInventory());
}
 
开发者ID:LapisBlue,项目名称:Pore,代码行数:5,代码来源:PoreHorse.java

示例11: onInventoryClick

import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
	if (event.getInventory() instanceof HorseInventory && event.getSlotType() != InventoryType.SlotType.QUICKBAR && event.getSlot() < 9) {
		event.setCancelled(true);
	}
}
 
开发者ID:ktross,项目名称:HorseMount,代码行数:7,代码来源:HorseMount.java

示例12: getInventory

import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
HorseInventory getInventory(); 
开发者ID:deathcap,项目名称:BedrockAPI,代码行数:2,代码来源:Horse.java


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