From 178e3d244a75e3a366ed476cab294f53dad3d8a0 Mon Sep 17 00:00:00 2001 From: Cyborgmas Date: Tue, 8 Sep 2020 16:25:23 -0400 Subject: [PATCH] Prevent duplicate wrapper tags from crashing (#7283) --- .../tags/TagCollectionManager.java.patch | 20 +++++++++++++++++++ .../net/minecraft/tags/TagRegistry.java.patch | 4 +++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 patches/minecraft/net/minecraft/tags/TagCollectionManager.java.patch diff --git a/patches/minecraft/net/minecraft/tags/TagCollectionManager.java.patch b/patches/minecraft/net/minecraft/tags/TagCollectionManager.java.patch new file mode 100644 index 000000000..bbacc1f1a --- /dev/null +++ b/patches/minecraft/net/minecraft/tags/TagCollectionManager.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/tags/TagCollectionManager.java ++++ b/net/minecraft/tags/TagCollectionManager.java +@@ -3,13 +3,13 @@ + import java.util.stream.Collectors; + + public class TagCollectionManager { +- private static volatile ITagCollectionSupplier field_232918_a_ = ITagCollectionSupplier.func_242209_a(ITagCollection.func_242202_a(BlockTags.func_242174_b().stream().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242183_0_) -> { ++ private static volatile ITagCollectionSupplier field_232918_a_ = ITagCollectionSupplier.func_242209_a(ITagCollection.func_242202_a(BlockTags.func_242174_b().stream().distinct().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242183_0_) -> { + return p_242183_0_; +- }))), ITagCollection.func_242202_a(ItemTags.func_242177_b().stream().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242182_0_) -> { ++ }))), ITagCollection.func_242202_a(ItemTags.func_242177_b().stream().distinct().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242182_0_) -> { + return p_242182_0_; +- }))), ITagCollection.func_242202_a(FluidTags.func_241280_c_().stream().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242181_0_) -> { ++ }))), ITagCollection.func_242202_a(FluidTags.func_241280_c_().stream().distinct().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242181_0_) -> { + return p_242181_0_; +- }))), ITagCollection.func_242202_a(EntityTypeTags.func_242175_b().stream().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242179_0_) -> { ++ }))), ITagCollection.func_242202_a(EntityTypeTags.func_242175_b().stream().distinct().collect(Collectors.toMap(ITag.INamedTag::func_230234_a_, (p_242179_0_) -> { + return p_242179_0_; + })))); + diff --git a/patches/minecraft/net/minecraft/tags/TagRegistry.java.patch b/patches/minecraft/net/minecraft/tags/TagRegistry.java.patch index 1341bef05..81239d268 100644 --- a/patches/minecraft/net/minecraft/tags/TagRegistry.java.patch +++ b/patches/minecraft/net/minecraft/tags/TagRegistry.java.patch @@ -26,7 +26,7 @@ ImmutableSet immutableset = ImmutableSet.copyOf(itagcollection.func_199908_a()); return Sets.difference(set, immutableset); } -@@ -93,5 +101,43 @@ +@@ -93,5 +101,45 @@ public List func_230236_b_() { return this.func_232944_c_().func_230236_b_(); } @@ -35,6 +35,8 @@ + public String toString() { + return "NamedTag[" + func_230234_a_().toString() + ']'; + } ++ @Override public boolean equals(Object o) { return (o == this) || (o instanceof ITag.INamedTag && java.util.Objects.equals(this.func_230234_a_(), ((ITag.INamedTag)o).func_230234_a_())); } ++ @Override public int hashCode() { return func_230234_a_().hashCode(); } } + + private static class OptionalNamedTag extends NamedTag implements net.minecraftforge.common.Tags.IOptionalNamedTag {