From c28a2d2c2ab9abb76fa6445401009fc88b55a7c5 Mon Sep 17 00:00:00 2001 From: SilentChaos512 Date: Fri, 20 Dec 2024 16:12:43 -0600 Subject: [PATCH] Add hashCode to DataResource and correct hashCode of PartInstance (#753) --- CHANGELOG.md | 1 + .../java/net/silentchaos512/gear/api/util/DataResource.java | 5 +++++ .../java/net/silentchaos512/gear/gear/part/PartInstance.java | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b02c6abc..992c0c6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Keybindings not being present in the Controls menu. They can now be reassigned again. [#761] - Changed `c:ores_in_ground/endstone` tags to `c:ores_in_ground/end_stone` [#760] - Rework enchantable tags so more items can be enchanted [#754] +- Possible fix for gear items not being extractable from Refined Storage networks [#753] - Arrows now behave more or less as intended. They now stack and no longer have a damage value. They can no longer be "repaired," you must craft more instead. [#730] ## [1.21.1-4.0.9] - 2024-11-24 diff --git a/src/main/java/net/silentchaos512/gear/api/util/DataResource.java b/src/main/java/net/silentchaos512/gear/api/util/DataResource.java index c7910af7..003d6bac 100644 --- a/src/main/java/net/silentchaos512/gear/api/util/DataResource.java +++ b/src/main/java/net/silentchaos512/gear/api/util/DataResource.java @@ -120,6 +120,11 @@ public boolean equals(Object obj) { return this.getId().equals(other.getId()); } + @Override + public int hashCode() { + return this.getId().hashCode(); + } + public static final Codec> MATERIAL_CODEC = ResourceLocation.CODEC.xmap( DataResource::material, DataResource::getId diff --git a/src/main/java/net/silentchaos512/gear/gear/part/PartInstance.java b/src/main/java/net/silentchaos512/gear/gear/part/PartInstance.java index f882b38a..db19415e 100644 --- a/src/main/java/net/silentchaos512/gear/gear/part/PartInstance.java +++ b/src/main/java/net/silentchaos512/gear/gear/part/PartInstance.java @@ -274,6 +274,6 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(part, craftingItem); + return Objects.hash(part, ItemStack.hashItemAndComponents(craftingItem)); } }