package ru.dbotthepony.mc.otm.container

import it.unimi.dsi.fastutil.Hash
import net.minecraft.world.item.ItemStack

object ItemStackHashStrategy : Hash.Strategy<ItemStack> {
	override fun equals(a: ItemStack?, b: ItemStack?): Boolean {
		return a === b || a != null && b != null && ItemStack.isSameItemSameTags(a, b)
	}

	override fun hashCode(o: ItemStack?): Int {
		o ?: return 0
		return o.item.hashCode().xor(o.tag.hashCode())
	}
}
