本文整理汇总了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);
}
示例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)));
}
示例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;
}
}