@Override
  public ItemStack getContainerItem(ItemStack ist) {
    ist.setItemDamage(ist.getItemDamage() + 1);
    if (ist.getItemDamage() > ist.getMaxDamage()) ist = null;

    return ist;
  }
 private int getAttackDamage(ItemStack is) {
   if (is == null) return 0;
   double pow = 2 + ReikaMathLibrary.intpow(is.getItemDamage() / 2, 6);
   return (int)
       ((ReikaMathLibrary.logbase(pow, 2) / 4)
           * ReikaMathLibrary.doubpow(1.0001, is.getItemDamage()));
 }
  @Override
  public void readFromNBT(NBTTagCompound nbttagcompound) {
    super.readFromNBT(nbttagcompound);

    Utils.readStacksFromNBT(nbttagcompound, "items", items);

    energyStored = nbttagcompound.getFloat("energyStored");

    NBTTagList list = nbttagcompound.getTagList("planned");

    for (int i = 0; i < list.tagCount(); ++i) {
      NBTTagCompound cpt = (NBTTagCompound) list.tagAt(i);

      ItemStack stack = ItemStack.loadItemStackFromNBT(cpt);

      for (AssemblyRecipe r : AssemblyRecipe.assemblyRecipes) {
        if (r.output.itemID == stack.itemID && r.output.getItemDamage() == stack.getItemDamage()) {
          plannedOutput.add(r);
        }
      }
    }

    if (nbttagcompound.hasKey("recipe")) {
      ItemStack stack = ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("recipe"));

      for (AssemblyRecipe r : plannedOutput) {
        if (r.output.itemID == stack.itemID && r.output.getItemDamage() == stack.getItemDamage()) {
          setCurrentRecipe(r);
          break;
        }
      }
    }
  }
Beispiel #4
0
  /**
   * 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.
   */
  public boolean combineItems(EntityItem par1EntityItem) {
    if (par1EntityItem == this) {
      return false;
    } else if (par1EntityItem.isEntityAlive() && this.isEntityAlive()) {
      ItemStack var2 = this.func_92014_d();
      ItemStack var3 = par1EntityItem.func_92014_d();

      if (var3.getItem() != var2.getItem()) {
        return false;
      } else if (var3.hasTagCompound() ^ var2.hasTagCompound()) {
        return false;
      } else if (var3.hasTagCompound() && !var3.getTagCompound().equals(var2.getTagCompound())) {
        return false;
      } else if (var3.getItem().getHasSubtypes() && var3.getItemDamage() != var2.getItemDamage()) {
        return false;
      } else if (var3.stackSize < var2.stackSize) {
        return par1EntityItem.combineItems(this);
      } else if (var3.stackSize + var2.stackSize > var3.getMaxStackSize()) {
        return false;
      } else {
        var3.stackSize += var2.stackSize;
        par1EntityItem.delayBeforeCanPickup =
            Math.max(par1EntityItem.delayBeforeCanPickup, this.delayBeforeCanPickup);
        par1EntityItem.age = Math.min(par1EntityItem.age, this.age);
        par1EntityItem.func_92013_a(var3);
        this.setDead();
        return true;
      }
    } else {
      return false;
    }
  }
