net.minecraft.item.ItemStack.areItemsEqual()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中net.minecraft.item.ItemStack.areItemsEqual()方法的一些代码示例,展示了ItemStack.areItemsEqual()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ItemStack.areItemsEqual()方法的具体详情如下:
包路径:net.minecraft.item.ItemStack
类名称:ItemStack
方法名:areItemsEqual

ItemStack.areItemsEqual介绍

暂无

代码示例

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public float getPenetration( final ItemStack is )
{
  for( final ItemStack o : this.DamageModifiers.keySet() )
  {
    if( ItemStack.areItemsEqual( o, is ) )
    {
      return this.DamageModifiers.get( o ).floatValue();
    }
  }
  return 0;
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
  public int getMaxInstalled( final Upgrades upgrades )
  {
    int max = 0;

    for( final ItemStack is : upgrades.getSupported().keySet() )
    {
      if( ItemStack.areItemsEqual( this.stack, is ) )
      {
        max = upgrades.getSupported().get( is );
        break;
      }
    }

    return max;
  }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

/**
 * Compares two {@link ItemStack} and their NBT tag for equality.
 *
 * Use this when a precise check is required and the same item is required.
 * Not just something with different NBT tags.
 *
 * @return true, if both are identical.
 */
public boolean isSameItem( @Nonnull final ItemStack is, @Nonnull final ItemStack filter )
{
  return ItemStack.areItemsEqual( is, filter ) && this.isNbtTagEqual( is.getTagCompound(), filter.getTagCompound() );
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

if( ItemStack.areItemsEqual( is, trigger ) )

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public ItemStack addItems( final ItemStack toBeAdded )
{
  if( toBeAdded.isEmpty() )
  {
    return ItemStack.EMPTY;
  }
  if( toBeAdded.getCount() == 0 )
  {
    return ItemStack.EMPTY;
  }
  final ItemStack left = toBeAdded.copy();
  for( final ItemStack is : this.i )
  {
    if( ItemStack.areItemsEqual( is, left ) )
    {
      is.grow( left.getCount() );
      return ItemStack.EMPTY;
    }
  }
  this.i.add( left );
  return ItemStack.EMPTY;
}

代码示例来源:origin: WayofTime/BloodMagic

@Override
  public boolean doStacksMatch(ItemStack filterStack, ItemStack testStack) {
    return ItemStack.areItemsEqual(filterStack, testStack);
  }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

if( !ItemStack.areItemsEqual( is, this.myPattern ) )

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

protected void checkToolbox()
{
  if( this.hasToolbox() )
  {
    final ItemStack currentItem = this.getPlayerInv().getStackInSlot( this.tbSlot );
    if( currentItem != this.tbInventory.getItemStack() )
    {
      if( !currentItem.isEmpty() )
      {
        if( ItemStack.areItemsEqual( this.tbInventory.getItemStack(), currentItem ) )
        {
          this.getPlayerInv().setInventorySlotContents( this.tbSlot, this.tbInventory.getItemStack() );
        }
        else
        {
          this.setValidContainer( false );
        }
      }
      else
      {
        this.setValidContainer( false );
      }
    }
  }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public void detectAndSendChanges()
{
  final ItemStack currentItem = this.getPlayerInv().getCurrentItem();
  if( currentItem != this.toolInv.getItemStack() )
  {
    if( !currentItem.isEmpty() )
    {
      if( ItemStack.areItemsEqual( this.toolInv.getItemStack(), currentItem ) )
      {
        this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.toolInv.getItemStack() );
      }
      else
      {
        this.setValidContainer( false );
      }
    }
    else
    {
      this.setValidContainer( false );
    }
  }
  super.detectAndSendChanges();
}

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
public boolean equals(Object obj) {
 if (obj == null || obj.getClass() != ItemStackKey.class) {
  return false;
 }
 ItemStack stack = ((ItemStackKey) obj).wrapped;
 return ItemStack.areItemsEqual(wrapped, stack) && ItemStack.areItemStackTagsEqual(wrapped, stack);
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

if( ( Platform.itemComparisons().isEqualItemType( providedTemplate, sh ) || ae_req.sameOre( x ) ) && !ItemStack.areItemsEqual( sh,
    output ) )
  cp.setCount( 1 );
  ci.setInventorySlotContents( slot, cp );
  if( r.matches( ci, w ) && ItemStack.areItemsEqual( r.getCraftingResult( ci ), output ) )

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public void setStackInSlot( final int slot, final ItemStack newItemStack )
{
  ItemStack oldStack = this.getStackInSlot( slot ).copy();
  this.inv[slot] = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( newItemStack );
  if( this.te != null && Platform.isServer() )
  {
    ItemStack newStack = newItemStack.copy();
    InvOperation op = InvOperation.SET;
    if( ItemStack.areItemsEqual( oldStack, newStack ) )
    {
      if( newStack.getCount() > oldStack.getCount() )
      {
        newStack.shrink( oldStack.getCount() );
        oldStack = ItemStack.EMPTY;
        op = InvOperation.INSERT;
      }
      else
      {
        oldStack.shrink( newStack.getCount() );
        newStack = ItemStack.EMPTY;
        op = InvOperation.EXTRACT;
      }
    }
    this.fireOnChangeInventory( slot, op, oldStack, newStack );
  }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

if( !other.isEmpty() )
  if( ItemStack.areItemsEqual( other, new ItemStack( Items.REDSTONE ) ) )
  if( ItemStack.areItemsEqual( other, new ItemStack( Items.QUARTZ ) ) )

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public void detectAndSendChanges()
{
  final ItemStack currentItem = this.getPlayerInv().getCurrentItem();
  if( currentItem != this.toolInv.getItemStack() )
  {
    if( !currentItem.isEmpty() )
    {
      if( ItemStack.areItemsEqual( this.toolInv.getItemStack(), currentItem ) )
      {
        this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.toolInv.getItemStack() );
      }
      else
      {
        this.setValidContainer( false );
      }
    }
    else
    {
      this.setValidContainer( false );
    }
  }
  if( this.isValidContainer() )
  {
    final NBTTagCompound data = Platform.openNbtData( currentItem );
    this.setFacadeMode( data.getBoolean( "hideFacades" ) );
  }
  super.detectAndSendChanges();
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

InvOperation op = InvOperation.SET;
if( newStack.isEmpty() || oldStack.isEmpty() || ItemStack.areItemsEqual( newStack, oldStack ) )

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

if( ItemStack.areItemsEqual( this.civ.getItemStack(), currentItem ) )

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
public boolean shouldCauseReequipAnimation(@Nonnull ItemStack oldStack, @Nonnull ItemStack newStack, boolean slotChanged) {
 return slotChanged ? super.shouldCauseReequipAnimation(oldStack, newStack, slotChanged)
   : (oldStack.isEmpty() || newStack.isEmpty() || !ItemStack.areItemsEqual(oldStack, newStack));
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

if( !newType.isEmpty() && !ItemStack.areItemsEqual( newType, this.getItemStack() ) )

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

if( !is.isEmpty() && ItemStack.areItemsEqual( request, is ) )

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
public boolean isInput(@Nonnull ItemStack test) {
 if (Prep.isInvalid(test) || Prep.isInvalid(input)) {
  return false;
 }
 if (useMeta) {
  return ItemStack.areItemsEqual(input, test) && (!input.hasTagCompound() || ItemStack.areItemStackTagsEqual(input, test));
 }
 return test.getItem() == input.getItem() && (!input.hasTagCompound() || ItemStack.areItemStackTagsEqual(input, test));
}

相关文章

微信公众号

最新文章

更多

ItemStack类方法