Class CraftTweakerRegistry
- All Implemented Interfaces:
ICraftTweakerRegistry
-
Method Summary
Modifier and TypeMethodDescriptionfindLoader(String name) Attempts to find anIScriptLoaderwith the given name, if available.findLoadSource(net.minecraft.resources.ResourceLocation id) Attempts to find anIScriptLoadSourcewith the given id, if possible.<T> IRecipeComponent<T> findRecipeComponent(net.minecraft.resources.ResourceLocation id) Obtains theIRecipeComponentwith the given id, if available.static ICraftTweakerRegistryget()Gets all bracket handler possibilities that can be queried under the givenIScriptLoader.Obtains aCollectionof allIScriptLoaders known to CraftTweaker.Obtains aCollectionof allIRecipeComponents known to CraftTweaker.getBracketDumpers(IScriptLoader loader) Obtains a read-onlyMapof all bracket dumpers registered for the givenIScriptLoader.getBracketHandlers(IScriptLoader loader, String rootPackage) Obtains aMapcontaining all known bracket handlers for the givenIScriptLoaderresiding in therootPackage.getConfiguratorFor(IScriptLoader loader) Obtains theIScriptRunModuleConfiguratorthat has been registered for the givenIScriptLoader.getEnumBracketFor(IScriptLoader loader, net.minecraft.resources.ResourceLocation type) Obtains the enumeration class that corresponds to the given id in the queriedIScriptLoader.<T extends Enum<T>>
TgetEnumBracketValue(IScriptLoader loader, net.minecraft.resources.ResourceLocation type, String value) Obtains the enumeration constant that corresponds to the givenIScriptLoader, id, and value as if it were looked up from the<constant>bracket handler.Provides access to the globalIEventRegistry.Gets a read-onlyListof all known preprocessors.<T extends net.minecraft.world.item.crafting.Recipe<?>>
IRecipeHandler<T> getRecipeHandlerFor(Class<T> recipeClazz) Obtains theIRecipeHandlerresponsible for the given recipe class.<T extends net.minecraft.world.item.crafting.Recipe<?>>
IRecipeHandler<T> getRecipeHandlerFor(T recipe) Obtains theIRecipeHandlerresponsible for the given recipe.Offers access to theIReplacerRegistry.<T> TagManagerFactory<T, ? extends ITagManager<?>> getTaggableElementFactory(net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> key) Gets aTagManagerFactoryfor the givenResourceKey.getTaggableElementFor(net.minecraft.resources.ResourceKey<T> key) Tries to find a taggable element for the givenResourceKey.Gets the globalIZenClassRegistry.static IPluginRegistryAccessMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.blamejared.crafttweaker.api.ICraftTweakerRegistry
getRecipeHandlerFor
-
Method Details
-
get
-
pluginAccess
-
findLoader
Description copied from interface:ICraftTweakerRegistryAttempts to find anIScriptLoaderwith the given name, if available.This method can be called only after all registries have been successfully built: attempting to call this method before that might lead to undefined behavior. It is also illegal to attempt to query the global loader through this method.
- Specified by:
findLoaderin interfaceICraftTweakerRegistry- Parameters:
name- The name of the loader that should be found. It cannot be the global loader.- Returns:
- The
IScriptLoaderwith the given name, if available.
-
getAllLoaders
Description copied from interface:ICraftTweakerRegistryObtains aCollectionof allIScriptLoaders known to CraftTweaker.- Specified by:
getAllLoadersin interfaceICraftTweakerRegistry- Returns:
- A read-only collection of all known loaders.
-
findLoadSource
Description copied from interface:ICraftTweakerRegistryAttempts to find anIScriptLoadSourcewith the given id, if possible.This method can be called only after all registries have been successfully built: attempting to call this method before that might lead to undefined behavior.
- Specified by:
findLoadSourcein interfaceICraftTweakerRegistry- Parameters:
id- The id of the load source that should be found.- Returns:
- The
IScriptLoadSourcewith the given id, if available.
-
getZenClassRegistry
Description copied from interface:ICraftTweakerRegistryGets the globalIZenClassRegistry.- Specified by:
getZenClassRegistryin interfaceICraftTweakerRegistry- Returns:
- The global
IZenClassRegistry.
-
getConfiguratorFor
Description copied from interface:ICraftTweakerRegistryObtains theIScriptRunModuleConfiguratorthat has been registered for the givenIScriptLoader.This method must be called only after all registries have been successfully built: earlier calls will result in undefined behavior.
- Specified by:
getConfiguratorForin interfaceICraftTweakerRegistry- Parameters:
loader- The loader for which the configurator should be obtained for.- Returns:
- The corresponding
IScriptRunModuleConfigurator.
-
getBracketDumpers
Description copied from interface:ICraftTweakerRegistryObtains a read-onlyMapof all bracket dumpers registered for the givenIScriptLoader.Each entry has a key representing the name of the bracket expression for which the dumper is for and a value corresponding to the
IBracketDumperInfofor that bracket expression.- Specified by:
getBracketDumpersin interfaceICraftTweakerRegistry- Parameters:
loader- The loader for which the bracket dumpers should be obtained.- Returns:
- A
Mapcontaining the requested data.
-
getBracketHandlers
public Map<String,BracketExpressionParser> getBracketHandlers(IScriptLoader loader, String rootPackage) Description copied from interface:ICraftTweakerRegistryObtains aMapcontaining all known bracket handlers for the givenIScriptLoaderresiding in therootPackage.The concept of package used in this method corresponds to the ZenCode concept instead of the Java concept. This means that also bracket handlers in the various sub-packages will also be queried.
- Specified by:
getBracketHandlersin interfaceICraftTweakerRegistry- Parameters:
loader- TheIScriptLoaderfor which bracket handlers should be queried.rootPackage- The root package under which the bracket handlers should reside.- Returns:
- A
Mapwhose key represents the name of the bracket and the value theBracketExpressionParserresponsible for resolution.
-
getPreprocessors
Description copied from interface:ICraftTweakerRegistryGets a read-onlyListof all known preprocessors.- Specified by:
getPreprocessorsin interfaceICraftTweakerRegistry- Returns:
- All known preprocessors.
-
getRecipeHandlerFor
public <T extends net.minecraft.world.item.crafting.Recipe<?>> IRecipeHandler<T> getRecipeHandlerFor(T recipe) Description copied from interface:ICraftTweakerRegistryObtains theIRecipeHandlerresponsible for the given recipe.- Specified by:
getRecipeHandlerForin interfaceICraftTweakerRegistry- Type Parameters:
T- The type of the recipe whose handler should be identified.- Parameters:
recipe- The recipe whose handler should be identified.- Returns:
- an
IRecipeHandlerthat is able to deal with the given recipe.
-
getRecipeHandlerFor
public <T extends net.minecraft.world.item.crafting.Recipe<?>> IRecipeHandler<T> getRecipeHandlerFor(Class<T> recipeClazz) Description copied from interface:ICraftTweakerRegistryObtains theIRecipeHandlerresponsible for the given recipe class.- Specified by:
getRecipeHandlerForin interfaceICraftTweakerRegistry- Type Parameters:
T- The type of the recipe whose handler should be identified.- Parameters:
recipeClazz- The recipe class whose handler should be identified.- Returns:
- an
IRecipeHandlerthat is able to deal with the given recipe class.
-
findRecipeComponent
Description copied from interface:ICraftTweakerRegistryObtains theIRecipeComponentwith the given id, if available.This method can be called only after all registries have been successfully built: attempting to call this method before that might lead to undefined behavior.
Take note that all recipe components have a type associated with them. This query does not attempt to verify that the component with the given id reflects the type specified in the type parameter. Care must be taken by the caller of this method to ensure correctness.
- Specified by:
findRecipeComponentin interfaceICraftTweakerRegistry- Type Parameters:
T- The type associated with theIRecipeComponent.- Parameters:
id- The name id of the recipe component.- Returns:
- The
IRecipeComponentwith the given name, if available.
-
getAllRecipeComponents
Description copied from interface:ICraftTweakerRegistryObtains aCollectionof allIRecipeComponents known to CraftTweaker.- Specified by:
getAllRecipeComponentsin interfaceICraftTweakerRegistry- Returns:
- A read-only collection of all known components.
-
getEnumBracketValue
public <T extends Enum<T>> T getEnumBracketValue(IScriptLoader loader, net.minecraft.resources.ResourceLocation type, String value) Description copied from interface:ICraftTweakerRegistryObtains the enumeration constant that corresponds to the givenIScriptLoader, id, and value as if it were looked up from the<constant>bracket handler.- Specified by:
getEnumBracketValuein interfaceICraftTweakerRegistry- Type Parameters:
T- The type of the target enumeration.- Parameters:
loader- TheIScriptLoaderunder which the enumeration should be queried.type- TheResourceLocationthat uniquely identifies the enumeration.value- The value of the enumeration that should be obtained.- Returns:
- The enumeration value that would be obtained by the bracket handler.
-
getEnumBracketFor
public <T extends Enum<T>> Optional<Class<T>> getEnumBracketFor(IScriptLoader loader, net.minecraft.resources.ResourceLocation type) Description copied from interface:ICraftTweakerRegistryObtains the enumeration class that corresponds to the given id in the queriedIScriptLoader.- Specified by:
getEnumBracketForin interfaceICraftTweakerRegistry- Type Parameters:
T- The type of the target enumeration.- Parameters:
loader- TheIScriptLoaderunder which the enumeration should be queried.type- TheResourceLocationthat uniquely identifies the enumeration.- Returns:
- An
Optionalwrapping theClassof the enumeration if it can be identified, an empty optional otherwise.
-
getTaggableElementFor
Description copied from interface:ICraftTweakerRegistryTries to find a taggable element for the givenResourceKey.- Specified by:
getTaggableElementForin interfaceICraftTweakerRegistry- Type Parameters:
T- The type of element to find.- Parameters:
key- TheResourceKeyto get the element for.- Returns:
- An
Optionalwrapping theClassof the taggable element if it can be found, an empty optional otherwise.
-
getTaggableElementFactory
public <T> TagManagerFactory<T,? extends ITagManager<?>> getTaggableElementFactory(net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> key) Description copied from interface:ICraftTweakerRegistryGets aTagManagerFactoryfor the givenResourceKey.Note: If an element is known but does not have an explicit
TagManagerFactory, then a factory for aKnownTagManageris returned. If an element is not known, then a factory for anUnknownTagManageris returned.- Specified by:
getTaggableElementFactoryin interfaceICraftTweakerRegistry- Type Parameters:
T- The type of element the factory deals with.- Parameters:
key- TheResourceKeyto get the element factory for.- Returns:
- A
TagManagerFactoryfor the givenResourceKey.
-
getAllEnumStringsForEnumBracket
Description copied from interface:ICraftTweakerRegistryGets all bracket handler possibilities that can be queried under the givenIScriptLoader.The data of the returned set corresponds to strings of the form
<constant:id:constant>, where id represents the unique identifier of the enumeration in the given loader and constant the name of the constant under that enumeration.- Specified by:
getAllEnumStringsForEnumBracketin interfaceICraftTweakerRegistry- Parameters:
loader- TheIScriptLoaderfor which all validconstantbrackets should be queried.- Returns:
- A
Setof strings of the previously mentioned format.
-
getReplacerRegistry
Description copied from interface:ICraftTweakerRegistryOffers access to theIReplacerRegistry.- Specified by:
getReplacerRegistryin interfaceICraftTweakerRegistry- Returns:
- The
IReplacerRegistry.
-
getEventRegistry
Description copied from interface:ICraftTweakerRegistryProvides access to the globalIEventRegistry.- Specified by:
getEventRegistryin interfaceICraftTweakerRegistry- Returns:
- The
IEventRegistry.
-