Beispiel #5
0
  @Override
  protected boolean checkMatch(InventoryCrafting ic, int x, int y, boolean mirror) {
    for (int k = 0; k < 3; ++k) {
      for (int l = 0; l < 3; ++l) {
        int i1 = k - x;
        int j1 = l - y;
        ItemStack itemstack = null;

        if (i1 >= 0 && j1 >= 0 && i1 < recipeWidth && j1 < recipeHeight) {
          if (mirror) itemstack = recipeItems[recipeWidth - i1 - 1 + j1 * recipeWidth];
          else itemstack = recipeItems[i1 + j1 * recipeWidth];
        }

        ItemStack itemstack1 = ic.getStackInRowAndColumn(k, l);

        if (itemstack1 != null || itemstack != null) {

          if (itemstack1 == null && itemstack != null || itemstack1 != null && itemstack == null)
            return false;

          if (itemstack.getItem() != itemstack1.getItem()) return false;

          if (itemstack.getItemDamage() != 32767
              && itemstack.getItemDamage() != itemstack1.getItemDamage()) return false;

          if (!ItemStack.areItemStackTagsEqual(itemstack, itemstack1)) return false;
        }
      }
    }

    return true;
  }
  // item meta = material id
  @Override
  public int getMaterialID(ItemStack stack) {
    if (TConstructRegistry.toolMaterials.keySet().contains(stack.getItemDamage()))
      return stack.getItemDamage();

    return -1;
  }
 /** Check if the stack is a valid item for this slot. Always true beside for the armor slots. */
 @Override
 public boolean isItemValid(ItemStack is) {
   return (is.itemID == RotaryCraft.extracts.itemID && is.getItemDamage() < 8)
       || (ExtractorModOres.isModOreIngredient(is)
           && ExtractorModOres.isDust(
               ModOreList.getEntryFromDamage(is.getItemDamage() / 4), is.getItemDamage()));
 }
 @Override
 public boolean onBlockDestroyed(
     ItemStack is, World world, int blockID, int x, int y, int z, EntityLivingBase e) {
   if (is.getItemDamage() > 0 && e instanceof EntityPlayer) {
     EntityPlayer ep = (EntityPlayer) e;
     Block b = Block.blocksList[blockID];
     if (b.blockMaterial == Material.leaves) {
       is.setItemDamage(is.getItemDamage() - 1);
       int r = 3;
       for (int i = -r; i <= r; i++) {
         for (int j = -r; j <= r; j++) {
           for (int k = -r; k <= r; k++) {
             int dx = x + i;
             int dy = y + j;
             int dz = z + k;
             Block b2 = Block.blocksList[world.getBlockId(dx, dy, dz)];
             if (b2 != null && b2.blockMaterial == Material.leaves) {
               b2.dropBlockAsItem(world, dx, dy, dz, world.getBlockMetadata(dx, dy, dz), 0);
               b2.removeBlockByPlayer(world, ep, dx, dy, dz);
               is.setItemDamage(is.getItemDamage() - 1);
             }
           }
         }
       }
       e.setCurrentItemOrArmor(0, is);
       return true;
     }
   }
   return false;
 }
Beispiel #9
0
 @Override
 public String getUnlocalizedName(ItemStack p_77667_1_) {
   return "item."
       + (p_77667_1_.getItemDamage() == 1
           ? "NotoMod.usingTicket"
           : (p_77667_1_.getItemDamage() == 0 ? "NotoMod.ticket" : "NotoMod.icCard"));
 }
 public static void rebakeMap() {
   // System.out.println("Baking OreDictionary:");
   stackToId.clear();
   for (int id = 0; id < idToStack.size(); id++) {
     List<ItemStack> ores = idToStack.get(id);
     if (ores == null) continue;
     for (ItemStack ore : ores) {
       // HACK: use the registry name's ID. It is unique and it knows about substitutions
       ResourceLocation name = ore.getItem().delegate.name();
       int hash;
       if (name == null) {
         FMLLog.log(
             Level.DEBUG,
             "Defaulting unregistered ore dictionary entry for ore dictionary %s: type %s to -1",
             getOreName(id),
             ore.getItem().getClass());
         hash = -1;
       } else {
         hash = GameData.getItemRegistry().getId(name);
       }
       if (ore.getItemDamage() != WILDCARD_VALUE) {
         hash |= ((ore.getItemDamage() + 1) << 16); // +1 so meta 0 is significant
       }
       List<Integer> ids = stackToId.get(hash);
       if (ids == null) {
         ids = Lists.newArrayList();
         stackToId.put(hash, ids);
       }
       ids.add(id);
       // System.out.println(id + " " + getOreName(id) + " " + Integer.toHexString(hash) + " " +
       // ore);
     }
   }
 }
