Class ReferencesFinder
java.lang.Object
net.mcreator.workspace.references.ReferencesFinder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> booleananyValueMatches(Object source, Class<T> clazz, Predicate<AccessibleObject> validIf, BiPredicate<AccessibleObject, T> condition) Checks if values acquired from any valid fields or methods meet the specified condition.static Set<ModElement> searchAnimationUsages(Workspace workspace, Collection<Animation> animations) static Map<ModElement, Set<String>> searchBrokenReferences(Workspace workspace) Searches the workspace for mod elements that reference mod elements that no longer exist.static Set<ModElement> searchGlobalVariableUsages(Workspace workspace, Collection<String> variableNames) static Set<ModElement> searchLocalizationKeyUsages(Workspace workspace, Collection<String> localizationKeys) static Set<ModElement> searchModElementUsages(Workspace workspace, Collection<ModElement> elements) Searches for usages of the provided mod elements in the workspace.static Set<ModElement> searchModElementUsages(Workspace workspace, ModElement element) static Set<ModElement> searchModelUsages(Workspace workspace, Collection<Model> models) static Set<ModElement> searchModelUsages(Workspace workspace, Model model) static Set<ModElement> searchSoundUsages(Workspace workspace, Collection<SoundElement> sounds) static Set<ModElement> searchStructureUsages(Workspace workspace, Collection<String> structures) static Set<ModElement> searchTextureUsages(Workspace workspace, File texture, TextureType type) static Set<ModElement> searchTextureUsages(Workspace workspace, Collection<File> textures, TextureType type)
-
Constructor Details
-
ReferencesFinder
public ReferencesFinder()
-
-
Method Details
-
searchModElementUsages
-
searchModElementUsages
public static Set<ModElement> searchModElementUsages(Workspace workspace, Collection<ModElement> elements) Searches for usages of the provided mod elements in the workspace.- Parameters:
workspace- Workspace to look for usages in.elements- Collection of mod elements to look for usages of.- Returns:
- Set of mod elements that reference any of the provided mod elements in their generatable element. The set does not include the provided mod elements themselves.
-
searchBrokenReferences
Searches the workspace for mod elements that reference mod elements that no longer exist.- Parameters:
workspace- Workspace to search in.- Returns:
- Map of mod elements with broken references to the names of referenced mod elements that do not exist.
-
searchTextureUsages
public static Set<ModElement> searchTextureUsages(Workspace workspace, File texture, TextureType type) -
searchTextureUsages
public static Set<ModElement> searchTextureUsages(Workspace workspace, Collection<File> textures, TextureType type) -
searchModelUsages
-
searchModelUsages
-
searchAnimationUsages
public static Set<ModElement> searchAnimationUsages(Workspace workspace, Collection<Animation> animations) -
searchSoundUsages
public static Set<ModElement> searchSoundUsages(Workspace workspace, Collection<SoundElement> sounds) -
searchStructureUsages
public static Set<ModElement> searchStructureUsages(Workspace workspace, Collection<String> structures) -
searchGlobalVariableUsages
public static Set<ModElement> searchGlobalVariableUsages(Workspace workspace, Collection<String> variableNames) -
searchLocalizationKeyUsages
public static Set<ModElement> searchLocalizationKeyUsages(Workspace workspace, Collection<String> localizationKeys) -
anyValueMatches
public static <T> boolean anyValueMatches(@Nullable Object source, Class<T> clazz, Predicate<AccessibleObject> validIf, BiPredicate<AccessibleObject, T> condition) Checks if values acquired from any valid fields or methods meet the specified condition. Additionally, the following conditions are applied to determine whether a field/method is valid and whether its value should be checked: - method/field is not static - method has no parameters - method type/field type is part of the data model or validIf passes- Type Parameters:
T- The type of values to be checked.- Parameters:
source- The object to extract values from.clazz- The class of values to be checked.validIf- The predicate used to check if a field/method is considered valid.condition- The predicate defining the condition that the acquired values should pass.- Returns:
- Whether any value extracted from valid fields/methods on the
sourceobject pass the condition.
-