diff --git a/src/main/java/net/neoforged/neoforge/common/crafting/SizedIngredient.java b/src/main/java/net/neoforged/neoforge/common/crafting/SizedIngredient.java index f55e959612..a712886557 100644 --- a/src/main/java/net/neoforged/neoforge/common/crafting/SizedIngredient.java +++ b/src/main/java/net/neoforged/neoforge/common/crafting/SizedIngredient.java @@ -7,6 +7,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.Objects; import java.util.stream.Stream; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; @@ -143,6 +144,18 @@ public ItemStack[] getItems() { return cachedStacks; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof SizedIngredient other)) return false; + return count == other.count && ingredient.equals(other.ingredient); + } + + @Override + public int hashCode() { + return Objects.hash(ingredient, count); + } + @Override public String toString() { return count + "x " + ingredient;