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


Java ItemStack.areCapsCompatible方法代码示例

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


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

示例1: canItemStacksStackIgnoreStacksize

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public static boolean canItemStacksStackIgnoreStacksize(@Nonnull ItemStack a, @Nonnull ItemStack b){
    return !a.isEmpty() && isItemEqualIgnoreDamageIfWildcard(a, b) && a.hasTagCompound() == b.hasTagCompound() && (!a.hasTagCompound() || a.getTagCompound().equals(b.getTagCompound())) && a.areCapsCompatible(b);
}
 
开发者ID:canitzp,项目名称:Metalworks,代码行数:4,代码来源:Util.java

示例2: areItemStacksEqual

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
private static boolean areItemStacksEqual(ItemStack stack1, ItemStack stack2) {
	return stack1.getItem() != stack2.getItem() ? false
			: (stack1.getItemDamage() != stack2.getItemDamage() ? false
					: (stack1.getTagCompound() == null && stack2.getTagCompound() != null ? false : (stack1.getTagCompound() == null || stack1.getTagCompound().equals(stack2.getTagCompound())) && stack1.areCapsCompatible(stack2)));
}
 
开发者ID:oMilkyy,项目名称:SimpleTubes,代码行数:6,代码来源:TubeUtil.java

示例3: combineItems

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Tries to merge this item with the item passed as the parameter. Returns true if successful. Either this item or
 * the other item will  be removed from the world.
 */
private boolean combineItems(EntityItem other)
{
    if (other == this)
    {
        return false;
    }
    else if (other.isEntityAlive() && this.isEntityAlive())
    {
        ItemStack itemstack = this.getEntityItem();
        ItemStack itemstack1 = other.getEntityItem();

        if (this.delayBeforeCanPickup != 32767 && other.delayBeforeCanPickup != 32767)
        {
            if (this.age != -32768 && other.age != -32768)
            {
                if (itemstack1.getItem() != itemstack.getItem())
                {
                    return false;
                }
                else if (itemstack1.hasTagCompound() ^ itemstack.hasTagCompound())
                {
                    return false;
                }
                else if (itemstack1.hasTagCompound() && !itemstack1.getTagCompound().equals(itemstack.getTagCompound()))
                {
                    return false;
                }
                else if (itemstack1.getItem() == null)
                {
                    return false;
                }
                else if (itemstack1.getItem().getHasSubtypes() && itemstack1.getMetadata() != itemstack.getMetadata())
                {
                    return false;
                }
                else if (itemstack1.stackSize < itemstack.stackSize)
                {
                    return other.combineItems(this);
                }
                else if (itemstack1.stackSize + itemstack.stackSize > itemstack1.getMaxStackSize())
                {
                    return false;
                }
                else if (!itemstack.areCapsCompatible(itemstack1))
                {
                    return false;
                }
                else
                {
                    itemstack1.stackSize += itemstack.stackSize;
                    other.delayBeforeCanPickup = Math.max(other.delayBeforeCanPickup, this.delayBeforeCanPickup);
                    other.age = Math.min(other.age, this.age);
                    other.setEntityItemStack(itemstack1);
                    this.setDead();
                    return true;
                }
            }
            else
            {
                return false;
            }
        }
        else
        {
            return false;
        }
    }
    else
    {
        return false;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:77,代码来源:EntityItem.java


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