Interface IAttachmentComparator<T>


public interface IAttachmentComparator<T>
Custom comparator for data attachments, to improve efficiency compared to the default Objects.equals(serializer.write(first), serializer.write(second)) implementation.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    areCompatible(T first, T second)
    Checks whether two data attachments are compatible.
  • Method Details

    • areCompatible

      boolean areCompatible(T first, T second)
      Checks whether two data attachments are compatible.

      If the attachments are not compatible, this will prevent item stacks from being stacked together.

      This function should give the same result as the serialized versions of the attachments with Objects.equals(serializer.write(first), serializer.write(second)), but will often be faster and allocate less.