To effectively evaluate the equality of ItemStack and FluidStacks, REI by default ignores the nbt contents of the stacks with fuzzy comparison context, and compares the nbt contents of the stacks with exact comparison context.

<aside> 💡 Learn more about the equality of EntryStacks with Comparison Contexts.

</aside>

Registering the custom comparators

In a server plugin (Constructing Plugins), override registerItemComparators or registerFluidComparators, from here, you may register your own comparator.

It is important to take note of the comparison context here. For your convenience, you may compare the nbt of the object on both comparison contexts with registerNbt.

Comparing NBTs

EntryComparator.nbt(ignoredKeys) is a way to compare nbts easily, while ignoring some tags. For example, this can be used to ignore the "Amount" key, since REI does not consider objects with different amount as different objects.