Beispiel #11
0
  public static void purgeRecipes() {

    List<ItemStack> toPurge = new ArrayList<ItemStack>();

    for (String entry : SI.CONFIG.purgerecipes) {
      Object is = SI.REGISTRY.stringToItemStack(entry);
      if (is instanceof ItemStack) {
        toPurge.add((ItemStack) is);
      }
    }

    List recipes = CraftingManager.getInstance().getRecipeList();
    List removallist = new ArrayList();

    for (ItemStack purgeEntry : toPurge) {
      for (Object entry : recipes) {
        if (entry instanceof IRecipe) {
          ItemStack output = ((IRecipe) entry).getRecipeOutput();
          if (output != null) {

            if ((output.getItem() == purgeEntry.getItem())
                && (output.getItemDamage() == 32767
                    || output.getItemDamage() == purgeEntry.getItemDamage())) {
              removallist.add(entry);
            }
          }
        }
      }
    }

    for (Object toRemove : removallist) {
      recipes.remove(toRemove);
    }
  }
  private void setPanMeta(
      World world, int x, int y, int z, EntityPlayer player, ItemStack itemstack, int setMeta) {
    TilePanHandle tile = (TilePanHandle) world.getBlockTileEntity(x, y, z);
    byte dir = tile.getDirectionByte();

    if (!player.capabilities.isCreativeMode && --itemstack.stackSize <= 0) {
      player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack) null);
    }

    if (!world.isRemote && itemstack.getItemDamage() < 4) {
      world.setBlock(x, y, z, DCsAppleMilk.filledPan.blockID, setMeta, 3);
      TilePanHandle tile2 = (TilePanHandle) world.getBlockTileEntity(x, y, z);
      tile2.setDirectionByte(dir);
    } else if (!world.isRemote && itemstack.getItemDamage() >= 4 && itemstack.getItemDamage() < 8) {
      world.setBlock(x, y, z, DCsAppleMilk.filledPan2.blockID, setMeta, 3);
      TilePanHandle tile2 = (TilePanHandle) world.getBlockTileEntity(x, y, z);
      tile2.setDirectionByte(dir);
    } else if (!world.isRemote && itemstack.getItemDamage() == 8) {
      world.setBlock(x, y, z, DCsAppleMilk.filledChocoPan.blockID);
      TileChocoPan tile2 = (TileChocoPan) world.getBlockTileEntity(x, y, z);
      tile2.setRemainByte((byte) 11);
    }

    world.playSoundAtEntity(player, "random.pop", 0.4F, 1.8F);
  }
  /** Used to check if a recipe matches current crafting inventory */
  public boolean matches(InventoryCrafting p_77569_1_, World p_77569_2_) {
    ArrayList var3 = new ArrayList(this.recipeItems);

    for (int var4 = 0; var4 < 3; ++var4) {
      for (int var5 = 0; var5 < 3; ++var5) {
        ItemStack var6 = p_77569_1_.getStackInRowAndColumn(var5, var4);

        if (var6 != null) {
          boolean var7 = false;
          Iterator var8 = var3.iterator();

          while (var8.hasNext()) {
            ItemStack var9 = (ItemStack) var8.next();

            if (var6.getItem() == var9.getItem()
                && (var9.getItemDamage() == 32767
                    || var6.getItemDamage() == var9.getItemDamage())) {
              var7 = true;
              var3.remove(var9);
              break;
            }
          }

          if (!var7) {
            return false;
          }
        }
      }
    }

    return var3.isEmpty();
  }
  /**
   * Gets the output ItemStack for the passed input.
   *
   * @param inputList ItemStack array of input items
   * @return The result ItemStack
   */
  public static ItemStack getOutputForInput(ItemStack[] inputList) {
    if (inputList.length != 5) {
      return null;
    }

    for (Entry<ItemStack[], ItemStack> recipe : CircuitFabricatorRecipes.recipes.entrySet()) {
      boolean found = true;

      for (int i = 0; i < 5; i++) {
        ItemStack recipeStack = recipe.getKey()[i];
        ItemStack inputStack = inputList[i];

        if (recipeStack == null || inputStack == null) {
          if (recipeStack != null || inputStack != null) {
            found = false;
            break;
          }
        } else if (recipeStack.getItem() != inputStack.getItem()
            || recipeStack.getItemDamage() != inputStack.getItemDamage()) {
          found = false;
          break;
        }
      }

      if (!found) {
        continue;
      }

      return recipe.getValue();
    }

    return CircuitFabricatorRecipes.recipes.get(inputList);
  }
