ForgePatch/patches/minecraft/net/minecraft/tags/NetworkTagManager.java.patch

35 lines
3.3 KiB
Diff

--- a/net/minecraft/tags/NetworkTagManager.java
+++ b/net/minecraft/tags/NetworkTagManager.java
@@ -20,6 +20,7 @@
protected TagCollectionReader<Item> field_199720_b = new TagCollectionReader<>(Registry.field_212630_s::func_241873_b, "tags/items", "item");
protected TagCollectionReader<Fluid> field_205705_c = new TagCollectionReader<>(Registry.field_212619_h::func_241873_b, "tags/fluids", "fluid");
protected TagCollectionReader<EntityType<?>> field_215299_d = new TagCollectionReader<>(Registry.field_212629_r::func_241873_b, "tags/entity_types", "entity_type");
+ protected Map<ResourceLocation, TagCollectionReader<?>> customTagTypeReaders = net.minecraftforge.common.ForgeTagHandler.createCustomTagTypeReaders();
private ITagCollectionSupplier field_242230_e = ITagCollectionSupplier.field_242208_a;
public ITagCollectionSupplier func_242231_a() {
@@ -31,11 +32,13 @@
CompletableFuture<Map<ResourceLocation, ITag.Builder>> completablefuture1 = this.field_199720_b.func_242224_a(p_215226_2_, p_215226_5_);
CompletableFuture<Map<ResourceLocation, ITag.Builder>> completablefuture2 = this.field_205705_c.func_242224_a(p_215226_2_, p_215226_5_);
CompletableFuture<Map<ResourceLocation, ITag.Builder>> completablefuture3 = this.field_215299_d.func_242224_a(p_215226_2_, p_215226_5_);
- return CompletableFuture.allOf(completablefuture, completablefuture1, completablefuture2, completablefuture3).thenCompose(p_215226_1_::func_216872_a).thenAcceptAsync((p_232979_5_) -> {
+ CompletableFuture<java.util.List<net.minecraftforge.common.ForgeTagHandler.TagCollectionReaderInfo>> customTagTypeResults = net.minecraftforge.common.ForgeTagHandler.getCustomTagTypeReloadResults(p_215226_2_, p_215226_5_, customTagTypeReaders);
+ return CompletableFuture.allOf(completablefuture, completablefuture1, completablefuture2, completablefuture3, customTagTypeResults).thenCompose(p_215226_1_::func_216872_a).thenAcceptAsync((p_232979_5_) -> {
ITagCollection<Block> itagcollection = this.field_199719_a.func_242226_a(completablefuture.join());
ITagCollection<Item> itagcollection1 = this.field_199720_b.func_242226_a(completablefuture1.join());
ITagCollection<Fluid> itagcollection2 = this.field_205705_c.func_242226_a(completablefuture2.join());
ITagCollection<EntityType<?>> itagcollection3 = this.field_215299_d.func_242226_a(completablefuture3.join());
+ net.minecraftforge.common.ForgeTagHandler.updateCustomTagTypes(customTagTypeResults.join());
ITagCollectionSupplier itagcollectionsupplier = ITagCollectionSupplier.func_242209_a(itagcollection, itagcollection1, itagcollection2, itagcollection3);
Multimap<ResourceLocation, ResourceLocation> multimap = TagRegistryManager.func_242198_b(itagcollectionsupplier);
if (!multimap.isEmpty()) {
@@ -43,6 +46,8 @@
return p_232978_0_.getKey() + ":" + p_232978_0_.getValue();
}).sorted().collect(Collectors.joining(",")));
} else {
+ itagcollectionsupplier = ITagCollectionSupplier.reinjectOptionalTags(itagcollectionsupplier);
+ net.minecraftforge.common.ForgeTagHandler.reinjectOptionalTagsCustomTypes();
TagCollectionManager.func_242180_a(itagcollectionsupplier);
this.field_242230_e = itagcollectionsupplier;
}