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


Java IAllowItem类代码示例

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


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

示例1: isMainHand

import mods.battlegear2.api.IAllowItem; //导入依赖的package包/类
/**
 * Defines a combination of left hand/right hand items that is valid to wield
 *
 * @param main Item to be wield in the right hand
 * @param off Item to be wield in the left hand
 * @param wielder The player trying to wield this combination of items
 * @return true if the right hand item allows left hand item
 */
public static boolean isMainHand(ItemStack main, ItemStack off, EntityPlayer wielder) {
    if(main.isEmpty())
        return true;
    if(main.getItem() instanceof IWield && !((IWield) main.getItem()).getWieldStyle(main, wielder).isMainhand())
        return false;
    if(main.getItem() instanceof IAllowItem)//An item using the API
        return ((IAllowItem) main.getItem()).allowOffhand(main, off, wielder);//defined by the item
    else if(main.getItem() instanceof IShield)//A shield
        return false;
    else if(main.getItem() instanceof IArrowContainer2)//A quiver
        return true;//anything ?
    else if(usagePriorAttack(main, wielder, false))//"Usable" item
        return off.isEmpty() || !usagePriorAttack(off, wielder, true);//With empty hand or non "usable item"
    else if(isWeapon(main))//A generic weapon
        return main.getAttributeModifiers(EntityEquipmentSlot.MAINHAND).containsKey(genericAttack) || WeaponRegistry.isMainHand(main);//With either generic attack, or registered
    return false;
}
 
开发者ID:Mine-and-blade-admin,项目名称:Battlegear2,代码行数:26,代码来源:BattlegearUtils.java

示例2: isOffHand

import mods.battlegear2.api.IAllowItem; //导入依赖的package包/类
/**
 * Defines a item which can be wield in the left hand
 * @param off The item to be wield in left hand
 * @param main Item to be wield in the right hand
 * @param wielder The player trying to wield this item
 * @return true if the item is allowed in left hand
 */
public static boolean isOffHand(ItemStack off, ItemStack main, EntityPlayer wielder) {
    if(off.isEmpty())
        return true;
    if(off.getItem() instanceof IWield && !((IWield) off.getItem()).getWieldStyle(off, wielder).isOffhand())
        return false;
    if(off.getItem() instanceof IAllowItem)//An item using the API
        return ((IAllowItem) off.getItem()).allowOffhand(off, main, wielder);//defined by the item
    else if(off.getItem() instanceof IShield || off.getItem() instanceof IArrowContainer2 || usagePriorAttack(off, wielder, true))//Shield, Quiver, or "usable"
        return true;//always
    else if(isWeapon(off))//A generic weapon
        return off.getAttributeModifiers(EntityEquipmentSlot.OFFHAND).containsKey(genericAttack) || WeaponRegistry.isOffHand(off);//with a generic attack or registered
    return false;
}
 
开发者ID:Mine-and-blade-admin,项目名称:Battlegear2,代码行数:21,代码来源:BattlegearUtils.java

示例3: isMainHand

import mods.battlegear2.api.IAllowItem; //导入依赖的package包/类
public static boolean isMainHand(ItemStack main, ItemStack off) {
	if(main.getItem() instanceof IAllowItem)
        return ((IAllowItem) main.getItem()).allowOffhand(main, off);
    else
        return mainHandDualWeapons[main.itemID] || WeaponRegistry.isMainHand(main);
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:7,代码来源:BattlegearUtils.java


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