Package net.minecraftforge.registries
Class ForgeRegistryTagManager<V extends IForgeRegistryEntry<V>>
java.lang.Object
net.minecraftforge.registries.ForgeRegistryTagManager<V>
- All Implemented Interfaces:
Iterable<ITag<V>>
,ITagManager<V>
class ForgeRegistryTagManager<V extends IForgeRegistryEntry<V>>
extends Object
implements ITagManager<V>
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds defaults to an existing tag key.(package private) void
createOptionalTagKey
(@NotNull ResourceLocation location, @NotNull Set<? extends Supplier<V>> defaults) Creates a tag key that will use the set of defaults if the tag is not loaded from any datapacks.createTagKey
(@NotNull ResourceLocation location) Creates a tag key based on the location and the forge registry linked to this tag manager.@NotNull Optional<IReverseTag<V>>
getReverseTag
(V value) Queries a reverse tag for a given value from the forge registry linked to this tag manager.Queries this tag manager for a tag with the given tag key.boolean
isKnownTagName
(@NotNull TagKey<V> name) Checks whether the given tag key exists in this tag manager and is bound.iterator()
stream()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
owner
-
tags
private volatile Map<TagKey<V extends IForgeRegistryEntry<V>>,ITag<V extends IForgeRegistryEntry<V>>> tags
-
-
Constructor Details
-
ForgeRegistryTagManager
ForgeRegistryTagManager(ForgeRegistry<V> owner)
-
-
Method Details
-
bind
-
getTag
Description copied from interface:ITagManager
Queries this tag manager for a tag with the given tag key. If it does not exist, this will create an empty tag and return it.- Specified by:
getTag
in interfaceITagManager<V extends IForgeRegistryEntry<V>>
- See Also:
-
getReverseTag
Description copied from interface:ITagManager
Queries a reverse tag for a given value from the forge registry linked to this tag manager. A reverse tag stores all tags that the givenvalue
is contained in.- Specified by:
getReverseTag
in interfaceITagManager<V extends IForgeRegistryEntry<V>>
- Parameters:
value
- A value currently registered to the forge registry linked to this tag manager- Returns:
- A reverse tag for the given value, or an empty optional if the value is not registered
-
isKnownTagName
Description copied from interface:ITagManager
Checks whether the given tag key exists in this tag manager and is bound. UnlikeITagManager.getTag(TagKey)
, this method will not create the tag if it does not exist.- Specified by:
isKnownTagName
in interfaceITagManager<V extends IForgeRegistryEntry<V>>
- See Also:
-
iterator
- Specified by:
iterator
in interfaceIterable<V extends IForgeRegistryEntry<V>>
-
stream
- Specified by:
stream
in interfaceITagManager<V extends IForgeRegistryEntry<V>>
- Returns:
- A stream of all tags stored in this tag manager, bound or unbound.
-
getTagNames
- Specified by:
getTagNames
in interfaceITagManager<V extends IForgeRegistryEntry<V>>
- Returns:
- A stream of all tag keys stored in this tag manager, bound or unbound.
-
createTagKey
Description copied from interface:ITagManager
Creates a tag key based on the location and the forge registry linked to this tag manager. Custom registries can useDeferredRegister.createTagKey(ResourceLocation)
to create tag keys before the tag manager is created.- Specified by:
createTagKey
in interfaceITagManager<V extends IForgeRegistryEntry<V>>
- See Also:
-
createOptionalTagKey
@NotNull public @NotNull TagKey<V> createOptionalTagKey(@NotNull @NotNull ResourceLocation location, @NotNull @NotNull Set<? extends Supplier<V>> defaults) Description copied from interface:ITagManager
Creates a tag key that will use the set of defaults if the tag is not loaded from any datapacks. Useful on the client side when a server may not provide a specific tag. Custom registries can useDeferredRegister.addOptionalTagDefaults(TagKey, Set)
to create tag keys before the tag manager is created.- Specified by:
createOptionalTagKey
in interfaceITagManager<V extends IForgeRegistryEntry<V>>
- See Also:
-
addOptionalTagDefaults
public void addOptionalTagDefaults(@NotNull @NotNull TagKey<V> name, @NotNull @NotNull Set<? extends Supplier<V>> defaults) Description copied from interface:ITagManager
Adds defaults to an existing tag key. The set of defaults will be bound to the tag if the tag is not loaded from any datapacks. Useful on the client side when a server may not provide a specific tag. Custom registries can useDeferredRegister.addOptionalTagDefaults(TagKey, Set)
to add defaults before the tag manager is created.- Specified by:
addOptionalTagDefaults
in interfaceITagManager<V extends IForgeRegistryEntry<V>>
- See Also:
-