當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。