Beispiel #15
0
 @Override
 public boolean onItemUse(
     ItemStack itemStack,
     EntityPlayer player,
     World world,
     int x,
     int y,
     int z,
     int side,
     float hitX,
     float hitY,
     float hitZ) {
   if (!world.isRemote) {
     if (world.getBlock(x, y, z).equals(Blocks.iron_block)) {
       world.setBlock(x, y, z, Blocks.air);
       for (int i = 0; i < 3; i++) {
         world.spawnEntityInWorld(
             new EntityItem(world, x, y, z, new ItemStack(ItemHandler.ironHard)));
       }
       int itemDamage = itemStack.getItemDamage();
       itemStack.setItemDamage(itemDamage + 1);
       int itemDamageAfter = itemStack.getItemDamage();
       if (itemDamageAfter >= Info.Items.HAMMER_MAX_DAMAGE) {
         itemStack.stackSize = 0;
       }
       return true;
     }
   }
   return false;
 }
  /** Used to check if a recipe matches current crafting inventory */
  public boolean matches(InventoryCrafting p_77569_1_, World p_77569_2_) {
    ArrayList arraylist = new ArrayList(this.recipeItems);

    for (int i = 0; i < 3; ++i) {
      for (int j = 0; j < 3; ++j) {
        ItemStack itemstack = p_77569_1_.getStackInRowAndColumn(j, i);

        if (itemstack != null) {
          boolean flag = false;
          Iterator iterator = arraylist.iterator();

          while (iterator.hasNext()) {
            ItemStack itemstack1 = (ItemStack) iterator.next();

            if (itemstack.getItem() == itemstack1.getItem()
                && (itemstack1.getItemDamage() == 32767
                    || itemstack.getItemDamage() == itemstack1.getItemDamage())) {
              flag = true;
              arraylist.remove(itemstack1);
              break;
            }
          }

          if (!flag) {
            return false;
          }
        }
      }
    }

    return arraylist.isEmpty();
  }
  /**
   * Adds an ItemStack to the first available slot in the provided IInventory, continuing to
   * distribute the stack as necessary until the stacksize reaches 0, if possible
   *
   * @return the number of items remaining in the stack, zero if all were added
   */
  public static int addItemToInventory(ItemStack stack, IInventory inv) {
    int remaining = stack.stackSize;
    for (int i = 0; i < inv.getSizeInventory() && remaining > 0; ++i) {
      ItemStack slotstack = inv.getStackInSlot(i);
      if (slotstack == null && inv.isItemValidForSlot(i, stack)) {
        remaining -= inv.getInventoryStackLimit();
        stack.stackSize = (remaining > 0 ? inv.getInventoryStackLimit() : stack.stackSize);
        inv.setInventorySlotContents(i, stack);
        inv.markDirty();
      } else if (slotstack != null && stack.isStackable() && inv.isItemValidForSlot(i, stack)) {
        if (slotstack.getItem() == stack.getItem()
            && (!stack.getHasSubtypes() || stack.getItemDamage() == slotstack.getItemDamage())
            && ItemStack.areItemStackTagsEqual(stack, slotstack)) {
          int l = slotstack.stackSize + remaining;
          if (l <= stack.getMaxStackSize() && l <= inv.getInventoryStackLimit()) {
            remaining = 0;
            slotstack.stackSize = l;
            inv.markDirty();
          } else if (slotstack.stackSize < stack.getMaxStackSize()
              && stack.getMaxStackSize() <= inv.getInventoryStackLimit()) {
            remaining -= stack.getMaxStackSize() - slotstack.stackSize;
            slotstack.stackSize = stack.getMaxStackSize();
            inv.markDirty();
          }
        }
      }
    }

    return remaining;
  }
  /** @return a string representation of the object. */
  @Override
  public String toString() {
    if (wrappedStack instanceof ItemStack) {
      ItemStack itemStack = (ItemStack) wrappedStack;
      String unlocalizedName = "";
      try {
        unlocalizedName = itemStack.getUnlocalizedName();
      } catch (ArrayIndexOutOfBoundsException e) {
        unlocalizedName = "no-name";
      }

      if (itemStack.hasTagCompound()) {
        return String.format(
            "%sxitemStack[%s@%s:%s]",
            stackSize, unlocalizedName, itemStack.getItemDamage(), itemStack.getTagCompound());
      } else {
        return String.format(
            "%sxitemStack[%s@%s]", stackSize, unlocalizedName, itemStack.getItemDamage());
      }
    } else if (wrappedStack instanceof OreStack) {
      OreStack oreStack = (OreStack) wrappedStack;
      return String.format("%sxoreStack.%s", stackSize, oreStack.oreName);
    } else if (wrappedStack instanceof FluidStack) {
      FluidStack fluidStack = (FluidStack) wrappedStack;
      return String.format("%sxfluidStack.%s", stackSize, fluidStack.getFluid().getName());
    } else {
      return "null-wrappedstack";
    }
  }
 public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
   if (player.isSneaking()) {
     ItemStack newStack = new ItemStack(ModObjects.heartWand, 1, stack.getItemDamage() + 1);
     if (newStack.getItemDamage() >= 3) {
       newStack.setItemDamage(0);
     }
     return newStack;
   } else {
     ItemStack container;
     switch (stack.getItemDamage()) {
       case 0:
         container = LifeSystem.findFilledLifeContainer(player.inventory.mainInventory);
         if (container != null && player.getHealth() < player.getMaxHealth()) {
           if (((ILifeContainer) container.getItem()).takeLife(container, 1) > 0) {
             player.heal(1f);
             player.addStat(ModAchievements.useLP, 1);
           }
         }
         break;
       case 1:
         break;
       case 2:
         container = LifeSystem.findEmptyLifeContainer(player.inventory.mainInventory);
         if (container != null && player.attackEntityFrom(ModObjects.sacrifice, 1f)) {
           if (((ILifeContainer) container.getItem()).addLife(container, 1) > 0) {
             player.addStat(ModAchievements.useHeartWand, 1);
           }
         }
         break;
     }
   }
   return stack;
 }
 @SuppressWarnings({"rawtypes", "unchecked"})
 @Override
 @SideOnly(Side.CLIENT)
 public void addInformation(ItemStack stack, EntityPlayer player, List info, boolean par4) {
   NBTTagCompound c = stack.getTagCompound();
   if (getBlockID() == Machine.DeepStorageUnit.getBlockId()
       && stack.getItemDamage() == Machine.DeepStorageUnit.getMeta()
       && c != null) {
     if (c.hasKey("storedStack")) {
       ItemStack storedItem = ItemStack.loadItemStackFromNBT(c.getCompoundTag("storedStack"));
       int storedQuantity = c.getInteger("storedQuantity");
       if (storedItem != null & storedQuantity > 0) {
         info.add(
             "Contains "
                 + storedQuantity
                 + " "
                 + storedItem.getDisplayName()
                 + " ("
                 + storedItem.itemID
                 + ":"
                 + storedItem.getItemDamageForDisplay()
                 + ")");
       } else {
         // info.add("Empty");
       }
     }
   } else if (getBlockID() == Machine.BioFuelGenerator.getBlockId()
       && stack.getItemDamage() == Machine.BioFuelGenerator.getMeta()) {
     info.add("Produces MJ only.");
   }
 }
 /**
  * @param stack1 The {@link ItemStack} being compared.
  * @param stack2 The {@link ItemStack} to compare to.
  * @return whether the two items are the same in terms of damage and itemID.
  */
 public static boolean areStacksSameType(ItemStack stack1, ItemStack stack2) {
   return stack1 != null
       && stack2 != null
       && (stack1.getItem() == stack2.getItem()
           && (!stack2.getHasSubtypes() || stack2.getItemDamage() == stack1.getItemDamage())
           && ItemStack.areItemStackTagsEqual(stack2, stack1));
 }
 public void onBlockPlacedBy(
     World world, int x, int y, int z, EntityLivingBase living, ItemStack stack) {
   int meta = 0;
   int direction =
       MathHelper.floor_double((double) (living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3;
   if (stack.getItemDamage() == 0) {
     if (direction == 0) meta = 0;
     if (direction == 1) meta = 4;
     if (direction == 2) meta = 8;
     if (direction == 3) meta = 12;
   }
   if (stack.getItemDamage() == 1) {
     if (direction == 0) meta = 1;
     if (direction == 1) meta = 5;
     if (direction == 2) meta = 9;
     if (direction == 3) meta = 13;
   }
   if (stack.getItemDamage() == 2) {
     if (direction == 0) meta = 2;
     if (direction == 1) meta = 6;
     if (direction == 2) meta = 10;
     if (direction == 3) meta = 14;
   }
   if (stack.getItemDamage() == 3) meta = 3;
   world.setBlockMetadataWithNotify(x, y, z, meta, 2);
 }
  /**
   * Called frequently so the entity can update its state every tick as required. For example,
   * zombies and skeletons use this to react to sunlight and start to burn.
   */
  public void onLivingUpdate() {
    if (this.worldObj.isDaytime() && !this.worldObj.isRemote) {
      float f = this.getBrightness(1.0F);

      if (f > 0.5F
          && this.rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F
          && this.worldObj.canBlockSeeSky(
              new BlockPos(
                  MathHelper.floor_double(this.posX),
                  MathHelper.floor_double(this.posY),
                  MathHelper.floor_double(this.posZ)))) {
        boolean flag = true;
        ItemStack itemstack = this.getEquipmentInSlot(4);

        if (itemstack != null) {
          if (itemstack.isItemStackDamageable()) {
            itemstack.setItemDamage(itemstack.getItemDamage() + this.rand.nextInt(2));

            if (itemstack.getItemDamage() >= itemstack.getMaxDamage()) {
              this.renderBrokenItemStack(itemstack);
              this.setCurrentItemOrArmor(4, (ItemStack) null);
            }
          }

          flag = false;
        }
      }
    }

    super.onLivingUpdate();
  }
Beispiel #24
0
 @Override
 public String getUnlocalizedName(ItemStack stack) {
   if (stack.getItemDamage() > 2) {
     return "item." + Names.gun_part + "_" + "0";
   }
   return "item." + Names.gun_part + "_" + String.valueOf(stack.getItemDamage());
 }
  @SuppressWarnings("incomplete-switch")
  @Override
  public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
    if (!stack.hasTagCompound()) stack.setTagCompound(new NBTTagCompound());

    if (stack.getItemDamage() >= stack.getMaxDamage() - 2) {
      NBTTagCompound tag = stack.getTagCompound();
      tag.setBoolean("destroyed", true);
      stack.setTagCompound(tag);

      return;
    }

    switch (this.armorType) {
      case HEAD:
        if (stack.getTagCompound().getBoolean("respiration")
            && stack.getItemDamage() < stack.getMaxDamage() - 16)
          if (player.getAir() == 0) {
            player.setAir(150);
            stack.damageItem(16, player);
          }
        break;
      case LEGS:
      case FEET:
        if (stack.getTagCompound().getBoolean("fall")) {
          if (player.fallDistance > 0) player.fallDistance = 0;
        }
    }
  }
Beispiel #26
0
  @Override
  public String getUnlocalizedName(ItemStack par1ItemStack) {
    if (this.icons.length > par1ItemStack.getItemDamage()) {
      return "item." + GCMoonItem.names[par1ItemStack.getItemDamage()];
    }

    return "unnamed";
  }
Beispiel #27
0
  @Override
  public String getUnlocalizedName(ItemStack itemStack) {
    if (itemStack.getItemDamage() > 14 && itemStack.getItemDamage() < 19) {
      return this.getUnlocalizedName() + ".cannedFood";
    }

    return this.getUnlocalizedName() + "." + ItemBasic.names[itemStack.getItemDamage()];
  }
Beispiel #28
0
 @Override
 public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean selected) {
   if (random.nextInt(40) == 0) {
     if (stack.getItemDamage() > 0) {
       stack.setItemDamage(stack.getItemDamage() - 1);
     }
   }
 }
Beispiel #29
0
  @Override
  public EnumAction getItemUseAction(ItemStack par1ItemStack) {
    if (par1ItemStack.getItemDamage() > 14 && par1ItemStack.getItemDamage() < 19) {
      return EnumAction.eat;
    }

    return super.getItemUseAction(par1ItemStack);
  }
Beispiel #30
0
 public static boolean canInsertBIntoA(ItemStack a, ItemStack b) {
   return a == null
       || (b != null
           && a.getItem() == b.getItem()
           && a.getItemDamage() == b.getItemDamage()
           && ItemStack.areItemStackTagsEqual(a, b)
           && a.stackSize + b.stackSize <= a.getMaxStackSize());
 }