set = TAGS_BLOCK.computeIfAbsent(tagID, k -> Sets.newHashSet());
@@ -26,7 +44,20 @@ public class TagHelper {
}
}
}
-
+
+ /**
+ * Adds one Tag to multiple Items.
+ *
+ * Example:
+ * {@code Tag.Named- METALS = makeBlockTag("mymod", "metals");
+ * TagHelper.addTag(METALS, Items.IRON_INGOT, Items.GOLD_INGOT, Items.COPPER_INGOT);}
+ *
+ * The call will reserve the Tag. The Tag is added to the items once
+ * {@link #apply(String, Map)} was executed.
+ *
+ * @param tag The new Tag
+ * @param items One or more item that should receive the Tag.
+ */
public static void addTag(Tag.Named- tag, ItemLike... items) {
ResourceLocation tagID = tag.getName();
Set set = TAGS_ITEM.computeIfAbsent(tagID, k -> Sets.newHashSet());
@@ -37,26 +68,62 @@ public class TagHelper {
}
}
}
-
+
+ /**
+ * Adds multiple Tags to one Item.
+ *
+ * The call will reserve the Tags. The Tags are added to the Item once
+ * * {@link #apply(String, Map)} was executed.
+ *
+ * @param item The Item that will receive all Tags
+ * @param tags One or more Tags
+ */
@SafeVarargs
public static void addTags(ItemLike item, Tag.Named
- ... tags) {
for (Tag.Named
- tag : tags) {
addTag(tag, item);
}
}
-
+
+ /**
+ * Adds multiple Tags to one Block.
+ *
+ * The call will reserve the Tags. The Tags are added to the Block once
+ * * {@link #apply(String, Map)} was executed.
+ *
+ * @param block The Block that will receive all Tags
+ * @param tags One or more Tags
+ */
@SafeVarargs
public static void addTags(Block block, Tag.Named... tags) {
for (Tag.Named tag : tags) {
addTag(tag, block);
}
}
-
+
+ /**
+ * Adds all {@code ids} to the {@code builder}.
+ * @param builder
+ * @param ids
+ *
+ * @return The Builder passed as {@code builder}.
+ */
public static Tag.Builder apply(Tag.Builder builder, Set ids) {
ids.forEach(value -> builder.addElement(value, "Better End Code"));
return builder;
}
-
+
+ /**
+ * Automatically called in {@link net.minecraft.tags.TagLoader#loadAndBuild(ResourceManager)}.
+ *
+ * In most cases there is no need to call this Method manually.
+ *
+ * @param directory The name of the Tag-directory. Should be either "tags/blocks" or
+ * "tags/items".
+ * @param tagsMap The map that will hold the registered Tags
+ *
+ * @return The {@code tagsMap} Parameter.
+ */
public static Map apply(String directory, Map tagsMap) {
Map> endTags = null;
if ("tags/blocks".equals(directory)) {