Package net.mcreator.generator
Class Generator
java.lang.Object
net.mcreator.generator.Generator
- All Implemented Interfaces:
Closeable
,AutoCloseable
,IGenerator
,IGeneratorProvider
,IWorkspaceProvider
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
boolean
Generates the generator mod base files.boolean
generateBase
(boolean formatAndOrganiseImports) Generates the generator mod base files and writes them to disk.boolean
generateElement
(GeneratableElement element) GeneratableElement should be saved AFTER this method is called, not before as it can be altered in this processgenerateElement
(GeneratableElement element, boolean formatAndOrganiseImports) generateElement
(GeneratableElement element, boolean formatAndOrganiseImports, boolean performFSTasks) getGlobalTemplatesListForDefinition
(Map<?, ?> map, boolean performFSTasks, AtomicInteger templateID) getGlobalTemplatesListForModElementType
(ModElementType<?> type, boolean performFSTasks, AtomicInteger templateID) org.gradle.tooling.ProjectConnection
getModBaseGeneratorTemplatesList
(boolean performFSTasks) getModElementGeneratorTemplatesList
(GeneratableElement generatableElement) getModElementListTemplates
(GeneratableElement generatableElement) void
void
void
void
removeElementFilesAndWorkspaceLinks
(GeneratableElement generatableElement) void
void
setGradleCache
(GeneratorGradleCache generatorGradleCache) void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.mcreator.generator.IGenerator
getFullGeneratorVersion, getGeneratorBuildFileVersion, getGeneratorMinecraftVersion, getMappings, getModAssetsRoot, getModDataRoot, getResourceRoot, getSourceRoot
Methods inherited from interface net.mcreator.generator.IGeneratorProvider
getGenerator, getGeneratorStats
Methods inherited from interface net.mcreator.workspace.IWorkspaceProvider
getFileManager, getFolderManager, getModElementManager, getWorkspaceFolder, getWorkspaceSettings
-
Field Details
-
GENERATOR_CACHE
-
-
Constructor Details
-
Generator
-
-
Method Details
-
getWorkspace
- Specified by:
getWorkspace
in interfaceIWorkspaceProvider
-
getGeneratorConfiguration
- Specified by:
getGeneratorConfiguration
in interfaceIGeneratorProvider
-
getTemplateGeneratorFromName
-
getGeneratorName
-
getMinecraftCodeProvider
-
getBaseDataModelProvider
-
getGeneratorPackageRoot
-
getLangFilesRoot
-
generateBase
public boolean generateBase()Generates the generator mod base files. Formats the imports in the generated Java code.- Returns:
- true if generator generated all files without any errors
-
generateBase
public boolean generateBase(boolean formatAndOrganiseImports) Generates the generator mod base files and writes them to disk.- Parameters:
formatAndOrganiseImports
- true if imports should be formatted- Returns:
- true if generator generated all files without any errors
-
generateElement
GeneratableElement should be saved AFTER this method is called, not before as it can be altered in this process- Parameters:
element
- GeneratableElement to generate code and resources for- Returns:
- true if generation succeeds
-
generateElement
@Nonnull public List<GeneratorFile> generateElement(GeneratableElement element, boolean formatAndOrganiseImports) throws TemplateGeneratorException - Throws:
TemplateGeneratorException
-
generateElement
@Nonnull public List<GeneratorFile> generateElement(GeneratableElement element, boolean formatAndOrganiseImports, boolean performFSTasks) throws TemplateGeneratorException - Throws:
TemplateGeneratorException
-
getElementLocalizationKeys
-
removeElementFilesAndWorkspaceLinks
-
getModBaseGeneratorTemplatesList
-
getGlobalTemplatesListForModElementType
public List<GeneratorTemplate> getGlobalTemplatesListForModElementType(ModElementType<?> type, boolean performFSTasks, AtomicInteger templateID) -
getGlobalTemplatesListForDefinition
public List<GeneratorTemplate> getGlobalTemplatesListForDefinition(@Nullable Map<?, ?> map, boolean performFSTasks, AtomicInteger templateID) -
getModElementGeneratorTemplatesList
@Nonnull public List<GeneratorTemplate> getModElementGeneratorTemplatesList(GeneratableElement generatableElement) -
getModElementListTemplates
@Nonnull public List<GeneratorTemplatesList> getModElementListTemplates(GeneratableElement generatableElement) -
getModElementThisFileBelongsTo
-
runResourceSetupTasks
public void runResourceSetupTasks() -
getGradleProjectConnection
@Nullable public org.gradle.tooling.ProjectConnection getGradleProjectConnection() -
trackFile
-
notifyDaemonsAboutChangedPaths
public void notifyDaemonsAboutChangedPaths() -
getProjectJarManager
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
loadOrCreateGradleCaches
- Throws:
GradleCacheImportFailedException
-
reloadGradleCaches
public void reloadGradleCaches() -
getGradleCache
-
setGradleCache
-