@Override public boolean equals(Object o) { if(this == o) { return true; } if(o == null || getClass() != o.getClass()) { return false; } CacheKey cacheKey = (CacheKey) o; if(parent != null ? parent != cacheKey.parent : cacheKey.parent != null) { return false; } return data != null ? data.equals(cacheKey.data) : cacheKey.data == null; }
@Override public boolean equals(Object o) { if(this == o) { return true; } if(o == null || getClass() != o.getClass()) { return false; } if(!super.equals(o)) { return false; } CacheKeyAmmo that = (CacheKeyAmmo) o; // if we have an item if(ammoItem != null) { // it must be equal and have equal meta if(!ammoItem.equals(that.ammoItem) || ammoMeta != that.ammoMeta) { return false; } } else { // if no item, both must have no item if(that.ammoItem != null) { return false; } } return ammoData != null ? ammoData.equals(that.ammoData) : that.ammoData == null; }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } //noinspection SimplifiableIfStatement if (!(obj instanceof ItemHashEntry)) { return false; } return itemTag.equals(((ItemHashEntry) obj).itemTag); }
/** * Determine if two NBTTagCompounds are equal. */ public static boolean doNBTsMatch(NBTTagCompound nbtA, NBTTagCompound nbtB) { return nbtA == null && nbtB == null || nbtA != null && nbtB != null && nbtA.equals(nbtB); }
@Override public boolean equals(int otherItemID, int otherMeta, NBTTagCompound otherNbt) { return itemID == otherItemID && meta == otherMeta && ((nbt == otherNbt) || (nbt != null && nbt.equals(otherNbt))); }
private boolean compareStacks(ItemStack recipe, ItemStack supplied) { if(recipe.getItem() == supplied.getItem() && recipe.getItemDamage() == supplied.getItemDamage()) { //check that the user supplied nbt tag is a superset of the recipe item nbt tag //if the recipe doesn't have an NBT tag, the user supplied one doesn't matter, it is a superset if(!recipe.hasTagCompound()) return true; //if the recipe does have an NBT tag but the user supplied doesn't, also no way it's a superset if(!supplied.hasTagCompound()) return false; NBTTagCompound mergedNBT = supplied.getTagCompound().copy(); mergedNBT.merge(recipe.getTagCompound()); return supplied.getTagCompound().equals(mergedNBT); } return false; }
@Override public boolean equals(Object par1Obj) { if (par1Obj instanceof FinalNBTTagCompound && hashcode != par1Obj.hashCode()) { return false; } return super.equals(par1Obj); } }
@Override public boolean equals(Object o) { if (!(o instanceof BlockInfo)) return false; BlockInfo ok = (BlockInfo)o; if (!this.blockState.equals(ok.blockState)) return false; if ((this.nbt != null || ok.nbt != null) && (this.nbt == null || !this.nbt.equals(ok.nbt))) return false; return true; } public IBlockState getBlockState() {
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; StackNBTHolder that = (StackNBTHolder) o; return tag != null ? tag.equals(that.tag) : that.tag == null; }
private boolean isNBTMatch(@Nonnull ItemStack filter, @Nonnull ItemStack item) { return getTag(filter).equals(getTag(item)); }
@Nullable public static BlockPos getPOSFromNBT(NBTTagCompound tagCompound, String tagName) { if (tagCompound == null) { return null; } NBTTagCompound posTag = tagCompound.getCompoundTag(tagName); if (posTag.equals(new NBTTagCompound())) { return null; } return NBTUtil.getPosFromTag(posTag); }
public boolean contains(@Nullable ItemStack itemStack) { // sic! if (itemStack != null && !itemStack.isEmpty()) { for (IThing thing : things) { if (thing.is(itemStack) && (nbt == null || nbt.equals(itemStack.getTagCompound()))) { return true; } } } return false; }
@Override @SuppressWarnings("squid:S2259") public boolean test(ItemStack input) { //noinspection ConstantConditions return input.getItem() == item && metaMatches.test(input.getMetadata()) && (tagCompound == null && !input.hasTagCompound() || tagCompound.equals(input.getTagCompound())); }
@Nullable public static BlockPos getPOSFromNBT(ItemStack stack, String tagName) { NBTTagCompound tagCompound = stack.getTagCompound(); if (tagCompound == null) { return null; } NBTTagCompound posTag = tagCompound.getCompoundTag(tagName); if (posTag.equals(new NBTTagCompound())) { return null; } return NBTUtil.getPosFromTag(posTag); }
@Nullable public static Integer getDIMFromNBT(ItemStack stack, String tagName) { NBTTagCompound tagCompound = stack.getTagCompound(); if (tagCompound == null) { return null; } NBTTagCompound posTag = tagCompound.getCompoundTag(tagName); if (posTag.equals(new NBTTagCompound())) { return null; } return posTag.getInteger("dim"); }
@Override public boolean differenciate(StackHolder holder1, StackHolder holder2) { if(holder1.stack.hasTagCompound()) return !holder1.stack.getTagCompound().equals(holder2.stack.getTagCompound()); else return holder2.stack.hasTagCompound(); } }
private void handle(PacketBlockMap message) { if (message.tag.equals(new NBTTagCompound())) { PasteToolBufferBuilder.clearMaps(); } String UUID = message.tag.getString("UUID"); PasteToolBufferBuilder.addToMap(UUID, message.tag); PasteToolBufferBuilder.addMapToBuffer(UUID); //System.out.println("Sent blockmap for: " + UUID); } }
public boolean matches(ItemStack itemStack) { if (this.itemStack != null) { return itemStack.getItem().equals(this.itemStack.getItem()) && (ignoreDamage || itemStack.getItemDamage() == this.itemStack.getItemDamage()) && (ignoreNBT || ItemStack.areItemStackTagsEqual(itemStack, this.itemStack)); } else { return itemStack.getItem().getRegistryName().toString().equals(name) && (ignoreDamage || itemDamage == itemStack.getItemDamage()) && (ignoreNBT || (nbtTagCompound == null || nbtTagCompound.equals(itemStack.getTagCompound()))); } } }
private static boolean checkOutput(ItemStack resultStack, ItemStack stack, boolean checkNBT) { if (!stack.isEmpty() && !resultStack.isEmpty()) { if (resultStack.getItem() == stack.getItem() && resultStack.getItemDamage() == stack.getItemDamage()) { if (!checkNBT || resultStack.getTagCompound() == null && stack.getTagCompound() == null || resultStack.getTagCompound() != null && resultStack.getTagCompound().equals(stack.getTagCompound())) { return true; } } } return false; }
public static boolean areStacksTheSame(ItemStack stack1, ItemStack stack2, boolean matchSize) { if (stack1.isEmpty() || stack2.isEmpty()) return false; if (stack1.getItem() == stack2.getItem()) if (stack1.getItemDamage() == stack2.getItemDamage() || isWildcard(stack1.getItemDamage()) || isWildcard(stack2.getItemDamage())) if (!matchSize || stack1.getCount() == stack2.getCount()) { if (stack1.hasTagCompound() && stack2.hasTagCompound()) return stack1.getTagCompound().equals(stack2.getTagCompound()); return stack1.hasTagCompound() == stack2.hasTagCompound(); } return false; }