package info.u_team.u_team_core.util;

import java.util.*;
import java.util.stream.Stream;

import net.minecraft.block.Block;
import net.minecraft.entity.EntityType;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.*;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.item.crafting.Ingredient.TagList;
import net.minecraft.tags.*;
import net.minecraft.util.ResourceLocation;

public class TagUtil {
	
	public static Tag<Block> createBlockTag(String modid, String name) {
		return createBlockTag(new ResourceLocation(modid, name));
	}
	
	public static Tag<Block> createBlockTag(ResourceLocation location) {
		return new BlockTags.Wrapper(location);
	}
	
	public static Tag<Item> createItemTag(String modid, String name) {
		return createItemTag(new ResourceLocation(modid, name));
	}
	
	public static Tag<Item> createItemTag(ResourceLocation location) {
		return new ItemTags.Wrapper(location);
	}
	
	public static Tag<Fluid> createFluidTag(String modid, String name) {
		return createFluidTag(new ResourceLocation(modid, name));
	}
	
	public static Tag<Fluid> createFluidTag(ResourceLocation location) {
		return new FluidTags.Wrapper(location);
	}
	
	public static Tag<EntityType<?>> createEntityTypeTag(String modid, String name) {
		return createEntityTypeTag(new ResourceLocation(modid, name));
	}
	
	public static Tag<EntityType<?>> createEntityTypeTag(ResourceLocation location) {
		return new EntityTypeTags.Wrapper(location);
	}
	
	public static Tag<Block> fromItemTag(Tag<Item> block) {
		return new BlockTags.Wrapper(block.getId());
	}
	
	public static Tag<Item> fromBlockTag(Tag<Block> block) {
		return new ItemTags.Wrapper(block.getId());
	}
	
	public static Ingredient getSerializableIngredientOfTag(Tag<Item> tag) {
		return Ingredient.fromItemListStream(Stream.of(new TagList(tag) {
			
			@Override
			public Collection<ItemStack> getStacks() {
				return Arrays.asList(new ItemStack(Items.ACACIA_BOAT)); // Return default value, so the ingredient will serialize our tag.
			}
		}));
	}
}

@@ -349,24 +349,66 @@
 aft.tags.*;%0A
+import net.minecraft.tags.ITag.INamedTag;%0A
 import net.m
@@ -472,32 +472,38 @@
 %0A%09public static 
+INamed
 Tag%3CBlock%3E creat
@@ -613,32 +613,38 @@
 %0A%09public static 
+INamed
 Tag%3CBlock%3E creat
@@ -683,36 +683,32 @@
 ion) %7B%0A%09%09return 
-new 
 BlockTags.Wrappe
@@ -697,31 +697,38 @@
 n BlockTags.
+make
 Wrapper
+Tag
 (location);%0A
@@ -716,32 +716,43 @@
 pperTag(location
+.toString()
 );%0A%09%7D%0A%09%0A%09public 
@@ -750,32 +750,38 @@
 %0A%09public static 
+INamed
 Tag%3CItem%3E create
@@ -888,32 +888,38 @@
 %0A%09public static 
+INamed
 Tag%3CItem%3E create
@@ -956,36 +956,32 @@
 ion) %7B%0A%09%09return 
-new 
 ItemTags.Wrapper
@@ -969,31 +969,38 @@
 rn ItemTags.
+make
 Wrapper
+Tag
 (location);%0A
@@ -988,32 +988,43 @@
 pperTag(location
+.toString()
 );%0A%09%7D%0A%09%0A%09public 
@@ -1022,32 +1022,38 @@
 %0A%09public static 
+INamed
 Tag%3CFluid%3E creat
@@ -1167,24 +1167,30 @@
 blic static 
+INamed
 Tag%3CFluid%3E c
@@ -1241,20 +1241,16 @@
 %09return 
-new 
 FluidTag
@@ -1247,31 +1247,38 @@
 n FluidTags.
+make
 Wrapper
+Tag
 (location);%0A
@@ -1266,32 +1266,43 @@
 pperTag(location
+.toString()
 );%0A%09%7D%0A%09%0A%09public 
@@ -1300,32 +1300,38 @@
 %0A%09public static 
+INamed
 Tag%3CEntityType%3C?
@@ -1463,24 +1463,30 @@
 blic static 
+INamed
 Tag%3CEntityTy
@@ -1550,20 +1550,16 @@
 %09return 
-new 
 EntityTy
@@ -1569,24 +1569,42 @@
 ags.
-Wrapper(location
+func_232896_a_(location.toString()
 );%0A%09

Fix main parts of the tag util