/* * Minecraft Forge * Copyright (c) 2016-2020. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation version 2.1 * of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ package net.minecraftforge.common.extensions; import net.minecraft.data.TagsProvider; import net.minecraft.tags.ITag; import net.minecraft.util.RegistryKey; import net.minecraft.util.ResourceLocation; //TODO, Tag removal support. public interface IForgeTagBuilder { default TagsProvider.Builder getBuilder() { return (TagsProvider.Builder) this; } @SuppressWarnings("unchecked") default TagsProvider.Builder addTags(ITag.INamedTag... values) { TagsProvider.Builder builder = getBuilder(); for (ITag.INamedTag value : values) { builder.func_240531_a_(value); } return builder; } default TagsProvider.Builder add(RegistryKey... keys) { TagsProvider.Builder builder = getBuilder(); for (RegistryKey key : keys) { builder.getInternalBuilder().func_232961_a_(key.func_240901_a_(), getBuilder().getModID()); } return builder; } default TagsProvider.Builder replace() { return replace(true); } default TagsProvider.Builder replace(boolean value) { getBuilder().getInternalBuilder().replace(value); return getBuilder(); } default TagsProvider.Builder addOptional(final ResourceLocation location) { return getBuilder().add(new ITag.OptionalItemEntry(location)); } default TagsProvider.Builder addOptionalTag(final ResourceLocation location) { return getBuilder().add(new ITag.OptionalTagEntry(location)); } }