User: kyle wood Date: 30 Mar 26 05:07 Revision: 5b58533d2538785c831cb16e30c6c4cf0e696381 Summary: Remove legacy creator TeamCity URL: http://ci.mcdev.io:80/viewModification.html?tab=vcsModificationFiles&modId=10460&personal=false Index: src/main/kotlin/creator/MinecraftModuleBuilder.kt =================================================================== --- src/main/kotlin/creator/MinecraftModuleBuilder.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/MinecraftModuleBuilder.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,62 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator - -import com.demonwav.mcdev.asset.MCDevBundle -import com.demonwav.mcdev.asset.PlatformAssets -import com.demonwav.mcdev.creator.buildsystem.BuildSystemPropertiesStep -import com.demonwav.mcdev.creator.platformtype.PlatformTypeStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.intellij.ide.projectWizard.ProjectSettingsStep -import com.intellij.ide.util.projectWizard.WizardContext -import com.intellij.ide.wizard.AbstractNewProjectWizardBuilder -import com.intellij.ide.wizard.GitNewProjectWizardStep -import com.intellij.ide.wizard.NewProjectWizardBaseStep -import com.intellij.ide.wizard.RootNewProjectWizardStep -import com.intellij.openapi.roots.ModifiableRootModel - -class MinecraftModuleBuilder : AbstractNewProjectWizardBuilder() { - - override fun getPresentableName() = "Minecraft (Old Wizard)" - override fun getNodeIcon() = PlatformAssets.MINECRAFT_ICON - override fun getGroupName() = "Minecraft" - override fun getBuilderId() = "MINECRAFT_MODULE" - override fun getDescription() = MCDevBundle("creator.ui.create_minecraft_project") - - override fun setupRootModel(modifiableRootModel: ModifiableRootModel) { - if (moduleJdk != null) { - modifiableRootModel.sdk = moduleJdk - } else { - modifiableRootModel.inheritSdk() - } - } - - override fun getParentGroup() = "Minecraft" - - override fun createStep(context: WizardContext) = RootNewProjectWizardStep(context) - .nextStep(::NewProjectWizardBaseStep) - .nextStep(::GitNewProjectWizardStep) - .nextStep(PlatformTypeStep::create) - .nextStep(::BuildSystemPropertiesStep) - .nextStep(::ProjectSetupFinalizerWizardStep) - - override fun getIgnoredSteps() = listOf(ProjectSettingsStep::class.java) -} Index: src/main/kotlin/creator/ParchmentStep.kt =================================================================== --- src/main/kotlin/creator/ParchmentStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/ParchmentStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,168 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator - -import com.demonwav.mcdev.asset.MCDevBundle -import com.demonwav.mcdev.creator.step.AbstractMcVersionChainStep -import com.demonwav.mcdev.util.SemanticVersion -import com.intellij.icons.AllIcons -import com.intellij.ide.wizard.AbstractNewProjectWizardStep -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.observable.properties.ObservableMutableProperty -import com.intellij.openapi.observable.util.and -import com.intellij.openapi.observable.util.bindBooleanStorage -import com.intellij.openapi.observable.util.not -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key -import com.intellij.ui.content.AlertIcon -import com.intellij.ui.dsl.builder.Panel -import com.intellij.ui.dsl.builder.bindItem -import com.intellij.ui.dsl.builder.bindSelected -import com.intellij.util.application -import com.intellij.util.ui.AsyncProcessIcon -import javax.swing.DefaultComboBoxModel -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.runBlocking -import kotlinx.coroutines.swing.Swing -import kotlinx.coroutines.withContext - -class ParchmentStep(parent: NewProjectWizardStep) : AbstractNewProjectWizardStep(parent) { - - val useParchmentProperty = propertyGraph.property(false) - .bindBooleanStorage("${javaClass.name}.useParchment") - var useParchment by useParchmentProperty - - val parchmentVersionProperty = propertyGraph.property(null) - var parchmentVersion by parchmentVersionProperty - - val parchmentVersionsProperty = propertyGraph.property>(emptyList()) - var parchmentVersions by parchmentVersionsProperty - - val loadingVersionsProperty = propertyGraph.property(false) - var loadingVersions by loadingVersionsProperty - - val hasParchmentVersionProperty = propertyGraph.property(false) - var hasParchmentVersion by hasParchmentVersionProperty - - val includeOlderMcVersionsProperty = propertyGraph.property(false) - .bindBooleanStorage("${javaClass.name}.includeOlderMcVersions") - var includeOlderMcVersions by includeOlderMcVersionsProperty - - val includeSnapshotsVersionsProperty = propertyGraph.property(false) - .bindBooleanStorage("${javaClass.name}.includeSnapshotsVersions") - var includeSnapshotsVersions by includeSnapshotsVersionsProperty - - private val parchmentVersionsModel = DefaultComboBoxModel(emptyArray()) - private val mcVersionProperty: ObservableMutableProperty - - init { - storeToData() - @Suppress("UNCHECKED_CAST") - mcVersionProperty = findStep().getVersionProperty(0) - as ObservableMutableProperty - mcVersionProperty.afterChange { updateVersionsModel() } - - includeOlderMcVersionsProperty.afterChange { updateVersionsModel() } - includeSnapshotsVersionsProperty.afterChange { updateVersionsModel() } - - downloadVersions() - } - - private fun updateVersionsModel() { - val mcVersion = mcVersionProperty.get() - val versions = parchmentVersions.filter { version -> - if (!includeOlderMcVersions && version.mcVersion < mcVersion) { - return@filter false - } - - if (!includeSnapshotsVersions && version.parchmentVersion.contains("-SNAPSHOT")) { - return@filter false - } - - return@filter true - } - - hasParchmentVersion = versions.isNotEmpty() - - parchmentVersionsModel.removeAllElements() - parchmentVersionsModel.addAll(versions) - - parchmentVersionsModel.selectedItem = versions.firstOrNull { !it.parchmentVersion.contains('-') } - ?: versions.firstOrNull() - - loadingVersions = false - } - - private fun downloadVersions() { - loadingVersions = true - parchmentVersionsModel.removeAllElements() - application.executeOnPooledThread { - runBlocking { - val versions = ParchmentVersion.downloadData() - withContext(Dispatchers.Swing) { - parchmentVersions = versions - updateVersionsModel() - } - } - } - } - - override fun setupUI(builder: Panel) { - with(builder) { - row(MCDevBundle("creator.ui.parchment.label")) { - checkBox("") - .bindSelected(useParchmentProperty) - - comboBox(parchmentVersionsModel) - .enabledIf(useParchmentProperty and hasParchmentVersionProperty) - .bindItem(parchmentVersionProperty) - - cell(AsyncProcessIcon("$javaClass.parchmentVersions")) - .visibleIf(loadingVersionsProperty) - - label(MCDevBundle("creator.ui.parchment.no_version.message")) - .visibleIf(hasParchmentVersionProperty.not() and loadingVersionsProperty.not()) - .applyToComponent { icon = AlertIcon(AllIcons.General.Warning) } - } - - row(MCDevBundle("creator.ui.parchment.include.label")) { - checkBox(MCDevBundle("creator.ui.parchment.include.old_mc.label")) - .enabledIf(useParchmentProperty) - .bindSelected(includeOlderMcVersionsProperty) - checkBox(MCDevBundle("creator.ui.parchment.include.snapshots.label")) - .enabledIf(useParchmentProperty) - .bindSelected(includeSnapshotsVersionsProperty) - } - } - - super.setupUI(builder) - } - - override fun setupProject(project: Project) { - data.putUserData(USE_KEY, useParchment) - data.putUserData(VERSION_KEY, parchmentVersion) - } - - companion object { - val USE_KEY = Key.create("${ParchmentStep::class.java.name}.useParchment") - val VERSION_KEY = Key.create("${ParchmentStep::class.java}.parchmentVersion") - } -} Index: src/main/kotlin/creator/PlatformVersion.kt =================================================================== --- src/main/kotlin/creator/PlatformVersion.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/PlatformVersion.kt (revision 5b58533d2538785c831cb16e30c6c4cf0e696381) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -18,11 +18,13 @@ * along with this program. If not, see . */ +@file:JvmName("PlatformVersion") + package com.demonwav.mcdev.creator -import com.demonwav.mcdev.platform.PlatformType import com.demonwav.mcdev.update.PluginUtil import com.demonwav.mcdev.util.fromJson +import com.demonwav.mcdev.util.loggerForTopLevel import com.demonwav.mcdev.util.mapFirstNotNull import com.demonwav.mcdev.util.withSuppressed import com.github.kittinunf.fuel.core.FuelManager @@ -30,7 +32,6 @@ import com.github.kittinunf.fuel.coroutines.awaitString import com.google.gson.Gson import com.intellij.openapi.diagnostic.Attachment -import com.intellij.openapi.diagnostic.logger import com.intellij.util.net.JdkProxyProvider import java.io.IOException import java.net.Proxy @@ -52,13 +53,8 @@ private val URLS = listOf(CLOUDFLARE_BASE_URL, GITHUB_BASE_URL, OVH_BASE_URL) -val PLATFORM_VERSION_LOGGER = logger() +val PLATFORM_VERSION_LOGGER = loggerForTopLevel() -suspend fun getVersionSelector(type: PlatformType): PlatformVersion { - val versionJson = type.versionJson ?: throw UnsupportedOperationException("Incorrect platform type: $type") - return getVersionJson(versionJson) -} - suspend inline fun getVersionJson(path: String): T { return getVersionJson(path, T::class) } @@ -112,5 +108,3 @@ } return null } - -data class PlatformVersion(var versions: List, var selectedIndex: Int) Index: src/main/kotlin/creator/ProjectSetupFinalizerWizardStep.kt =================================================================== --- src/main/kotlin/creator/ProjectSetupFinalizerWizardStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/ProjectSetupFinalizerWizardStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,174 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2026 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator - -import com.demonwav.mcdev.asset.MCDevBundle -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.util.mapFirstNotNull -import com.intellij.ide.wizard.AbstractNewProjectWizardStep -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.extensions.ExtensionPointName -import com.intellij.openapi.observable.properties.GraphProperty -import com.intellij.openapi.project.Project -import com.intellij.openapi.projectRoots.JavaSdk -import com.intellij.openapi.projectRoots.JavaSdkVersion -import com.intellij.openapi.projectRoots.Sdk -import com.intellij.openapi.ui.ValidationInfo -import com.intellij.openapi.ui.validation.DialogValidation -import com.intellij.openapi.ui.validation.WHEN_GRAPH_PROPAGATION_FINISHED -import com.intellij.ui.JBColor -import com.intellij.ui.dsl.builder.Panel -import com.intellij.ui.dsl.builder.Placeholder -import javax.swing.JLabel -import javax.swing.JPanel - -class ProjectSetupFinalizerWizardStep(parent: NewProjectWizardStep) : AbstractNewProjectWizardStep(parent) { - private val finalizers: List by lazy { - val factories = ProjectSetupFinalizer.EP_NAME.extensionList - val result = mutableListOf() - if (factories.isNotEmpty()) { - var par: NewProjectWizardStep = this - for (factory in factories) { - val finalizer = factory.create(par) - result += finalizer - par = finalizer - } - } - result - } - private val step by lazy { - when (finalizers.size) { - 0 -> null - 1 -> finalizers[0] - else -> { - var step = finalizers[0].nextStep { finalizers[1] } - for (i in 2 until finalizers.size) { - step = step.nextStep { finalizers[i] } - } - step - } - } - } - - override fun setupUI(builder: Panel) { - for (step in finalizers) { - step.setupUI(builder) - } - if (finalizers.isNotEmpty()) { - builder.row { - cell(JPanel()) - .validationRequestor(WHEN_GRAPH_PROPAGATION_FINISHED(propertyGraph)) - .validation( - DialogValidation { - finalizers.mapFirstNotNull(ProjectSetupFinalizer::validate)?.let(::ValidationInfo) - } - ) - } - } - } - - override fun setupProject(project: Project) { - for (step in finalizers) { - step.setupProject(project) - } - } -} - -/** - * A step applied after all other steps for all Minecraft project creators. These steps can also block project creation - * by providing extra validations. - * - * To add custom project setup finalizers, register a [Factory] to the - * `com.demonwav.minecraft-dev.projectSetupFinalizer` extension point. - */ -interface ProjectSetupFinalizer : NewProjectWizardStep { - companion object { - val EP_NAME = ExtensionPointName("com.demonwav.minecraft-dev.projectSetupFinalizer") - } - - /** - * Validates the existing settings of this wizard. - * - * @return `null` if the settings are valid, or an error message if they are invalid. - */ - fun validate(): String? = null - - interface Factory { - fun create(parent: NewProjectWizardStep): ProjectSetupFinalizer - } -} - -class JdkProjectSetupFinalizer( - parent: NewProjectWizardStep, -) : AbstractNewProjectWizardStep(parent), ProjectSetupFinalizer { - private val sdkProperty: GraphProperty = propertyGraph.property(null) - private var sdk by sdkProperty - private var sdkComboBox: JdkComboBoxWithPreference? = null - private var preferredJdkLabel: Placeholder? = null - private var preferredJdkReason = MCDevBundle("creator.validation.jdk_preferred_default_reason") - - val preferredJdkProperty = propertyGraph.property(JavaSdkVersion.JDK_17) - - var preferredJdk: JavaSdkVersion by preferredJdkProperty - private set - - fun setPreferredJdk(value: JavaSdkVersion, reason: String) { - preferredJdk = value - preferredJdkReason = reason - sdkComboBox?.setPreferredJdk(value) - updatePreferredJdkLabel() - } - - init { - storeToData() - - sdkProperty.afterChange { - updatePreferredJdkLabel() - } - } - - private fun updatePreferredJdkLabel() { - val sdk = this.sdk ?: return - val version = JavaSdk.getInstance().getVersion(sdk) ?: return - if (version == preferredJdk) { - preferredJdkLabel?.component = null - } else { - preferredJdkLabel?.component = - JLabel(MCDevBundle("creator.validation.jdk_preferred", preferredJdk.description, preferredJdkReason)) - .also { it.foreground = JBColor.YELLOW } - } - } - - override fun setupUI(builder: Panel) { - with(builder) { - row("JDK:") { - val sdkComboBox = jdkComboBoxWithPreference(context, sdkProperty, "${javaClass.name}.sdk") - this@JdkProjectSetupFinalizer.sdkComboBox = sdkComboBox.component - this@JdkProjectSetupFinalizer.preferredJdkLabel = placeholder() - updatePreferredJdkLabel() - } - } - } - - class Factory : ProjectSetupFinalizer.Factory { - override fun create(parent: NewProjectWizardStep) = JdkProjectSetupFinalizer(parent) - } -} Index: src/main/kotlin/creator/buildsystem/AbstractBuildSystemStep.kt =================================================================== --- src/main/kotlin/creator/buildsystem/AbstractBuildSystemStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/buildsystem/AbstractBuildSystemStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,120 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.buildsystem - -import com.demonwav.mcdev.asset.MCDevBundle -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.storeToData -import com.intellij.ide.util.projectWizard.WizardContext -import com.intellij.ide.wizard.AbstractNewProjectWizardMultiStep -import com.intellij.ide.wizard.AbstractNewProjectWizardStep -import com.intellij.ide.wizard.NewProjectWizardMultiStepFactory -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.extensions.ExtensionPointName -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key -import com.intellij.ui.dsl.builder.Panel - -abstract class AbstractBuildSystemStep( - parent: NewProjectWizardStep, -) : AbstractNewProjectWizardMultiStep(parent, EP_NAME) { - companion object { - private val PLATFORM_NAME_KEY = Key.create("mcdev.platformName") - val EP_NAME = ExtensionPointName("com.demonwav.minecraft-dev.buildSystemWizard") - } - - init { - storeToData(javaClass) - } - - abstract val platformName: String - - override val self get() = this - override val label - get() = MCDevBundle("creator.ui.build_system.label") - - override fun initSteps(): LinkedHashMap { - context.putUserData(PLATFORM_NAME_KEY, platformName) - return super.initSteps() - } - - override fun setupSwitcherUi(builder: Panel) { - if (steps.size > 1) { - super.setupSwitcherUi(builder) - } - } - - override fun setupUI(builder: Panel) { - val stepUninitialized = step.isEmpty() - super.setupUI(builder) - - // if no value was previously set for the step (i.e. not saved from when the user previously used this wizard) - // then set the build system to the preferred one for this platform, if one exists - if (stepUninitialized) { - for (buildSystem in steps.keys) { - if (BuildSystemSupport.getInstance(platformName, buildSystem)?.preferred == true) { - step = buildSystem - break - } - } - } - } - - interface Factory : NewProjectWizardMultiStepFactory { - override fun isEnabled(context: WizardContext): Boolean { - val platformName = context.getUserData(PLATFORM_NAME_KEY) - ?: throw IllegalStateException("Platform name not set") - return BuildSystemSupport.getInstance(platformName, name) != null - } - - override fun createStep(parent: AbstractBuildSystemStep): NewProjectWizardStep { - val platformName = parent.context.getUserData(PLATFORM_NAME_KEY) - ?: throw IllegalStateException("Platform name not set") - val buildSystemSupport = BuildSystemSupport.getInstance(platformName, name) - ?: throw IllegalStateException("Build system unsupported, this factory should have been filtered out") - return buildSystemSupport.createStep(BuildSystemSupport.PRE_STEP, parent) - } - } -} - -class GradleBuildSystem : AbstractBuildSystemStep.Factory { - override val name - get() = MCDevBundle("creator.ui.build_system.label.gradle") -} - -class MavenBuildSystem : AbstractBuildSystemStep.Factory { - override val name - get() = MCDevBundle("creator.ui.build_system.label.maven") -} - -abstract class AbstractRunBuildSystemStep( - parent: NewProjectWizardStep, - private val buildSystemStepClass: Class, -) : AbstractNewProjectWizardStep(parent) { - abstract val step: String - - override fun setupProject(project: Project) { - val buildSystemStep = findStep(buildSystemStepClass) - val buildSystemSupport = BuildSystemSupport.getInstance(buildSystemStep.platformName, buildSystemStep.step) - ?: throw IllegalStateException("Build system unsupported, this should have been filtered out") - buildSystemSupport.createStep(step, this).setupProject(project) - } -} Index: src/main/kotlin/creator/buildsystem/BuildSystem.kt =================================================================== --- src/main/kotlin/creator/buildsystem/BuildSystem.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/buildsystem/BuildSystem.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,42 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.buildsystem - -import java.util.EnumSet - -enum class BuildSystemType { - MAVEN, - GRADLE, -} - -data class BuildDependency( - val groupId: String = "", - val artifactId: String = "", - val version: String = "", - val mavenScope: String? = null, - val gradleConfiguration: String? = null, -) - -data class BuildRepository( - var id: String = "", - var url: String = "", - val buildSystems: EnumSet = EnumSet.allOf(BuildSystemType::class.java), -) Index: src/main/kotlin/creator/buildsystem/BuildSystemPropertiesStep.kt =================================================================== --- src/main/kotlin/creator/buildsystem/BuildSystemPropertiesStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/buildsystem/BuildSystemPropertiesStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,94 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.buildsystem - -import com.demonwav.mcdev.asset.MCDevBundle -import com.demonwav.mcdev.creator.storeToData -import com.demonwav.mcdev.util.SemanticVersion -import com.intellij.ide.wizard.AbstractNewProjectWizardStep -import com.intellij.ide.wizard.NewProjectWizardBaseData -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.observable.util.bindStorage -import com.intellij.openapi.ui.validation.CHECK_ARTIFACT_ID -import com.intellij.openapi.ui.validation.CHECK_GROUP_ID -import com.intellij.openapi.ui.validation.CHECK_NON_EMPTY -import com.intellij.openapi.ui.validation.WHEN_GRAPH_PROPAGATION_FINISHED -import com.intellij.openapi.ui.validation.validationErrorIf -import com.intellij.ui.dsl.builder.COLUMNS_MEDIUM -import com.intellij.ui.dsl.builder.Panel -import com.intellij.ui.dsl.builder.bindText -import com.intellij.ui.dsl.builder.columns -import com.intellij.ui.dsl.builder.textValidation - -private val nonExampleValidation = validationErrorIf(MCDevBundle("creator.validation.group_id_non_example")) { - it == "org.example" -} - -private val versionValidation = validationErrorIf(MCDevBundle("creator.validation.semantic_version")) { - SemanticVersion.tryParse(it) == null -} - -class BuildSystemPropertiesStep(private val parent: ParentStep) : AbstractNewProjectWizardStep(parent) - where ParentStep : NewProjectWizardStep, ParentStep : NewProjectWizardBaseData { - - val groupIdProperty = propertyGraph.property("org.example") - .bindStorage("${javaClass.name}.groupId") - val artifactIdProperty = propertyGraph.lazyProperty(::suggestArtifactId) - val versionProperty = propertyGraph.property("1.0-SNAPSHOT") - .bindStorage("${javaClass.name}.version") - - var groupId by groupIdProperty - var artifactId by artifactIdProperty - var version by versionProperty - - init { - artifactIdProperty.dependsOn(parent.nameProperty, ::suggestArtifactId) - storeToData() - } - - private fun suggestArtifactId() = parent.name - - override fun setupUI(builder: Panel) { - builder.collapsibleGroup(MCDevBundle("creator.ui.group.title")) { - row(MCDevBundle("creator.ui.group.group_id")) { - textField() - .bindText(groupIdProperty) - .columns(COLUMNS_MEDIUM) - .validationRequestor(WHEN_GRAPH_PROPAGATION_FINISHED(propertyGraph)) - .textValidation(CHECK_NON_EMPTY, CHECK_GROUP_ID, nonExampleValidation) - } - row(MCDevBundle("creator.ui.group.artifact_id")) { - textField() - .bindText(artifactIdProperty) - .columns(COLUMNS_MEDIUM) - .validationRequestor(WHEN_GRAPH_PROPAGATION_FINISHED(propertyGraph)) - .textValidation(CHECK_NON_EMPTY, CHECK_ARTIFACT_ID) - } - row(MCDevBundle("creator.ui.group.version")) { - textField() - .bindText(versionProperty) - .columns(COLUMNS_MEDIUM) - .validationRequestor(WHEN_GRAPH_PROPAGATION_FINISHED(propertyGraph)) - .textValidation(versionValidation) - } - }.expanded = true - } -} Index: src/main/kotlin/creator/buildsystem/BuildSystemSupport.kt =================================================================== --- src/main/kotlin/creator/buildsystem/BuildSystemSupport.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/buildsystem/BuildSystemSupport.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,66 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.buildsystem - -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.extensions.ExtensionPointName -import com.intellij.openapi.extensions.RequiredElement -import com.intellij.openapi.util.KeyedExtensionCollector -import com.intellij.serviceContainer.BaseKeyedLazyInstance -import com.intellij.util.KeyedLazyInstance -import com.intellij.util.xmlb.annotations.Attribute - -interface BuildSystemSupport { - companion object { - private val EP_NAME = ExtensionPointName>( - "com.demonwav.minecraft-dev.buildSystemSupport", - ) - private val COLLECTOR = KeyedExtensionCollector>(EP_NAME) - - fun getInstance(platform: String, buildSystem: String): BuildSystemSupport? = - COLLECTOR.findSingle(platform to buildSystem) - - const val PRE_STEP = "pre" - const val POST_STEP = "post" - } - - fun createStep(step: String, parent: NewProjectWizardStep): NewProjectWizardStep - - val preferred get() = false -} - -class BuildSystemSupportEntry : BaseKeyedLazyInstance(), KeyedLazyInstance { - @Attribute("implementation") - @RequiredElement - lateinit var implementation: String - - @Attribute("platform") - @RequiredElement - lateinit var platform: String - - @Attribute("buildSystem") - @RequiredElement - lateinit var buildSystem: String - - override fun getKey() = (platform to buildSystem).toString() - - override fun getImplementationClassName() = implementation -} Index: src/main/kotlin/creator/buildsystem/GradleFile.kt =================================================================== --- src/main/kotlin/creator/buildsystem/GradleFile.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/buildsystem/GradleFile.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,242 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2026 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.buildsystem - -import com.demonwav.mcdev.util.childrenOfType -import com.demonwav.mcdev.util.mapFirstNotNull -import com.intellij.openapi.extensions.ExtensionPointName -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.text.StringUtil -import com.intellij.psi.PsiFile -import org.jetbrains.annotations.ApiStatus.Internal -import org.jetbrains.kotlin.psi.KtBinaryExpression -import org.jetbrains.kotlin.psi.KtBlockExpression -import org.jetbrains.kotlin.psi.KtCallExpression -import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.kotlin.psi.KtNameReferenceExpression -import org.jetbrains.kotlin.psi.KtPsiFactory -import org.jetbrains.kotlin.psi.KtScriptInitializer -import org.jetbrains.plugins.groovy.lang.psi.GroovyFile -import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory -import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrClosableBlock -import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrMethodCallExpression -import org.jetbrains.plugins.groovy.lang.psi.api.util.GrStatementOwner - -@Internal -interface GradleFile { - companion object { - val EP_NAME = ExtensionPointName("com.demonwav.minecraft-dev.gradleFileType") - } - - val psi: PsiFile - - fun addRepositories(project: Project, repositories: List) - fun addDependencies(project: Project, dependencies: List) - fun addPlugins(project: Project, plugins: List) - - interface Type { - fun createGradleFile(psiFile: PsiFile): GradleFile? - } -} - -class GroovyGradleFile(override val psi: GroovyFile) : GradleFile { - override fun addRepositories(project: Project, repositories: List) { - val reposBlock = findOrCreateGroovyBlock(project, psi, "repositories") - val elementFactory = GroovyPsiElementFactory.getInstance(project) - for (repo in repositories) { - if (BuildSystemType.GRADLE !in repo.buildSystems) { - continue - } - val mavenBlock = - elementFactory.createStatementFromText("maven {\n}", reposBlock) as GrMethodCallExpression - val mavenClosure = mavenBlock.closureArguments[0] - if (repo.id.isNotBlank()) { - val idStatement = - elementFactory.createStatementFromText("name = ${makeStringLiteral(repo.id)}") - mavenClosure.addStatementBefore(idStatement, null) - } - val urlStatement = - elementFactory.createStatementFromText("url = ${makeStringLiteral(repo.url)}") - mavenClosure.addStatementBefore(urlStatement, null) - reposBlock.addStatementBefore(mavenBlock, null) - } - } - - override fun addDependencies(project: Project, dependencies: List) { - val depsBlock = findOrCreateGroovyBlock(project, psi, "dependencies") - val elementFactory = GroovyPsiElementFactory.getInstance(project) - for (dep in dependencies) { - val gradleConfig = dep.gradleConfiguration ?: continue - val stmt = elementFactory.createStatementFromText( - "$gradleConfig \"${escapeGString(dep.groupId)}:${ - escapeGString(dep.artifactId) - }:${escapeGString(dep.version)}\"", - depsBlock, - ) - depsBlock.addStatementBefore(stmt, null) - } - } - - override fun addPlugins(project: Project, plugins: List) { - val pluginsBlock = findOrCreateGroovyBlock(project, psi, "plugins", first = true) - val elementFactory = GroovyPsiElementFactory.getInstance(project) - for (plugin in plugins) { - val stmt = elementFactory.createStatementFromText(makePluginStatement(plugin, false)) - pluginsBlock.addStatementBefore(stmt, null) - } - } - - private fun findGroovyBlock(element: GrStatementOwner, name: String): GrClosableBlock? { - return element.statements - .mapFirstNotNull { call -> - if (call is GrMethodCallExpression && call.callReference?.methodName == name) { - call.closureArguments.firstOrNull() - } else { - null - } - } - } - - private fun findOrCreateGroovyBlock( - project: Project, - element: GrStatementOwner, - name: String, - first: Boolean = false, - ): GrClosableBlock { - findGroovyBlock(element, name)?.let { return it } - val block = GroovyPsiElementFactory.getInstance(project).createStatementFromText("$name {\n}", element) - val anchor = if (first) { - element.statements.firstOrNull() - } else { - null - } - return (element.addStatementBefore(block, anchor) as GrMethodCallExpression).closureArguments.first() - } - - class Type : GradleFile.Type { - override fun createGradleFile(psiFile: PsiFile) = (psiFile as? GroovyFile)?.let(::GroovyGradleFile) - } -} - -class KotlinGradleFile(override val psi: KtFile) : GradleFile { - override fun addRepositories(project: Project, repositories: List) { - val script = psi.script?.blockExpression ?: return - val reposBlock = findOrCreateKotlinBlock(project, script, "repositories") - val elementFactory = KtPsiFactory(project) - for (repo in repositories) { - if (BuildSystemType.GRADLE !in repo.buildSystems) { - continue - } - val mavenBlock = elementFactory.createExpression("maven {\n}") as KtCallExpression - val mavenLambda = mavenBlock.lambdaArguments[0].getLambdaExpression()!!.bodyExpression!! - if (repo.id.isNotBlank()) { - val idStatement = elementFactory.createAssignment("name = ${makeStringLiteral(repo.id)}") - mavenLambda.addBefore(idStatement, mavenLambda.rBrace) - } - val urlStatement = elementFactory.createAssignment("url = uri(${makeStringLiteral(repo.url)})") - mavenLambda.addBefore(urlStatement, mavenLambda.rBrace) - reposBlock.addBefore(mavenBlock, reposBlock.rBrace) - } - } - - override fun addDependencies(project: Project, dependencies: List) { - val script = psi.script?.blockExpression ?: return - val depsBlock = findOrCreateKotlinBlock(project, script, "dependencies") - val elementFactory = KtPsiFactory(project) - for (dep in dependencies) { - val gradleConfig = dep.gradleConfiguration ?: continue - val stmt = elementFactory.createExpression( - "$gradleConfig(\"${escapeGString(dep.groupId)}:${ - escapeGString(dep.artifactId) - }:${escapeGString(dep.version)}\")", - ) - depsBlock.addBefore(stmt, depsBlock.rBrace) - } - } - - override fun addPlugins(project: Project, plugins: List) { - val script = psi.script?.blockExpression ?: return - val pluginsBlock = findOrCreateKotlinBlock(project, script, "plugins", first = true) - val elementFactory = KtPsiFactory(project) - for (plugin in plugins) { - val stmt = elementFactory.createExpression(makePluginStatement(plugin, true)) - pluginsBlock.addBefore(stmt, pluginsBlock.rBrace) - } - } - - private fun findKotlinBlock(element: KtBlockExpression, name: String): KtBlockExpression? { - return element.childrenOfType() - .flatMap { it.childrenOfType() } - .mapFirstNotNull { call -> - if ((call.calleeExpression as? KtNameReferenceExpression)?.getReferencedName() == name) { - call.lambdaArguments.firstOrNull()?.getLambdaExpression()?.bodyExpression - } else { - null - } - } - } - - private fun findOrCreateKotlinBlock( - project: Project, - element: KtBlockExpression, - name: String, - first: Boolean = false, - ): KtBlockExpression { - findKotlinBlock(element, name)?.let { return it } - val block = KtPsiFactory(project).createExpression("$name {\n}") - val addedBlock = if (first) { - element.addAfter(block, element.lBrace) - } else { - element.addBefore(block, element.rBrace) - } - return (addedBlock as KtCallExpression).lambdaArguments.first().getLambdaExpression()!!.bodyExpression!! - } - - private fun KtPsiFactory.createAssignment(text: String): KtBinaryExpression { - return this.createBlock(text).firstStatement as KtBinaryExpression - } - - class Type : GradleFile.Type { - override fun createGradleFile(psiFile: PsiFile) = (psiFile as? KtFile)?.let(::KotlinGradleFile) - } -} - -private fun makeStringLiteral(str: String): String { - return "\"${escapeGString(str)}\"" -} - -private fun escapeGString(str: String): String { - return StringUtil.escapeStringCharacters(str.length, str, "\"$", StringBuilder()).toString() -} - -private fun makePluginStatement(plugin: GradlePlugin, kotlin: Boolean): String { - return buildString { - if (kotlin) { - append("id(${makeStringLiteral(plugin.id)})") - } else { - append("id ${makeStringLiteral(plugin.id)}") - } - plugin.version?.let { append(" version ${makeStringLiteral(it)}") } - if (!plugin.apply) { - append(" apply false") - } - } -} Index: src/main/kotlin/creator/buildsystem/gradle-steps.kt =================================================================== --- src/main/kotlin/creator/buildsystem/gradle-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/buildsystem/gradle-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,299 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.buildsystem - -import com.demonwav.mcdev.asset.MCDevBundle -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.notifyCreatedProjectNotOpened -import com.demonwav.mcdev.creator.step.AbstractLongRunningStep -import com.demonwav.mcdev.creator.step.AbstractReformatFilesStep -import com.demonwav.mcdev.creator.step.FixedAssetsNewProjectWizardStep -import com.demonwav.mcdev.util.MinecraftTemplates.Companion.GRADLE_WRAPPER_PROPERTIES -import com.demonwav.mcdev.util.SemanticVersion -import com.demonwav.mcdev.util.invokeAndWait -import com.demonwav.mcdev.util.invokeLater -import com.demonwav.mcdev.util.mapFirstNotNull -import com.demonwav.mcdev.util.runGradleTask -import com.demonwav.mcdev.util.runWriteAction -import com.demonwav.mcdev.util.runWriteTask -import com.demonwav.mcdev.util.virtualFileOrError -import com.intellij.execution.RunManager -import com.intellij.ide.ui.UISettings -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.lang.properties.psi.PropertiesFile -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.fileEditor.FileDocumentManager -import com.intellij.openapi.fileEditor.impl.NonProjectFileWritingAccessProvider -import com.intellij.openapi.project.DumbService -import com.intellij.openapi.project.Project -import com.intellij.openapi.startup.StartupManager -import com.intellij.openapi.util.Key -import com.intellij.openapi.vfs.VfsUtil -import com.intellij.openapi.vfs.VirtualFile -import com.intellij.openapi.wm.WindowManager -import com.intellij.openapi.wm.ex.StatusBarEx -import com.intellij.psi.PsiDocumentManager -import com.intellij.psi.PsiFile -import com.intellij.psi.PsiManager -import java.nio.file.Path -import java.util.concurrent.CountDownLatch -import kotlinx.coroutines.runBlocking -import org.jetbrains.plugins.gradle.service.execution.GradleExternalTaskConfigurationType -import org.jetbrains.plugins.gradle.service.execution.GradleRunConfiguration -import org.jetbrains.plugins.gradle.service.project.open.canLinkAndRefreshGradleProject -import org.jetbrains.plugins.gradle.service.project.open.linkAndSyncGradleProject - -val DEFAULT_GRADLE_VERSION = SemanticVersion.release(8, 7) -val GRADLE_VERSION_KEY = Key.create("mcdev.gradleVersion") - -fun FixedAssetsNewProjectWizardStep.addGradleWrapperProperties(project: Project) { - val gradleVersion = data.getUserData(GRADLE_VERSION_KEY) ?: DEFAULT_GRADLE_VERSION - addTemplateProperties("GRADLE_WRAPPER_VERSION" to gradleVersion) - addTemplates(project, "gradle/wrapper/gradle-wrapper.properties" to GRADLE_WRAPPER_PROPERTIES) -} - -abstract class AbstractRunGradleTaskStep(parent: NewProjectWizardStep) : AbstractLongRunningStep(parent) { - abstract val task: String - override val description get() = "Running Gradle task: '$task'" - - override fun perform(project: Project) { - val outputDirectory = context.projectFileDirectory - DumbService.getInstance(project).runWhenSmart { - runGradleTask(project, Path.of(outputDirectory)) { settings -> - settings.taskNames = listOf(task) - } - } - } -} - -class GradleWrapperStep(parent: NewProjectWizardStep) : AbstractRunGradleTaskStep(parent) { - override val task = "wrapper" -} - -abstract class AbstractPatchGradleFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningStep(parent) { - override val description - get() = MCDevBundle("creator.step.gradle.patch_gradle.description") - - abstract fun patch(project: Project, gradleFiles: GradleFiles) - - protected fun addRepositories(project: Project, buildGradle: GradleFile?, repositories: List) { - if (buildGradle == null || repositories.isEmpty()) { - return - } - - buildGradle.psi.runWriteAction { - buildGradle.addRepositories(project, repositories) - } - } - - protected fun addDependencies(project: Project, buildGradle: GradleFile?, dependencies: List) { - if (buildGradle == null || dependencies.isEmpty()) { - return - } - - buildGradle.psi.runWriteAction { - buildGradle.addDependencies(project, dependencies) - } - } - - protected fun addPlugins(project: Project, buildGradle: GradleFile?, plugins: List) { - if (buildGradle == null || plugins.isEmpty()) { - return - } - - buildGradle.psi.runWriteAction { - buildGradle.addPlugins(project, plugins) - } - } - - override fun perform(project: Project) { - invokeAndWait { - if (project.isDisposed || !project.isInitialized) { - notifyCreatedProjectNotOpened() - return@invokeAndWait - } - - runWriteTask { - val rootDir = VfsUtil.findFile(Path.of(context.projectFileDirectory), true) - ?: return@runWriteTask - val gradleFiles = GradleFiles(project, rootDir) - NonProjectFileWritingAccessProvider.disableChecksDuring { - patch(project, gradleFiles) - gradleFiles.commit() - } - } - } - } - - class GradleFiles( - private val project: Project, - private val rootDir: VirtualFile, - ) { - private val lazyBuildGradle = lazy { - val file = rootDir.findChild("build.gradle") ?: rootDir.findChild("build.gradle.kts") - ?: return@lazy null - makeGradleFile(file) - } - private val lazySettingsGradle = lazy { - val file = rootDir.findChild("settings.gradle") ?: rootDir.findChild("settings.gradle.kts") - ?: return@lazy null - makeGradleFile(file) - } - private val lazyGradleProperties = lazy { - val file = rootDir.findChild("gradle.properties") ?: return@lazy null - PsiManager.getInstance(project).findFile(file) as? PropertiesFile - } - - val buildGradle by lazyBuildGradle - val settingsGradle by lazySettingsGradle - val gradleProperties by lazyGradleProperties - - private fun makeGradleFile(virtualFile: VirtualFile): GradleFile? { - val psi = PsiManager.getInstance(project).findFile(virtualFile) ?: return null - return GradleFile.EP_NAME.extensions.mapFirstNotNull { it.createGradleFile(psi) } - } - - fun commit() { - val files = mutableListOf() - if (lazyBuildGradle.isInitialized()) { - buildGradle?.psi?.let { files += it } - } - if (lazySettingsGradle.isInitialized()) { - settingsGradle?.psi?.let { files += it } - } - if (lazyGradleProperties.isInitialized()) { - (gradleProperties as? PsiFile)?.let { files += it } - } - - val psiDocumentManager = PsiDocumentManager.getInstance(project) - val fileDocumentManager = FileDocumentManager.getInstance() - for (file in files) { - val document = psiDocumentManager.getDocument(file) ?: continue - fileDocumentManager.saveDocument(document) - } - } - } -} - -open class GradleImportStep(parent: NewProjectWizardStep) : AbstractLongRunningStep(parent) { - override val description - get() = MCDevBundle("creator.step.gradle.import_gradle.description") - - open val additionalRunTasks = emptyList() - - override fun perform(project: Project) { - if (!project.isInitialized) { - notifyCreatedProjectNotOpened() - return - } - - val rootDirectory = Path.of(context.projectFileDirectory) - val buildSystemProps = findStep>() - - // Tell IntelliJ to import this project - rootDirectory.virtualFileOrError.refresh(false, true) - - val latch = CountDownLatch(1) - - invokeLater(project.disposed) { - val path = rootDirectory.toAbsolutePath().toString() - if (canLinkAndRefreshGradleProject(path, project, false)) { - runBlocking { - linkAndSyncGradleProject(project, path) - } - showProgress(project) - } - - StartupManager.getInstance(project).runAfterOpened { - latch.countDown() - } - } - - // Set up the run config - // Get the gradle external task type, this is what sets it as a gradle task - addRunTaskConfiguration(project, rootDirectory, buildSystemProps, "build") - for (tasks in additionalRunTasks) { - addRunTaskConfiguration(project, rootDirectory, buildSystemProps, tasks) - } - - if (!ApplicationManager.getApplication().isDispatchThread) { - latch.await() - } - } - - private fun addRunTaskConfiguration( - project: Project, - rootDirectory: Path, - buildSystemProps: BuildSystemPropertiesStep<*>, - task: String, - ) { - val gradleType = GradleExternalTaskConfigurationType.getInstance() - - val runManager = RunManager.getInstance(project) - val runConfigName = buildSystemProps.artifactId + ' ' + task - - val runConfiguration = GradleRunConfiguration(project, gradleType.factory, runConfigName) - - // Set relevant gradle values - runConfiguration.settings.externalProjectPath = rootDirectory.toAbsolutePath().toString() - runConfiguration.settings.executionName = runConfigName - runConfiguration.settings.taskNames = listOf(task) - - runConfiguration.isAllowRunningInParallel = false - - val settings = runManager.createConfiguration( - runConfiguration, - gradleType.factory, - ) - - settings.isActivateToolWindowBeforeRun = true - settings.storeInLocalWorkspace() - - runManager.addConfiguration(settings) - if (runManager.selectedConfiguration == null) { - runManager.selectedConfiguration = settings - } - } -} - -class ReformatBuildGradleStep(parent: NewProjectWizardStep) : AbstractReformatFilesStep(parent) { - override fun addFilesToReformat() { - addFileToReformat("build.gradle") - addFileToReformat("build.gradle.kts") - } -} - -// Show the background processes window for setup tasks -private fun showProgress(project: Project) { - if (!UISettings.getInstance().showStatusBar || UISettings.getInstance().presentationMode) { - return - } - - val statusBar = WindowManager.getInstance().getStatusBar(project) as? StatusBarEx ?: return - statusBar.isProcessWindowOpen = true -} - -data class GradlePlugin( - val id: String, - val version: String? = null, - val apply: Boolean = true, -) Index: src/main/kotlin/creator/buildsystem/maven-steps.kt =================================================================== --- src/main/kotlin/creator/buildsystem/maven-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/buildsystem/maven-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,216 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.buildsystem - -import com.demonwav.mcdev.asset.MCDevBundle -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.getVersionJson -import com.demonwav.mcdev.creator.notifyCreatedProjectNotOpened -import com.demonwav.mcdev.creator.step.AbstractLongRunningStep -import com.demonwav.mcdev.creator.step.AbstractModNameStep -import com.demonwav.mcdev.creator.step.AbstractReformatFilesStep -import com.demonwav.mcdev.creator.step.DescriptionStep -import com.demonwav.mcdev.creator.step.FixedAssetsNewProjectWizardStep -import com.demonwav.mcdev.creator.step.WebsiteStep -import com.demonwav.mcdev.util.invokeAndWait -import com.demonwav.mcdev.util.runWriteAction -import com.demonwav.mcdev.util.runWriteTask -import com.intellij.execution.RunManager -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.fileEditor.FileDocumentManager -import com.intellij.openapi.fileEditor.impl.NonProjectFileWritingAccessProvider -import com.intellij.openapi.project.Project -import com.intellij.openapi.vfs.VfsUtil -import com.intellij.psi.PsiDocumentManager -import com.intellij.psi.PsiManager -import com.intellij.psi.xml.XmlFile -import com.intellij.psi.xml.XmlTag -import com.intellij.util.xml.DomManager -import java.nio.file.Path -import kotlinx.coroutines.runBlocking -import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel -import org.jetbrains.idea.maven.execution.MavenRunConfiguration -import org.jetbrains.idea.maven.execution.MavenRunConfigurationType - -private val pluginVersions by lazy { - runBlocking { - getVersionJson>("maven.json") - .mapKeys { (k, _) -> k.replace('-', '_') } - } -} - -fun FixedAssetsNewProjectWizardStep.addDefaultMavenProperties() { - addTemplateProperties(pluginVersions) -} - -abstract class AbstractPatchPomStep(parent: NewProjectWizardStep) : AbstractLongRunningStep(parent) { - override val description - get() = MCDevBundle("creator.step.maven.patch_pom.description") - - open fun patchPom(model: MavenDomProjectModel, root: XmlTag) { - setupCore(model) - setupName(model) - setupInfo(root) - } - - protected fun setupCore(model: MavenDomProjectModel) { - val buildSystemProps = findStep>() - model.groupId.value = buildSystemProps.groupId - model.artifactId.value = buildSystemProps.artifactId - model.version.value = buildSystemProps.version - } - - protected fun setupName(model: MavenDomProjectModel) { - val name = data.getUserData(AbstractModNameStep.KEY) ?: return - model.name.value = name - } - - protected fun setupInfo(root: XmlTag) { - val website = data.getUserData(WebsiteStep.KEY) - val description = data.getUserData(DescriptionStep.KEY) - - val properties = root.findFirstSubTag("properties") - if (!website.isNullOrBlank()) { - val url = root.createChildTag("url", null, website, false) - root.addAfter(url, properties) - } - - if (!description.isNullOrBlank()) { - val descriptionTag = root.createChildTag("description", null, description, false) - root.addBefore(descriptionTag, properties) - } - } - - protected fun setupDependencies( - model: MavenDomProjectModel, - repositories: List, - dependencies: List, - ) { - for ((id, url, types) in repositories) { - if (!types.contains(BuildSystemType.MAVEN)) { - continue - } - val repository = model.repositories.addRepository() - repository.id.value = id - repository.url.value = url - } - - for ((depGroupId, depArtifactId, depVersion, scope) in dependencies) { - if (scope == null) { - continue - } - val dependency = model.dependencies.addDependency() - dependency.groupId.value = depGroupId - dependency.artifactId.value = depArtifactId - dependency.version.value = depVersion - dependency.scope.value = scope - } - } - - override fun perform(project: Project) { - invokeAndWait { - if (project.isDisposed || !project.isInitialized) { - notifyCreatedProjectNotOpened() - return@invokeAndWait - } - - runWriteTask { - val pomFile = VfsUtil.findFile(Path.of(context.projectFileDirectory, "pom.xml"), true) - ?: return@runWriteTask - val pomPsi = PsiManager.getInstance(project).findFile(pomFile) as? XmlFile ?: return@runWriteTask - - pomPsi.name = "pom.xml" - - NonProjectFileWritingAccessProvider.disableChecksDuring { - pomPsi.runWriteAction { - val manager = DomManager.getDomManager(project) - val mavenProjectXml = - manager.getFileElement(pomPsi, MavenDomProjectModel::class.java)?.rootElement - ?: return@runWriteAction - - val root = pomPsi.rootTag ?: return@runWriteAction - - patchPom(mavenProjectXml, root) - - // The maven importer requires that the document is saved to disk - val document = PsiDocumentManager.getInstance(project).getDocument(pomPsi) - ?: return@runWriteAction - PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(document) - FileDocumentManager.getInstance().saveDocument(document) - } - } - } - } - } -} - -class ReformatPomStep(parent: NewProjectWizardStep) : AbstractReformatFilesStep(parent) { - override fun addFilesToReformat() { - addFileToReformat("pom.xml") - } -} - -class MavenImportStep(parent: NewProjectWizardStep) : AbstractLongRunningStep(parent) { - override val description - get() = MCDevBundle("creator.step.maven.import_maven.description") - - override fun perform(project: Project) { - if (project.isDisposed || !project.isInitialized) { - notifyCreatedProjectNotOpened() - return - } - - val buildSystemProps = findStep>() - addRunTaskConfiguration(project, buildSystemProps, "package") - } - - private fun addRunTaskConfiguration( - project: Project, - buildSystemProps: BuildSystemPropertiesStep<*>, - task: String, - ) { - val mavenConfigFactory = MavenRunConfigurationType.getInstance().configurationFactories.first() - - val runManager = RunManager.getInstance(project) - val runConfigName = buildSystemProps.artifactId + ' ' + task - - val templateConfig = mavenConfigFactory.createTemplateConfiguration(project) - val runConfiguration = mavenConfigFactory.createConfiguration(runConfigName, templateConfig) - as MavenRunConfiguration - runConfiguration.runnerParameters.goals.add(task) - runConfiguration.runnerParameters.workingDirPath = context.projectDirectory.toString() - - runConfiguration.isAllowRunningInParallel = false - - val settings = runManager.createConfiguration( - runConfiguration, - mavenConfigFactory, - ) - - settings.isActivateToolWindowBeforeRun = true - settings.storeInLocalWorkspace() - - runManager.addConfiguration(settings) - if (runManager.selectedConfiguration == null) { - runManager.selectedConfiguration = settings - } - } -} Index: src/main/kotlin/creator/creator-utils.kt =================================================================== --- src/main/kotlin/creator/creator-utils.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/creator-utils.kt (revision 5b58533d2538785c831cb16e30c6c4cf0e696381) @@ -3,7 +3,7 @@ * * https://mcdev.io/ * - * Copyright (C) 2025 minecraft-dev + * Copyright (C) 2026 minecraft-dev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published @@ -20,153 +20,13 @@ package com.demonwav.mcdev.creator -import com.demonwav.mcdev.creator.step.AuthorsStep -import com.demonwav.mcdev.creator.step.FixedAssetsNewProjectWizardStep -import com.demonwav.mcdev.creator.step.LicenseStep -import com.demonwav.mcdev.util.MinecraftTemplates -import com.intellij.ide.fileTemplates.FileTemplateManager -import com.intellij.ide.starters.local.GeneratorTemplateFile import com.intellij.ide.util.projectWizard.WizardContext -import com.intellij.ide.wizard.AbstractNewProjectWizardStep import com.intellij.ide.wizard.AbstractWizard -import com.intellij.ide.wizard.GitNewProjectWizardData -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.notification.Notification -import com.intellij.notification.NotificationType import com.intellij.openapi.application.ModalityState import com.intellij.openapi.diagnostic.thisLogger -import com.intellij.openapi.observable.properties.ObservableMutableProperty -import com.intellij.openapi.observable.properties.ObservableProperty import com.intellij.openapi.progress.ProgressManager -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key -import com.intellij.openapi.util.RecursionManager -import java.time.ZonedDateTime import javax.swing.JComponent -val NewProjectWizardStep.gitEnabled - get() = data.getUserData(GitNewProjectWizardData.KEY)!!.git - -fun FixedAssetsNewProjectWizardStep.addGradleGitignore(project: Project) { - addTemplates(project, ".gitignore" to MinecraftTemplates.GRADLE_GITIGNORE_TEMPLATE) -} - -fun FixedAssetsNewProjectWizardStep.addMavenGitignore(project: Project) { - addTemplates(project, ".gitignore" to MinecraftTemplates.MAVEN_GITIGNORE_TEMPLATE) -} - -fun FixedAssetsNewProjectWizardStep.addTemplates(project: Project, vararg templates: Pair) { - addTemplates(project, templates.toMap()) -} - -fun FixedAssetsNewProjectWizardStep.addTemplates(project: Project, templates: Map) { - val manager = FileTemplateManager.getInstance(project) - addAssets(templates.map { (path, template) -> GeneratorTemplateFile(path, manager.getJ2eeTemplate(template)) }) -} - -fun FixedAssetsNewProjectWizardStep.addLicense(project: Project) { - val license = data.getUserData(LicenseStep.KEY) ?: return - val authors = data.getUserData(AuthorsStep.KEY) ?: return - addTemplateProperties( - "YEAR" to ZonedDateTime.now().year, - "AUTHOR" to authors.joinToString(", "), - ) - addTemplates(project, "LICENSE" to "${license.id}.txt") -} - -fun splitPackage(text: String): Pair { - val index = text.lastIndexOf('.') - if (index == -1) { - return null to text - } - - val className = text.substring(index + 1) - val packageName = text.substring(0, index) - return packageName to className -} - -private val stepClassToKey = mutableMapOf, Key<*>>() - -@Suppress("UNCHECKED_CAST") -@PublishedApi -internal fun getOrCreateClassKey(clazz: Class) = - stepClassToKey.computeIfAbsent(clazz) { - Key.create(it.name) - } as Key - -private val stepClassToWhenAvailableKey = mutableMapOf, Key<*>>() - -@Suppress("UNCHECKED_CAST") -@PublishedApi -internal fun getWhenAvailableKey(clazz: Class) = - stepClassToWhenAvailableKey[clazz] as Key Unit>>? - -@Suppress("UNCHECKED_CAST") -@PublishedApi -internal fun getOrCreateWhenAvailableKey(clazz: Class) = - stepClassToWhenAvailableKey.computeIfAbsent(clazz) { - Key.create(it.name) - } as Key Unit>> - -inline fun T.storeToData() { - storeToData(T::class.java) -} - -fun T.storeToData(clazz: Class) { - data.putUserData(getOrCreateClassKey(clazz), this) - getWhenAvailableKey(clazz)?.let { whenAvailableKey -> - data.getUserData(whenAvailableKey)?.let { whenAvailable -> - for (func in whenAvailable) { - func(this) - } - data.putUserData(whenAvailableKey, null) - } - } -} - -inline fun NewProjectWizardStep.findStep(): T { - return findStep(T::class.java) -} - -fun NewProjectWizardStep.findStep(clazz: Class): T { - return data.getUserData(getOrCreateClassKey(clazz)) - ?: throw IllegalStateException("Could not find required step ${clazz.name}") -} - -inline fun NewProjectWizardStep.whenStepAvailable(noinline func: (T) -> Unit) { - val value = data.getUserData(getOrCreateClassKey(T::class.java)) - if (value != null) { - func(value) - } else { - val whenAvailableKey = getOrCreateWhenAvailableKey(T::class.java) - val whenAvailable = data.getUserData(whenAvailableKey) - ?: mutableListOf<(T) -> Unit>().also { data.putUserData(whenAvailableKey, it) } - whenAvailable += func - } -} - -private val updateWhenChangedGuard = - RecursionManager.createGuard>("mcdev.updateWhenChangedGuard") - -fun ObservableMutableProperty.updateWhenChanged(dependency: ObservableProperty<*>, suggestor: () -> T) { - dependency.afterChange { - updateWhenChangedGuard.doPreventingRecursion(this, false) { - set(suggestor()) - } - } -} - -class EmptyStep(parent: NewProjectWizardStep) : AbstractNewProjectWizardStep(parent) - -fun notifyCreatedProjectNotOpened() { - Notification( - "Minecraft project creator", - "Created project must be opened", - "Generated files might be incomplete and the project might be broken.", - NotificationType.ERROR, - ).notify(null) -} - val WizardContext.contentPanel: JComponent? get() = this.getUserData(AbstractWizard.KEY)?.contentPanel Index: src/main/kotlin/creator/platformtype/ModPlatformStep.kt =================================================================== --- src/main/kotlin/creator/platformtype/ModPlatformStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/platformtype/ModPlatformStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,53 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.platformtype - -import com.demonwav.mcdev.asset.MCDevBundle -import com.demonwav.mcdev.creator.platformtype.ModPlatformStep.Factory -import com.intellij.ide.wizard.AbstractNewProjectWizardMultiStep -import com.intellij.ide.wizard.NewProjectWizardMultiStepFactory -import com.intellij.openapi.extensions.ExtensionPointName - -/** - * The step to select a mod platform. - * - * To add custom mod platforms, register a [Factory] to the `com.demonwav.minecraft-dev.modPlatformWizard` extension - * point. - */ -class ModPlatformStep( - parent: PlatformTypeStep, -) : AbstractNewProjectWizardMultiStep(parent, EP_NAME) { - companion object { - val EP_NAME = ExtensionPointName("com.demonwav.minecraft-dev.modPlatformWizard") - } - - override val self = this - override val label - get() = MCDevBundle("creator.ui.platform.label") - - class TypeFactory : PlatformTypeStep.Factory { - override val name - get() = MCDevBundle("creator.ui.platform.mod.name") - override fun createStep(parent: PlatformTypeStep) = ModPlatformStep(parent) - } - - interface Factory : NewProjectWizardMultiStepFactory -} Index: src/main/kotlin/creator/platformtype/PlatformTypeStep.kt =================================================================== --- src/main/kotlin/creator/platformtype/PlatformTypeStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/platformtype/PlatformTypeStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,53 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.platformtype - -import com.demonwav.mcdev.asset.MCDevBundle -import com.demonwav.mcdev.creator.platformtype.PlatformTypeStep.Factory -import com.intellij.ide.wizard.AbstractNewProjectWizardMultiStep -import com.intellij.ide.wizard.NewProjectWizardBaseData -import com.intellij.ide.wizard.NewProjectWizardMultiStepFactory -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.extensions.ExtensionPointName - -/** - * The step to select the platform type (mod/plugin). - * - * To add custom platform types, register a [Factory] to the `com.demonwav.minecraft-dev.platformTypeWizard` extension - * point. - */ -class PlatformTypeStep private constructor( - parent: NewProjectWizardStep, -) : AbstractNewProjectWizardMultiStep(parent, EP_NAME), - NewProjectWizardBaseData by parent as NewProjectWizardBaseData { - companion object { - val EP_NAME = ExtensionPointName("com.demonwav.minecraft-dev.platformTypeWizard") - - fun

create(parent: P) where P : NewProjectWizardStep, P : NewProjectWizardBaseData = - PlatformTypeStep(parent) - } - - override val self = this - override val label - get() = MCDevBundle("creator.ui.platform.type.label") - - interface Factory : NewProjectWizardMultiStepFactory -} Index: src/main/kotlin/creator/platformtype/PluginPlatformStep.kt =================================================================== --- src/main/kotlin/creator/platformtype/PluginPlatformStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/platformtype/PluginPlatformStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,53 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.platformtype - -import com.demonwav.mcdev.asset.MCDevBundle -import com.demonwav.mcdev.creator.platformtype.PluginPlatformStep.Factory -import com.intellij.ide.wizard.AbstractNewProjectWizardMultiStep -import com.intellij.ide.wizard.NewProjectWizardMultiStepFactory -import com.intellij.openapi.extensions.ExtensionPointName - -/** - * The step to select a mod platform. - * - * To add custom mod platforms, register a [Factory] to the `com.demonwav.minecraft-dev.pluginPlatformWizard` extension - * point. - */ -class PluginPlatformStep( - parent: PlatformTypeStep, -) : AbstractNewProjectWizardMultiStep(parent, EP_NAME) { - companion object { - val EP_NAME = ExtensionPointName("com.demonwav.minecraft-dev.pluginPlatformWizard") - } - - override val self = this - override val label - get() = MCDevBundle("creator.ui.platform.label") - - class TypeFactory : PlatformTypeStep.Factory { - override val name - get() = MCDevBundle("creator.ui.platform.plugin.name") - override fun createStep(parent: PlatformTypeStep) = PluginPlatformStep(parent) - } - - interface Factory : NewProjectWizardMultiStepFactory -} Index: src/main/kotlin/creator/step/AbstractCollapsibleStep.kt =================================================================== --- src/main/kotlin/creator/step/AbstractCollapsibleStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/step/AbstractCollapsibleStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,46 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.step - -import com.intellij.ide.wizard.AbstractNewProjectWizardStep -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project -import com.intellij.ui.dsl.builder.Panel - -abstract class AbstractCollapsibleStep(parent: NewProjectWizardStep) : AbstractNewProjectWizardStep(parent) { - private val child by lazy { createStep() } - - abstract val title: String - - protected abstract fun createStep(): NewProjectWizardStep - - override fun setupUI(builder: Panel) { - with(builder) { - collapsibleGroup(title) { - child.setupUI(this) - } - } - } - - override fun setupProject(project: Project) { - child.setupProject(project) - } -} Index: src/main/kotlin/creator/step/AbstractLatentStep.kt =================================================================== --- src/main/kotlin/creator/step/AbstractLatentStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/step/AbstractLatentStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,170 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.step - -import com.demonwav.mcdev.asset.MCDevBundle -import com.demonwav.mcdev.util.asyncIO -import com.demonwav.mcdev.util.capitalize -import com.demonwav.mcdev.util.invokeLater -import com.demonwav.mcdev.util.onHidden -import com.demonwav.mcdev.util.onShown -import com.intellij.ide.wizard.AbstractNewProjectWizardStep -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.Disposable -import com.intellij.openapi.diagnostic.logger -import com.intellij.openapi.project.Project -import com.intellij.openapi.ui.ValidationInfo -import com.intellij.openapi.ui.validation.DialogValidation -import com.intellij.openapi.ui.validation.WHEN_GRAPH_PROPAGATION_FINISHED -import com.intellij.openapi.util.Disposer -import com.intellij.ui.JBColor -import com.intellij.ui.dsl.builder.Panel -import com.intellij.ui.dsl.builder.Placeholder -import com.intellij.ui.dsl.builder.panel -import com.intellij.util.ui.AsyncProcessIcon -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.launch -import kotlinx.coroutines.swing.Swing - -/** - * Used for when a long-running task is required to fully construct the wizard steps, for example when downloading - * Minecraft versions. - */ -abstract class AbstractLatentStep(parent: NewProjectWizardStep) : AbstractNewProjectWizardStep(parent) { - companion object { - private val LOGGER = logger>() - } - - private var hasComputedData = false - private var step: NewProjectWizardStep? = null - - /** - * Description of this step displayed to the user. - * - * This should be in sentence case starting with a lower case letter, and starting with a verb in the present tense, - * like a Git commit message. - * - * For example, "download Minecraft versions" would be an appropriate description. - */ - protected abstract val description: String - - private fun doComputeData(placeholder: Placeholder, lifetime: Disposable) { - if (hasComputedData) { - return - } - hasComputedData = true - - var disposed = false - Disposer.register(lifetime) { - hasComputedData = false - disposed = true - } - - CoroutineScope(Dispatchers.Swing).launch { - if (disposed) { - return@launch - } - - val (result: T?, errorMessage: String?) = asyncIO { - try { - computeData() to null - } catch (e: Throwable) { - LOGGER.warn("computeData failed", e) - null to e.message - } - }.await() - - if (disposed) { - return@launch - } - - invokeLater { - if (disposed) { - return@invokeLater - } - - if (result == null) { - placeholder.component = panel { - row { - val labelValidationText = - MCDevBundle("creator.ui.generic_validation_failure.message", description, errorMessage) - val label = label(labelValidationText) - .validationRequestor(WHEN_GRAPH_PROPAGATION_FINISHED(propertyGraph)) - .validation(DialogValidation { ValidationInfo(labelValidationText) }) - label.component.foreground = JBColor.RED - } - } - } else { - val s = createStep(result) - step = s - val panel = panel { - s.setupUI(this) - } - placeholder.component = panel - } - } - } - } - - protected abstract suspend fun computeData(): T? - - protected abstract fun createStep(data: T): NewProjectWizardStep - - override fun setupUI(builder: Panel) { - lateinit var placeholder: Placeholder - with(builder) { - row { - placeholder = placeholder() - } - } - placeholder.component = panel { - row(description.capitalize()) { - cell( - AsyncProcessIcon("$javaClass.computeData").also { component -> - var lifetime: Disposable? = null - component.onShown { - lifetime?.let(Disposer::dispose) - lifetime = Disposer.newDisposable().also { lifetime -> - Disposer.register(context.disposable, lifetime) - doComputeData(placeholder, lifetime) - } - } - component.onHidden { - lifetime?.let(Disposer::dispose) - lifetime = null - } - }, - ) - .validationRequestor(WHEN_GRAPH_PROPAGATION_FINISHED(propertyGraph)) - .validation( - DialogValidation { - ValidationInfo(MCDevBundle("creator.ui.generic_unfinished.message", description)) - } - ) - } - } - } - - override fun setupProject(project: Project) { - step?.setupProject(project) - } -} Index: src/main/kotlin/creator/step/AbstractLongRunningAssetsStep.kt =================================================================== --- src/main/kotlin/creator/step/AbstractLongRunningAssetsStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/step/AbstractLongRunningAssetsStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,39 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.step - -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project - -abstract class AbstractLongRunningAssetsStep(parent: NewProjectWizardStep) : AbstractLongRunningStep(parent) { - protected val assets = object : FixedAssetsNewProjectWizardStep(parent) { - override fun setupAssets(project: Project) { - outputDirectory = context.projectFileDirectory - this@AbstractLongRunningAssetsStep.setupAssets(project) - } - } - - abstract fun setupAssets(project: Project) - - override fun perform(project: Project) { - assets.setupProject(project) - } -} Index: src/main/kotlin/creator/step/AbstractLongRunningStep.kt =================================================================== --- src/main/kotlin/creator/step/AbstractLongRunningStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/step/AbstractLongRunningStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,99 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.step - -import com.demonwav.mcdev.asset.MCDevBundle -import com.intellij.ide.wizard.AbstractNewProjectWizardStep -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.progress.ProgressIndicator -import com.intellij.openapi.progress.ProgressManager -import com.intellij.openapi.progress.Task -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key -import com.intellij.openapi.util.UserDataHolderEx -import java.util.concurrent.ConcurrentLinkedQueue - -private typealias TaskQueue = ConcurrentLinkedQueue - -/** - * Creator steps that either take a long time to complete, or need to be run after other steps that take a long time to - * complete. - * - * These steps show an indeterminate progress bar to the user while they are running. - */ -abstract class AbstractLongRunningStep(parent: NewProjectWizardStep) : AbstractNewProjectWizardStep(parent) { - - /** - * The text to display on the progress bar - */ - abstract val description: String - - abstract fun perform(project: Project) - - final override fun setupProject(project: Project) { - val newQueue = TaskQueue() - val queue = (data as UserDataHolderEx).putUserDataIfAbsent(TASK_QUEUE_KEY, newQueue) - queue += this - if (queue === newQueue) { - startTaskQueue(project, queue) - } - } - - private fun startTaskQueue(project: Project, queue: TaskQueue) { - val task = object : Task.Backgroundable( - project, - MCDevBundle("creator.step.generic.project_created.message") - ) { - override fun run(indicator: ProgressIndicator) { - if (project.isDisposed) { - return - } - - indicator.text = MCDevBundle("creator.step.generic.project_created.message") - var currentQueue = queue - while (true) { - while (true) { - val task = currentQueue.poll() ?: break - indicator.text2 = task.description - if (project.isDisposed) { - return - } - task.perform(project) - if (project.isDisposed) { - return - } - } - if ((data as UserDataHolderEx).replace(TASK_QUEUE_KEY, currentQueue, null)) { - break - } - currentQueue = data.getUserData(TASK_QUEUE_KEY) ?: break - } - indicator.text2 = null - } - } - - ProgressManager.getInstance().run(task) - } - - companion object { - private val TASK_QUEUE_KEY = Key.create("${AbstractLongRunningStep::class.java.name}.queue") - } -} Index: src/main/kotlin/creator/step/AbstractReformatFilesStep.kt =================================================================== --- src/main/kotlin/creator/step/AbstractReformatFilesStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/step/AbstractReformatFilesStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,71 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.step - -import com.demonwav.mcdev.asset.MCDevBundle -import com.demonwav.mcdev.creator.notifyCreatedProjectNotOpened -import com.intellij.codeInsight.actions.ReformatCodeProcessor -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.application.ReadAction -import com.intellij.openapi.command.WriteCommandAction -import com.intellij.openapi.fileEditor.impl.NonProjectFileWritingAccessProvider -import com.intellij.openapi.project.Project -import com.intellij.openapi.vfs.VfsUtil -import com.intellij.psi.PsiFile -import com.intellij.psi.PsiManager -import java.nio.file.Path - -abstract class AbstractReformatFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningStep(parent) { - override val description - get() = MCDevBundle("creator.step.reformat.description") - - private val filesToReformat = mutableListOf() - - fun addFileToReformat(file: String) { - filesToReformat += file - } - - abstract fun addFilesToReformat() - - override fun perform(project: Project) { - addFilesToReformat() - - val rootDir = VfsUtil.findFile(Path.of(context.projectFileDirectory), true) ?: return - val psiManager = PsiManager.getInstance(project) - val files = ReadAction.compute, Throwable> { - filesToReformat.mapNotNull { path -> - VfsUtil.findRelativeFile(rootDir, *path.split('/').toTypedArray())?.let(psiManager::findFile) - }.toTypedArray() - } - files.ifEmpty { return } - - NonProjectFileWritingAccessProvider.disableChecksDuring { - WriteCommandAction.writeCommandAction(project, *files).withGlobalUndo().run { - if (project.isDisposed || !project.isInitialized) { - notifyCreatedProjectNotOpened() - return@run - } - - ReformatCodeProcessor(project, files, null, false).run() - } - } - } -} Index: src/main/kotlin/creator/step/AbstractSelectVersionStep.kt =================================================================== --- src/main/kotlin/creator/step/AbstractSelectVersionStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/step/AbstractSelectVersionStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,72 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.step - -import com.intellij.ide.util.PropertiesComponent -import com.intellij.ide.wizard.AbstractNewProjectWizardStep -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.observable.util.bindStorage -import com.intellij.openapi.ui.ComboBox -import com.intellij.ui.dsl.builder.Panel -import com.intellij.ui.dsl.builder.Row -import com.intellij.ui.dsl.builder.bindItem - -abstract class AbstractSelectVersionStep>( - parent: NewProjectWizardStep, - val versions: List, -) : AbstractNewProjectWizardStep(parent) { - protected abstract val label: String - - val versionProperty = propertyGraph.property("") - .bindStorage("${javaClass.name}.selectedVersion") - var version by versionProperty - - protected lateinit var versionBox: ComboBox - - override fun setupUI(builder: Panel) { - with(builder) { - row(label) { - setupRow(this) - } - } - } - - open fun setupRow(builder: Row) { - with(builder) { - val box = comboBox(versions.sortedDescending().map(Any::toString)).bindItem(versionProperty) - val selectedItem = box.component.selectedItem - if (selectedItem is String) { - version = selectedItem - } - versionBox = box.component - - // fix the selection to the latest version if it was previously at the latest version - val props = PropertiesComponent.getInstance() - val latestVersionProp = "${javaClass.name}.latestVersion" - val prevLatestVersion = props.getValue(latestVersionProp) - val latestVersion = versions.maxOrNull()?.toString() - if (version == prevLatestVersion) { - version = latestVersion ?: "" - } - props.setValue(latestVersionProp, latestVersion) - } - } -} Index: src/main/kotlin/creator/step/AbstractVersionChainStep.kt =================================================================== --- src/main/kotlin/creator/step/AbstractVersionChainStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/step/AbstractVersionChainStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,241 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.step - -import com.intellij.ide.wizard.AbstractNewProjectWizardMultiStepBase -import com.intellij.ide.wizard.AbstractNewProjectWizardStep -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.components.PersistentStateComponent -import com.intellij.openapi.components.RoamingType -import com.intellij.openapi.components.Service -import com.intellij.openapi.components.State -import com.intellij.openapi.components.Storage -import com.intellij.openapi.components.service -import com.intellij.openapi.observable.properties.ObservableMutableProperty -import com.intellij.openapi.ui.ComboBox -import com.intellij.ui.CollectionComboBoxModel -import com.intellij.ui.dsl.builder.Cell -import com.intellij.ui.dsl.builder.Panel -import com.intellij.ui.dsl.builder.Row -import com.intellij.ui.dsl.builder.bindItem - -private class VersionProperties( - val step: AbstractVersionChainStep, - val versionProperties: Array>>, - val preferredVersions: Array>, Comparable<*>>>, -) { - init { - loadPreferredVersions() - - var propertyChangeCount = 0L - - for ((i, prop) in versionProperties.withIndex()) { - prop.afterChange { value -> - val prevPropertyChangeCount = ++propertyChangeCount - - val versionsAbove = versionProperties.take(i).map(ObservableMutableProperty>::get) - val newestVersion = step.getAvailableVersions(versionsAbove).sortedDescending().first() - if (value == newestVersion) { - preferredVersions[i].remove(versionsAbove) - } else { - preferredVersions[i][versionsAbove] = value - } - - for (j in (i + 1) until versionProperties.size) { - val versionsAboveChild = - versionProperties.take(j).map(ObservableMutableProperty>::get) - val preferredVersion = preferredVersions[j][versionsAboveChild] - step.comboBoxes?.let { comboBoxes -> - step.setSelectableItems(j, step.getAvailableVersions(versionsAboveChild).sortedDescending()) - if (preferredVersion != null) { - comboBoxes[j].selectedItem = preferredVersion - } else { - comboBoxes[j].selectedIndex = 0 - } - } ?: run { - versionProperties[j].set( - preferredVersion ?: step.getAvailableVersions(versionsAboveChild).first(), - ) - } - - // the above code could have triggered a recursive property change which would have dealt with the - // rest of what we're going to do here - if (propertyChangeCount != prevPropertyChangeCount) { - return@afterChange - } - } - - savePreferredVersions() - } - } - } - - private fun savePreferredVersions() { - val stateComponent = PreferredVersionStateComponent.getInstance() - val preferredVersions = this.preferredVersions.map { m -> - m.map { (key, value) -> key.map(Comparable<*>::toString) to value.toString() }.toMap() - } - stateComponent.set("${step.javaClass.name}.preferredVersions", preferredVersions) - } - - private fun loadPreferredVersions() { - val stateComponent = PreferredVersionStateComponent.getInstance() - val preferredVersions = stateComponent.get("${step.javaClass.name}.preferredVersions") ?: return - for ((i, preferences) in preferredVersions.withIndex()) { - if (i >= this.preferredVersions.size) { - break - } - - preferenceEntryLoop@ - for ((versionsAbove, version) in preferences) { - if (versionsAbove.size != i) { - continue@preferenceEntryLoop - } - - val parsedVersionsAbove = mutableListOf>() - for (versionAbove in versionsAbove) { - parsedVersionsAbove += step.getAvailableVersions(parsedVersionsAbove) - .firstOrNull { it.toString() == versionAbove } - ?: continue@preferenceEntryLoop - } - val parsedVersion = step.getAvailableVersions(parsedVersionsAbove) - .firstOrNull { it.toString() == version } - ?: continue@preferenceEntryLoop - - this.preferredVersions[i][parsedVersionsAbove] = parsedVersion - } - - val preferredVersion = - this.preferredVersions[i][versionProperties.take(i).map(ObservableMutableProperty>::get)] - if (preferredVersion != null) { - versionProperties[i].set(preferredVersion) - } - } - } -} - -/** - * This class replaces chains of [AbstractNewProjectWizardMultiStepBase]s. The problem with the latter approach is that - * widgets become improperly aligned. - */ -abstract class AbstractVersionChainStep( - parent: NewProjectWizardStep, - private vararg val labels: String, -) : AbstractNewProjectWizardStep(parent) { - private val versionProperties by lazy { - val versionProperties = mutableListOf>>() - for (i in labels.indices) { - versionProperties += propertyGraph.property( - getAvailableVersions(versionProperties.map(ObservableMutableProperty>::get)).first(), - ) - } - val preferredVersions = labels.indices.map { mutableMapOf>, Comparable<*>>() } - VersionProperties(this, versionProperties.toTypedArray(), preferredVersions.toTypedArray()) - } - - internal var comboBoxes: Array? = null - - abstract fun getAvailableVersions(versionsAbove: List>): List> - - fun getVersionProperty(index: Int) = versionProperties.versionProperties[index] - - fun getVersion(index: Int) = versionProperties.versionProperties[index].get() - - fun getVersionBox(index: Int) = comboBoxes?.let { it[index] } - - open fun setSelectableItems(index: Int, items: List>) { - getVersionBox(index)!!.setSelectableItems(items) - } - - open fun createComboBox(row: Row, index: Int, items: List>): Cell { - return row.cell(VersionChainComboBox(items)) - } - - override fun setupUI(builder: Panel) { - val comboBoxes = mutableListOf() - with(builder) { - for ((i, label) in labels.withIndex()) { - row(label) { - val comboBox = createComboBox( - this, - i, - getAvailableVersions( - versionProperties.versionProperties - .take(i).map(ObservableMutableProperty>::get), - ).sortedDescending(), - ).bindItem(versionProperties.versionProperties[i]) - comboBoxes += comboBox.component - } - } - } - this.comboBoxes = comboBoxes.toTypedArray() - } -} - -class VersionChainComboBox(items: List>) : ComboBox>() { - init { - setSelectableItems(items) - } - - fun setSelectableItems(items: List>) { - val currentItem = selectedItem - model = CollectionComboBoxModel(items) - if (selectedItem != currentItem) { - // changing the model doesn't fire item change, which we want to receive - selectedItemChanged() - } - } -} - -private typealias PreferredVersionStateValue = List, String>> - -@Service -@State( - name = "PreferredVersions", - storages = [Storage("mcdev.CreatorPreferredVersions.xml", roamingType = RoamingType.DISABLED)], -) -class PreferredVersionStateComponent : PersistentStateComponent> { - private var state = mutableMapOf() - - fun get(key: String) = state[key] - - fun set(key: String, value: PreferredVersionStateValue) { - state[key] = value - } - - override fun getState() = state - override fun loadState(state: MutableMap) { - this.state = state - } - - companion object { - fun getInstance() = service() - } -} - -private fun List>.sortedDescending(): List> { - fun > sortImpl(list: List>): List> { - @Suppress("UNCHECKED_CAST") - return (list as List).sortedByDescending { it } - } - // pretend we're strings to make the compiler happy - return sortImpl(this) -} Index: src/main/kotlin/creator/step/FixedAssetsNewProjectWizardStep.kt =================================================================== --- src/main/kotlin/creator/step/FixedAssetsNewProjectWizardStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/step/FixedAssetsNewProjectWizardStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,172 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.step - -import com.intellij.codeInsight.actions.ReformatCodeProcessor -import com.intellij.ide.projectView.ProjectView -import com.intellij.ide.projectWizard.generators.AssetsNewProjectWizardStep -import com.intellij.ide.starters.local.GeneratorAsset -import com.intellij.ide.starters.local.GeneratorEmptyDirectory -import com.intellij.ide.starters.local.GeneratorFile -import com.intellij.ide.starters.local.GeneratorResourceFile -import com.intellij.ide.starters.local.GeneratorTemplateFile -import com.intellij.ide.wizard.AbstractNewProjectWizardStep -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.application.WriteAction -import com.intellij.openapi.fileEditor.FileEditorManager -import com.intellij.openapi.project.Project -import com.intellij.openapi.startup.StartupManager -import com.intellij.openapi.util.io.NioFiles -import com.intellij.openapi.vfs.VfsUtil -import com.intellij.openapi.vfs.VirtualFile -import com.intellij.psi.PsiManager -import java.io.IOException -import java.nio.file.Files -import java.nio.file.Path - -/** - * Fixed version of [AssetsNewProjectWizardStep], to be removed in 2022.3 when - * [IDEA-297489 is fixed](https://github.com/JetBrains/intellij-community/commit/fefae70bf621f3181ee9f2d0815c43d0325cd6c4). - * - * Written to be drop-in replaced with [AssetsNewProjectWizardStep] when it's ready. - */ -abstract class FixedAssetsNewProjectWizardStep(parent: NewProjectWizardStep) : AbstractNewProjectWizardStep(parent) { - lateinit var outputDirectory: String - private val assets = arrayListOf() - val templateProperties = hashMapOf() - private val filesToOpen = hashSetOf() - - fun addAssets(vararg assets: GeneratorAsset) = addAssets(assets.toList()) - - fun addAssets(assets: Iterable) { - this.assets += assets - } - - fun addTemplateProperties(vararg properties: Pair) = addTemplateProperties(properties.toMap()) - - fun addTemplateProperties(properties: Map) = templateProperties.putAll(properties) - - fun addFilesToOpen(vararg relativeCanonicalPaths: String) = addFilesToOpen(relativeCanonicalPaths.toList()) - - fun addFilesToOpen(relativeCanonicalPaths: Iterable) { - relativeCanonicalPaths.mapTo(filesToOpen) { "$outputDirectory/$it" } - } - - abstract fun setupAssets(project: Project) - - override fun setupProject(project: Project) { - setupAssets(project) - - WriteAction.runAndWait { - if (project.isDisposed) { - return@runAndWait - } - - val generatedFiles = mutableSetOf() - for (asset in assets) { - generateFile(asset)?.let { generatedFiles += it } - } - - runWhenCreated(project) { - fixupFiles(project, generatedFiles) - } - } - } - - fun runWhenCreated(project: Project, action: () -> Unit) { - if (ApplicationManager.getApplication().isUnitTestMode) { - action() - } else if (!project.isDisposed) { - StartupManager.getInstance(project).runAfterOpened { - WriteAction.runAndWait(action) - } - } - } - - private fun generateFile(asset: GeneratorAsset): VirtualFile? { - return when (asset) { - is GeneratorTemplateFile -> generateFile(asset) - is GeneratorResourceFile -> generateFile(asset) - is GeneratorEmptyDirectory -> generateFile(asset) - is GeneratorFile -> generateFile(asset) - } - } - - private fun generateFile(asset: GeneratorTemplateFile): VirtualFile? { - val code = try { - asset.template.getText(templateProperties) - } catch (e: Exception) { - throw IOException("Unable to process template", e) - } - - val pathStr = "$outputDirectory/${asset.relativePath}" - val path = Path.of(pathStr) - path.parent?.let(NioFiles::createDirectories) - Files.writeString(path, code) - - return VfsUtil.findFile(path, true) - } - - private fun generateFile(asset: GeneratorResourceFile): VirtualFile? { - val content = asset.resource.openStream().use { it.readAllBytes() } - - val pathStr = "$outputDirectory/${asset.relativePath}" - val path = Path.of(pathStr) - path.parent?.let(NioFiles::createDirectories) - Files.write(path, content) - - return VfsUtil.findFile(path, true) - } - - private fun generateFile(asset: GeneratorEmptyDirectory): VirtualFile? { - val pathStr = "$outputDirectory/${asset.relativePath}" - val path = Path.of(pathStr) - NioFiles.createDirectories(path) - return VfsUtil.findFile(path, true) - } - - private fun generateFile(asset: GeneratorFile): VirtualFile? { - val pathStr = "$outputDirectory/${asset.relativePath}" - val path = Path.of(pathStr) - path.parent?.let(NioFiles::createDirectories) - Files.write(path, asset.content) - - return VfsUtil.findFile(path, true) - } - - private fun fixupFiles(project: Project, generatedFiles: Iterable) { - val psiManager = PsiManager.getInstance(project) - val psiFiles = generatedFiles.mapNotNull { psiManager.findFile(it) } - - ReformatCodeProcessor(project, psiFiles.toTypedArray(), null, false).run() - - val fileEditorManager = FileEditorManager.getInstance(project) - val projectView = ProjectView.getInstance(project) - for (file in generatedFiles) { - if (file.path in filesToOpen) { - fileEditorManager.openFile(file, true) - projectView.select(null, file, false) - } - } - } -} - Index: src/main/kotlin/creator/step/LicenseStep.kt =================================================================== --- src/main/kotlin/creator/step/LicenseStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/step/LicenseStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,55 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2026 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.step - -import com.demonwav.mcdev.asset.MCDevBundle -import com.demonwav.mcdev.util.License -import com.intellij.ide.wizard.AbstractNewProjectWizardStep -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.observable.util.bindStorage -import com.intellij.openapi.observable.util.transform -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key -import com.intellij.ui.dsl.builder.Panel -import com.intellij.ui.dsl.builder.bindItem - -class LicenseStep(parent: NewProjectWizardStep) : AbstractNewProjectWizardStep(parent) { - val licenseProperty = propertyGraph.property(License.ALL_RIGHTS_RESERVED.id) - .bindStorage("${javaClass.name}.license") - var license by licenseProperty - - override fun setupUI(builder: Panel) { - with(builder) { - row(MCDevBundle("creator.ui.license.label")) { - comboBox(License.entries) - .bindItem(licenseProperty.transform({ License.byId(it) ?: License.ALL_RIGHTS_RESERVED }) { it.id }) - } - } - } - - override fun setupProject(project: Project) { - data.putUserData(KEY, License.byId(license)) - } - - companion object { - val KEY = Key.create("${LicenseStep::class.java.name}.license") - } -} Index: src/main/kotlin/creator/step/MainClassStep.kt =================================================================== --- src/main/kotlin/creator/step/MainClassStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/step/MainClassStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,83 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2026 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.step - -import com.demonwav.mcdev.asset.MCDevBundle -import com.demonwav.mcdev.creator.buildsystem.BuildSystemPropertiesStep -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.updateWhenChanged -import com.demonwav.mcdev.creator.whenStepAvailable -import com.demonwav.mcdev.util.toJavaClassName -import com.demonwav.mcdev.util.toPackageName -import com.intellij.ide.wizard.AbstractNewProjectWizardStep -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key -import com.intellij.ui.dsl.builder.COLUMNS_LARGE -import com.intellij.ui.dsl.builder.Panel -import com.intellij.ui.dsl.builder.bindText -import com.intellij.ui.dsl.builder.columns - -class MainClassStep(parent: NewProjectWizardStep) : AbstractNewProjectWizardStep(parent) { - private fun suggestMainClassName(): String { - val buildSystemProps = findStep>() - - if (buildSystemProps.artifactId.contains('.')) { - // if the artifact id is invalid, don't confuse ourselves by copying its dots - return className - } - - return buildSystemProps.groupId.toPackageName() + - "." + buildSystemProps.artifactId.toPackageName() + - "." + findStep().name.toJavaClassName() - } - - val classNameProperty = propertyGraph.lazyProperty(::suggestMainClassName) - var className by classNameProperty - - init { - whenStepAvailable> { buildSystemStep -> - classNameProperty.updateWhenChanged(buildSystemStep.groupIdProperty, ::suggestMainClassName) - classNameProperty.updateWhenChanged(buildSystemStep.artifactIdProperty, ::suggestMainClassName) - } - whenStepAvailable { modNameStep -> - classNameProperty.updateWhenChanged(modNameStep.nameProperty, ::suggestMainClassName) - } - } - - override fun setupUI(builder: Panel) { - with(builder) { - row(MCDevBundle("creator.ui.main_class.label")) { - textField() - .columns(COLUMNS_LARGE) - .bindText(classNameProperty) - } - } - } - - override fun setupProject(project: Project) { - data.putUserData(KEY, className) - } - - companion object { - val KEY = Key.create("${MainClassStep::class.java.name}.className") - } -} Index: src/main/kotlin/creator/step/McVersionStep.kt =================================================================== --- src/main/kotlin/creator/step/McVersionStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/step/McVersionStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,104 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.step - -import com.demonwav.mcdev.asset.MCDevBundle -import com.demonwav.mcdev.creator.JdkProjectSetupFinalizer -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.storeToData -import com.demonwav.mcdev.util.MinecraftVersions -import com.demonwav.mcdev.util.SemanticVersion -import com.demonwav.mcdev.util.onShown -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key -import com.intellij.ui.dsl.builder.Panel - -class SimpleMcVersionStep( - parent: NewProjectWizardStep, - versions: List, -) : AbstractSelectVersionStep(parent, versions) { - override val label - get() = MCDevBundle("creator.ui.mc_version.label") - - override fun setupUI(builder: Panel) { - super.setupUI(builder) - versionProperty.afterChange { - applyJdkVersion() - } - versionBox.onShown { - applyJdkVersion() - } - } - - override fun setupProject(project: Project) { - data.putUserData(KEY, SemanticVersion.tryParse(version)) - applyJdkVersion() - } - - private fun applyJdkVersion() { - val version = SemanticVersion.tryParse(version) ?: return - findStep().setPreferredJdk( - MinecraftVersions.requiredJavaVersion(version), - "Minecraft $version", - ) - } - - companion object { - val KEY = Key.create("${SimpleMcVersionStep::class.java.name}.version") - } -} - -abstract class AbstractMcVersionChainStep( - parent: NewProjectWizardStep, - vararg otherLabels: String, -) : AbstractVersionChainStep(parent, *(listOf("Minecraft Version:") + otherLabels).toTypedArray()) { - companion object { - const val MINECRAFT_VERSION = 0 - } - - init { - storeToData() - } - - override fun setupUI(builder: Panel) { - super.setupUI(builder) - getVersionProperty(MINECRAFT_VERSION).afterChange { - applyJdkVersion() - } - getVersionBox(MINECRAFT_VERSION)!!.onShown { - applyJdkVersion() - } - } - - override fun setupProject(project: Project) { - super.setupProject(project) - applyJdkVersion() - } - - private fun applyJdkVersion() { - val version = SemanticVersion.tryParse(getVersion(MINECRAFT_VERSION).toString()) ?: return - findStep().setPreferredJdk( - MinecraftVersions.requiredJavaVersion(version), - "Minecraft ${getVersion(MINECRAFT_VERSION)}", - ) - } -} Index: src/main/kotlin/creator/step/ModIdStep.kt =================================================================== --- src/main/kotlin/creator/step/ModIdStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/step/ModIdStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,104 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.step - -import com.demonwav.mcdev.creator.storeToData -import com.intellij.ide.wizard.AbstractNewProjectWizardStep -import com.intellij.ide.wizard.NewProjectWizardBaseData -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project -import com.intellij.openapi.ui.validation.CHECK_NON_EMPTY -import com.intellij.openapi.ui.validation.WHEN_GRAPH_PROPAGATION_FINISHED -import com.intellij.openapi.ui.validation.and -import com.intellij.openapi.ui.validation.validationErrorIf -import com.intellij.openapi.util.Key -import com.intellij.ui.dsl.builder.COLUMNS_MEDIUM -import com.intellij.ui.dsl.builder.Panel -import com.intellij.ui.dsl.builder.bindText -import com.intellij.ui.dsl.builder.columns -import com.intellij.ui.dsl.builder.textValidation - -private val validModIdRegex = "[a-z][a-z0-9-_]{1,63}".toRegex() -private val invalidModIdRegex = "[^a-z0-9-_]+".toRegex() - -private val validForgeModIdRegex = "[a-z][a-z0-9_]{1,63}".toRegex() -private val invalidForgeModIdRegex = "[^a-z0-9_]+".toRegex() - -abstract class AbstractModIdStep( - parent: NewProjectWizardStep, - private val validRegex: Regex = validModIdRegex, - private val invalidRegex: Regex = invalidModIdRegex -) : AbstractNewProjectWizardStep(parent) { - private val baseData = data.getUserData(NewProjectWizardBaseData.KEY) - ?: throw IllegalStateException("Mod id step created without base step") - val idProperty = propertyGraph.lazyProperty(::suggestId) - var id by idProperty - - private val idValidation = validationErrorIf("Id must match $validRegex") { !it.matches(validRegex) } - - init { - idProperty.dependsOn(baseData.nameProperty, ::suggestId) - storeToData() - } - - fun suggestId(): String { - val sanitized = baseData.name.lowercase().replace(invalidRegex, "_") - if (sanitized.length > 64) { - return sanitized.substring(0, 64) - } - return sanitized - } - - abstract val label: String - - override fun setupUI(builder: Panel) { - with(builder) { - row(label) { - textField() - .bindText(idProperty) - .columns(COLUMNS_MEDIUM) - .validationRequestor(WHEN_GRAPH_PROPAGATION_FINISHED(propertyGraph)) - .textValidation(CHECK_NON_EMPTY and idValidation) - } - } - } - - override fun setupProject(project: Project) { - data.putUserData(KEY, id) - } - - companion object { - val KEY = Key.create("${AbstractModIdStep::class.java.name}.id") - } -} - -class ModIdStep(parent: NewProjectWizardStep) : AbstractModIdStep(parent) { - override val label = "Mod Id:" -} - -class ForgeStyleModIdStep(parent: NewProjectWizardStep) : - AbstractModIdStep(parent, validForgeModIdRegex, invalidForgeModIdRegex) { - override val label = "Mod Id:" -} - -class PluginIdStep(parent: NewProjectWizardStep) : AbstractModIdStep(parent) { - override val label = "Plugin Id:" -} Index: src/main/kotlin/creator/step/ModNameStep.kt =================================================================== --- src/main/kotlin/creator/step/ModNameStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/step/ModNameStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,79 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.step - -import com.demonwav.mcdev.asset.MCDevBundle -import com.demonwav.mcdev.creator.storeToData -import com.intellij.ide.wizard.AbstractNewProjectWizardStep -import com.intellij.ide.wizard.NewProjectWizardBaseData -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project -import com.intellij.openapi.ui.validation.CHECK_NON_EMPTY -import com.intellij.openapi.ui.validation.WHEN_GRAPH_PROPAGATION_FINISHED -import com.intellij.openapi.util.Key -import com.intellij.ui.dsl.builder.COLUMNS_MEDIUM -import com.intellij.ui.dsl.builder.Panel -import com.intellij.ui.dsl.builder.bindText -import com.intellij.ui.dsl.builder.columns -import com.intellij.ui.dsl.builder.textValidation - -abstract class AbstractModNameStep(parent: NewProjectWizardStep) : AbstractNewProjectWizardStep(parent) { - private val baseData = data.getUserData(NewProjectWizardBaseData.KEY) - ?: throw IllegalStateException("Mod name step created without base step") - val nameProperty = propertyGraph.property(baseData.name) - var name by nameProperty - init { - baseData.nameProperty.afterChange { name = it } - storeToData() - } - - abstract val label: String - - override fun setupUI(builder: Panel) { - with(builder) { - row(label) { - textField() - .bindText(nameProperty) - .columns(COLUMNS_MEDIUM) - .validationRequestor(WHEN_GRAPH_PROPAGATION_FINISHED(propertyGraph)) - .textValidation(CHECK_NON_EMPTY) - } - } - } - - override fun setupProject(project: Project) { - data.putUserData(KEY, name) - } - - companion object { - val KEY = Key.create("${AbstractModNameStep::class.java.name}.name") - } -} - -class ModNameStep(parent: NewProjectWizardStep) : AbstractModNameStep(parent) { - override val label - get() = MCDevBundle("creator.ui.mod_name.label") -} - -class PluginNameStep(parent: NewProjectWizardStep) : AbstractModNameStep(parent) { - override val label - get() = MCDevBundle("creator.ui.plugin_name.label") -} Index: src/main/kotlin/creator/step/OptionalSteps.kt =================================================================== --- src/main/kotlin/creator/step/OptionalSteps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/step/OptionalSteps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,220 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.step - -import com.demonwav.mcdev.asset.MCDevBundle -import com.demonwav.mcdev.creator.updateWhenChanged -import com.intellij.ide.wizard.AbstractNewProjectWizardStep -import com.intellij.ide.wizard.NewProjectWizardBaseData.Companion.baseData -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.observable.util.bindStorage -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key -import com.intellij.ui.dsl.builder.COLUMNS_LARGE -import com.intellij.ui.dsl.builder.Panel -import com.intellij.ui.dsl.builder.bindText -import com.intellij.ui.dsl.builder.columns -import com.intellij.util.SystemProperties - -abstract class AbstractOptionalStringStep(parent: NewProjectWizardStep) : AbstractNewProjectWizardStep(parent) { - protected abstract val label: String - protected open val bindToStorage = false - - val valueProperty = propertyGraph.property("").apply { - if (bindToStorage) { - bindStorage("${this@AbstractOptionalStringStep.javaClass.name}.value") - } - } - var value by valueProperty - - override fun setupUI(builder: Panel) { - with(builder) { - row(label) { - textField() - .bindText(valueProperty) - .columns(COLUMNS_LARGE) - } - } - } -} - -abstract class AbstractOptionalStringBasedOnProjectNameStep( - parent: NewProjectWizardStep, -) : AbstractOptionalStringStep(parent) { - private val formatProperty = propertyGraph.property("").bindStorage("${javaClass.name}.format") - var format by formatProperty - - init { - if (format.isNotEmpty()) { - value = suggestValue() - } - valueProperty.updateWhenChanged(formatProperty, ::suggestValue) - valueProperty.updateWhenChanged(baseData!!.nameProperty, ::suggestValue) - formatProperty.updateWhenChanged(valueProperty, ::suggestFormat) - } - - private fun suggestValue() = format.replace(PROJECT_NAME_PLACEHOLDER, baseData!!.name) - - private fun suggestFormat(): String { - val index = value.indexOf(baseData!!.name) - if (index == -1) { - return value - } - if (value.indexOf(baseData!!.name, startIndex = index + baseData!!.name.length) != -1) { - // don't change format if there are multiple instances of the project name - return format - } - return value.replace(baseData!!.name, PROJECT_NAME_PLACEHOLDER) - } - - companion object { - const val PROJECT_NAME_PLACEHOLDER = "{PROJECT_NAME}" - } -} - -class DescriptionStep(parent: NewProjectWizardStep) : AbstractOptionalStringStep(parent) { - override val label - get() = MCDevBundle("creator.ui.description.label") - - override fun setupProject(project: Project) { - data.putUserData(KEY, value) - } - - companion object { - val KEY = Key.create("${DescriptionStep::class.java.name}.description") - } -} - -class AuthorsStep(parent: NewProjectWizardStep) : AbstractOptionalStringStep(parent) { - override val label - get() = MCDevBundle("creator.ui.authors.label") - override val bindToStorage = true - - override fun setupProject(project: Project) { - data.putUserData(KEY, parseAuthors(value)) - } - - companion object { - val KEY = Key.create>("${AuthorsStep::class.java.name}.authors") - - private val bracketRegex = Regex("[\\[\\]]") - private val commaRegex = Regex("\\s*,\\s*") - - fun parseAuthors(string: String): List { - return if (string.isNotBlank()) { - string.trim().replace(bracketRegex, "").split(commaRegex).toList() - } else { - emptyList() - } - } - } -} - -class WebsiteStep(parent: NewProjectWizardStep) : AbstractOptionalStringStep(parent) { - override val label - get() = MCDevBundle("creator.ui.website.label") - override val bindToStorage = true - - override fun setupProject(project: Project) { - data.putUserData(KEY, value) - } - - companion object { - val KEY = Key.create("${WebsiteStep::class.java.name}.website") - } -} - -class RepositoryStep(parent: NewProjectWizardStep) : AbstractOptionalStringBasedOnProjectNameStep(parent) { - override val label - get() = MCDevBundle("creator.ui.repository.label") - - init { - if (format.isEmpty()) { - format = "https://github.com/${SystemProperties.getUserName()}/$PROJECT_NAME_PLACEHOLDER" - } - } - - override fun setupProject(project: Project) { - data.putUserData(KEY, value) - } - - companion object { - val KEY = Key.create("${RepositoryStep::class.java.name}.repository") - } -} - -class IssueTrackerStep(parent: NewProjectWizardStep) : AbstractOptionalStringBasedOnProjectNameStep(parent) { - override val label: String - get() = MCDevBundle("creator.ui.issue_tracker.label") - - init { - if (format.isEmpty()) { - format = "https://github.com/${SystemProperties.getUserName()}/$PROJECT_NAME_PLACEHOLDER/issues" - } - } - - override fun setupProject(project: Project) { - data.putUserData(KEY, value) - } - - companion object { - val KEY = Key.create("${IssueTrackerStep::class.java.name}.issueTracker") - } -} - -class UpdateUrlStep(parent: NewProjectWizardStep) : AbstractOptionalStringStep(parent) { - override val label - get() = MCDevBundle("creator.ui.update_url.label") - - override fun setupProject(project: Project) { - data.putUserData(KEY, value) - } - - companion object { - val KEY = Key.create("${UpdateUrlStep::class.java.name}.updateUrl") - } -} - -class DependStep(parent: NewProjectWizardStep) : AbstractOptionalStringStep(parent) { - override val label - get() = MCDevBundle("creator.ui.depend.label") - - override fun setupProject(project: Project) { - data.putUserData(KEY, AuthorsStep.parseAuthors(value)) - } - - companion object { - val KEY = Key.create>("${DependStep::class.java.name}.depend") - } -} - -class SoftDependStep(parent: NewProjectWizardStep) : AbstractOptionalStringStep(parent) { - override val label - get() = MCDevBundle("creator.ui.soft_depend.label") - - override fun setupProject(project: Project) { - data.putUserData(KEY, AuthorsStep.parseAuthors(value)) - } - - companion object { - val KEY = Key.create>("${SoftDependStep::class.java.name}.depend") - } -} Index: src/main/kotlin/creator/step/UseMixinsStep.kt =================================================================== --- src/main/kotlin/creator/step/UseMixinsStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/step/UseMixinsStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,53 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.step - -import com.demonwav.mcdev.asset.MCDevBundle -import com.intellij.ide.wizard.AbstractNewProjectWizardStep -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.observable.util.bindBooleanStorage -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key -import com.intellij.ui.dsl.builder.Panel -import com.intellij.ui.dsl.builder.bindSelected - -class UseMixinsStep(parent: NewProjectWizardStep) : AbstractNewProjectWizardStep(parent) { - val useMixinsProperty = propertyGraph.property(false) - .bindBooleanStorage("${javaClass.name}.useMixins") - var useMixins by useMixinsProperty - - override fun setupUI(builder: Panel) { - with(builder) { - row(MCDevBundle("creator.ui.use_mixins.label")) { - checkBox("") - .bindSelected(useMixinsProperty) - } - } - } - - override fun setupProject(project: Project) { - data.putUserData(KEY, useMixins) - } - - companion object { - val KEY = Key.create("${UseMixinsStep::class.java.name}.useMixins") - } -} Index: src/main/kotlin/creator/step/WaitForSmartModeStep.kt =================================================================== --- src/main/kotlin/creator/step/WaitForSmartModeStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/creator/step/WaitForSmartModeStep.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,40 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.creator.step - -import com.demonwav.mcdev.asset.MCDevBundle -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.DumbService -import com.intellij.openapi.project.Project - -/** - * This step shows to the user that we're waiting for smart mode as opposed to taking a while doing something else. - * Note that dumb mode may occur immediately after this step, and subsequent steps must not assume smart mode is active. - * Thus, this step is for UX purposes only. - */ -class WaitForSmartModeStep(parent: NewProjectWizardStep) : AbstractLongRunningStep(parent) { - override val description - get() = MCDevBundle("creator.step.wait_for_smart.description") - - override fun perform(project: Project) { - DumbService.getInstance(project).waitForSmartMode() - } -} Index: src/main/kotlin/platform/architectury/creator/asset-steps.kt =================================================================== --- src/main/kotlin/platform/architectury/creator/asset-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/architectury/creator/asset-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,261 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.architectury.creator - -import com.demonwav.mcdev.creator.JdkProjectSetupFinalizer -import com.demonwav.mcdev.creator.addLicense -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.buildsystem.AbstractBuildSystemStep -import com.demonwav.mcdev.creator.buildsystem.AbstractRunBuildSystemStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemPropertiesStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemSupport -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.step.AbstractLongRunningAssetsStep -import com.demonwav.mcdev.creator.step.AbstractModIdStep -import com.demonwav.mcdev.creator.step.AbstractModNameStep -import com.demonwav.mcdev.creator.step.AbstractReformatFilesStep -import com.demonwav.mcdev.creator.step.AuthorsStep -import com.demonwav.mcdev.creator.step.DescriptionStep -import com.demonwav.mcdev.creator.step.IssueTrackerStep -import com.demonwav.mcdev.creator.step.LicenseStep -import com.demonwav.mcdev.creator.step.UseMixinsStep -import com.demonwav.mcdev.creator.step.WebsiteStep -import com.demonwav.mcdev.platform.architectury.ArchitecturyVersion -import com.demonwav.mcdev.platform.fabric.util.FabricApiVersions -import com.demonwav.mcdev.platform.fabric.util.FabricVersions -import com.demonwav.mcdev.platform.forge.util.ForgeConstants -import com.demonwav.mcdev.platform.forge.util.ForgePackAdditionalData -import com.demonwav.mcdev.platform.forge.util.ForgePackDescriptor -import com.demonwav.mcdev.platform.forge.version.ForgeVersion -import com.demonwav.mcdev.util.MinecraftTemplates -import com.demonwav.mcdev.util.SemanticVersion -import com.demonwav.mcdev.util.toJavaClassName -import com.demonwav.mcdev.util.toPackageName -import com.intellij.ide.starters.local.GeneratorEmptyDirectory -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project - -class ArchitecturyVersionData( - val forgeVersions: ForgeVersion, - val fabricVersions: FabricVersions, - val fabricApiVersions: FabricApiVersions, - val architecturyVersions: ArchitecturyVersion, -) - -private val NewProjectWizardStep.architecturyPackage: String get() { - val apiVersion = data.getUserData(ArchitecturyVersionChainStep.ARCHITECTURY_API_VERSION_KEY) - return when { - apiVersion == null || apiVersion >= SemanticVersion.release(2, 0, 10) -> "dev.architectury" - else -> "me.shedaniel.architectury" - } -} - -class ArchitecturyProjectFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Adding Architectury project files (phase 1)" - - override fun setupAssets(project: Project) { - val buildSystemProps = findStep>() - val useMixins = data.getUserData(UseMixinsStep.KEY) ?: false - val javaVersion = findStep().preferredJdk.ordinal - val modId = data.getUserData(AbstractModIdStep.KEY) ?: return - val packageName = "${buildSystemProps.groupId.toPackageName()}.${modId.toPackageName()}" - val mcVersion = data.getUserData(ArchitecturyVersionChainStep.MC_VERSION_KEY) ?: return - val modName = data.getUserData(AbstractModNameStep.KEY) ?: return - val forgeVersion = data.getUserData(ArchitecturyVersionChainStep.FORGE_VERSION_KEY) ?: return - val fabricLoaderVersion = data.getUserData(ArchitecturyVersionChainStep.FABRIC_LOADER_VERSION_KEY) ?: return - val fabricApiVersion = data.getUserData(ArchitecturyVersionChainStep.FABRIC_API_VERSION_KEY) - val archApiVersion = data.getUserData(ArchitecturyVersionChainStep.ARCHITECTURY_API_VERSION_KEY) - val license = data.getUserData(LicenseStep.KEY) ?: return - val authors = data.getUserData(AuthorsStep.KEY) ?: emptyList() - val website = data.getUserData(WebsiteStep.KEY) ?: "" - val issueTracker = data.getUserData(IssueTrackerStep.KEY) ?: "" - val description = data.getUserData(DescriptionStep.KEY) ?: "" - - val hasDisplayTestInManifest = forgeVersion >= ForgeConstants.DISPLAY_TEST_MANIFEST_VERSION - val nextMcVersion = when (val part = mcVersion.parts.getOrNull(1)) { - // Mimics the code used to get the next Minecraft version in Forge's MDK - // https://github.com/MinecraftForge/MinecraftForge/blob/0ff8a596fc1ef33d4070be89dd5cb4851f93f731/build.gradle#L884 - is SemanticVersion.Companion.VersionPart.ReleasePart -> (part.version + 1).toString() - null -> "?" - else -> part.versionString - } - - assets.addAssets( - GeneratorEmptyDirectory("common/src/main/java"), - GeneratorEmptyDirectory("common/src/main/resources"), - GeneratorEmptyDirectory("forge/src/main/java"), - GeneratorEmptyDirectory("forge/src/main/resources"), - GeneratorEmptyDirectory("fabric/src/main/java"), - GeneratorEmptyDirectory("fabric/src/main/resources"), - ) - - val packDescriptor = ForgePackDescriptor.forMcVersion(mcVersion) ?: ForgePackDescriptor.FORMAT_3 - val packAdditionalData = ForgePackAdditionalData.forMcVersion(mcVersion) - - assets.addTemplateProperties( - "ARTIFACT_ID" to buildSystemProps.artifactId, - "PACK_FORMAT" to packDescriptor.format, - "PACK_COMMENT" to packDescriptor.comment, - "PACKAGE_NAME" to packageName, - "JAVA_VERSION" to javaVersion, - "MOD_ID" to modId, - "MOD_NAME" to modName, - "FABRIC_CLASS_NAME_FQN" to packageName + ".fabric." + modName.toJavaClassName() + "Fabric", - "DISPLAY_TEST" to hasDisplayTestInManifest, - "FORGE_SPEC_VERSION" to forgeVersion.parts[0].versionString, - "MC_VERSION" to mcVersion, - "MC_NEXT_VERSION" to "1.$nextMcVersion", - "LICENSE" to license, - "DESCRIPTION" to description, - "MOD_DESCRIPTION" to description, - "MOD_ENVIRONMENT" to "*", - "FABRIC_LOADER_VERSION" to fabricLoaderVersion, - ) - - if (fabricApiVersion != null) { - assets.addTemplateProperties( - "FABRIC_API_VERSION" to fabricApiVersion, - ) - } - - if (archApiVersion != null) { - assets.addTemplateProperties( - "ARCHITECTURY_API_VERSION" to archApiVersion, - ) - } - - if (authors.isNotEmpty()) { - assets.addTemplateProperties("AUTHOR_LIST" to authors.joinToString(", ")) - } - - if (website.isNotBlank()) { - assets.addTemplateProperties("WEBSITE" to website) - } - - if (issueTracker.isNotBlank()) { - assets.addTemplateProperties("ISSUE" to issueTracker) - } - - if (packAdditionalData != null) { - assets.addTemplateProperties( - "FORGE_DATA" to packAdditionalData, - ) - } - - if (useMixins) { - assets.addTemplateProperties( - "MIXINS" to "true", - ) - val commonMixinsFile = "common/src/main/resources/$modId-common.mixins.json" - val forgeMixinsFile = "forge/src/main/resources/$modId.mixins.json" - val fabricMixinsFile = "fabric/src/main/resources/$modId.mixins.json" - assets.addTemplates( - project, - commonMixinsFile to MinecraftTemplates.ARCHITECTURY_COMMON_MIXINS_JSON_TEMPLATE, - forgeMixinsFile to MinecraftTemplates.ARCHITECTURY_FORGE_MIXINS_JSON_TEMPLATE, - fabricMixinsFile to MinecraftTemplates.ARCHITECTURY_FABRIC_MIXINS_JSON_TEMPLATE, - ) - } - - assets.addTemplates( - project, - "forge/src/main/resources/pack.mcmeta" to MinecraftTemplates.ARCHITECTURY_FORGE_PACK_MCMETA_TEMPLATE, - "forge/src/main/resources/META-INF/mods.toml" to MinecraftTemplates.ARCHITECTURY_FORGE_MODS_TOML_TEMPLATE, - "fabric/src/main/resources/fabric.mod.json" to MinecraftTemplates.ARCHITECTURY_FABRIC_MOD_JSON_TEMPLATE, - ) - - assets.addLicense(project) - } -} - -abstract class ArchitecturyMainClassStep( - parent: NewProjectWizardStep, - phase: Int, -) : AbstractLongRunningAssetsStep(parent) { - abstract val projectDir: String - abstract val template: String - abstract fun getClassName(packageName: String, className: String): String - - override val description = "Adding Architectury project files (phase $phase)" - - override fun setupAssets(project: Project) { - val buildSystemProps = findStep>() - val modId = data.getUserData(AbstractModIdStep.KEY) ?: return - val modName = data.getUserData(AbstractModNameStep.KEY) ?: return - val useArchApi = data.getUserData(ArchitecturyVersionChainStep.ARCHITECTURY_API_VERSION_KEY) != null - - val packageName = "${buildSystemProps.groupId.toPackageName()}.${buildSystemProps.artifactId.toPackageName()}" - val className = modName.toJavaClassName() - assets.addTemplateProperties( - "PACKAGE_NAME" to packageName, - "CLASS_NAME" to className, - "ARTIFACT_ID" to buildSystemProps.artifactId, - "MOD_ID" to modId, - "MOD_NAME" to modName, - "MOD_VERSION" to buildSystemProps.version, - "ARCHITECTURY_PACKAGE" to architecturyPackage, - ) - if (useArchApi) { - assets.addTemplateProperties("ARCHITECTURY_API" to "true") - } - - val mainClass = getClassName(packageName, className) - assets.addTemplates(project, "$projectDir/src/main/java/${mainClass.replace('.', '/')}.java" to template) - } -} - -class ArchitecturyCommonMainClassStep(parent: NewProjectWizardStep) : ArchitecturyMainClassStep(parent, 2) { - override val projectDir = "common" - override val template = MinecraftTemplates.ARCHITECTURY_COMMON_MAIN_CLASS_TEMPLATE - - override fun getClassName(packageName: String, className: String) = "$packageName.$className" -} - -class ArchitecturyForgeMainClassStep(parent: NewProjectWizardStep) : ArchitecturyMainClassStep(parent, 3) { - override val projectDir = "forge" - override val template = MinecraftTemplates.ARCHITECTURY_FORGE_MAIN_CLASS_TEMPLATE - - override fun getClassName(packageName: String, className: String) = "$packageName.forge.${className}Forge" -} - -class ArchitecturyFabricMainClassStep(parent: NewProjectWizardStep) : ArchitecturyMainClassStep(parent, 4) { - override val projectDir = "fabric" - override val template = MinecraftTemplates.ARCHITECTURY_FABRIC_MAIN_CLASS_TEMPLATE - - override fun getClassName(packageName: String, className: String) = "$packageName.fabric.${className}Fabric" -} - -class ArchitecturyReformatPackDescriptorStep(parent: NewProjectWizardStep) : AbstractReformatFilesStep(parent) { - - override fun addFilesToReformat() { - addFileToReformat("forge/src/main/resources/pack.mcmeta") - } -} - -class ArchitecturyBuildSystemStep(parent: NewProjectWizardStep) : AbstractBuildSystemStep(parent) { - override val platformName = "Architectury" -} - -class ArchitecturyPostBuildSystemStep( - parent: NewProjectWizardStep, -) : AbstractRunBuildSystemStep(parent, ArchitecturyBuildSystemStep::class.java) { - override val step = BuildSystemSupport.POST_STEP -} Index: src/main/kotlin/platform/architectury/creator/gradle-steps.kt =================================================================== --- src/main/kotlin/platform/architectury/creator/gradle-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/architectury/creator/gradle-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,127 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.architectury.creator - -import com.demonwav.mcdev.creator.EmptyStep -import com.demonwav.mcdev.creator.JdkProjectSetupFinalizer -import com.demonwav.mcdev.creator.addGradleGitignore -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.buildsystem.BuildSystemPropertiesStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemSupport -import com.demonwav.mcdev.creator.buildsystem.GRADLE_VERSION_KEY -import com.demonwav.mcdev.creator.buildsystem.GradleImportStep -import com.demonwav.mcdev.creator.buildsystem.GradleWrapperStep -import com.demonwav.mcdev.creator.buildsystem.addGradleWrapperProperties -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.gitEnabled -import com.demonwav.mcdev.creator.step.AbstractLongRunningAssetsStep -import com.demonwav.mcdev.creator.step.AbstractModIdStep -import com.demonwav.mcdev.creator.step.AbstractModNameStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.creator.step.UseMixinsStep -import com.demonwav.mcdev.util.MinecraftTemplates -import com.demonwav.mcdev.util.SemanticVersion -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project - -private val NewProjectWizardStep.architecturyGroup: String get() { - val apiVersion = data.getUserData(ArchitecturyVersionChainStep.ARCHITECTURY_API_VERSION_KEY) - return when { - apiVersion == null || apiVersion >= SemanticVersion.release(2, 0, 10) -> "dev.architectury" - else -> "me.shedaniel" - } -} - -class ArchitecturyGradleSupport : BuildSystemSupport { - override val preferred = true - - override fun createStep(step: String, parent: NewProjectWizardStep): NewProjectWizardStep { - return when (step) { - BuildSystemSupport.PRE_STEP -> ArchitecturyGradleFilesStep(parent).nextStep(::GradleWrapperStep) - BuildSystemSupport.POST_STEP -> GradleImportStep(parent) - else -> EmptyStep(parent) - } - } -} - -class ArchitecturyGradleFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating Gradle files" - - override fun setupAssets(project: Project) { - data.putUserData(GRADLE_VERSION_KEY, SemanticVersion.release(8, 4)) - - val buildSystemProps = findStep>() - val modId = data.getUserData(AbstractModIdStep.KEY) ?: return - val modName = data.getUserData(AbstractModNameStep.KEY) ?: return - val mcVersion = data.getUserData(ArchitecturyVersionChainStep.MC_VERSION_KEY) ?: return - val forgeVersion = data.getUserData(ArchitecturyVersionChainStep.FORGE_VERSION_KEY) ?: return - val fabricLoaderVersion = data.getUserData(ArchitecturyVersionChainStep.FABRIC_LOADER_VERSION_KEY) ?: return - val fabricApiVersion = data.getUserData(ArchitecturyVersionChainStep.FABRIC_API_VERSION_KEY) - val archApiVersion = data.getUserData(ArchitecturyVersionChainStep.ARCHITECTURY_API_VERSION_KEY) - val javaVersion = findStep().preferredJdk.ordinal - val useMixins = data.getUserData(UseMixinsStep.KEY) ?: false - - assets.addTemplateProperties( - "GROUP_ID" to buildSystemProps.groupId, - "ARTIFACT_ID" to buildSystemProps.artifactId, - "MOD_ID" to modId, - "MOD_NAME" to modName, - "VERSION" to buildSystemProps.version, - "MC_VERSION" to mcVersion, - "FORGE_VERSION" to "$mcVersion-$forgeVersion", - "FABRIC_LOADER_VERSION" to fabricLoaderVersion, - "ARCHITECTURY_GROUP" to architecturyGroup, - "JAVA_VERSION" to javaVersion, - "MIXINS" to useMixins, - ) - - if (fabricApiVersion != null) { - assets.addTemplateProperties( - "FABRIC_API_VERSION" to fabricApiVersion, - "FABRIC_API" to "true", - ) - } - - if (archApiVersion != null) { - assets.addTemplateProperties( - "ARCHITECTURY_API_VERSION" to archApiVersion, - "ARCHITECTURY_API" to "true", - ) - } - - assets.addTemplates( - project, - "build.gradle" to MinecraftTemplates.ARCHITECTURY_BUILD_GRADLE_TEMPLATE, - "gradle.properties" to MinecraftTemplates.ARCHITECTURY_GRADLE_PROPERTIES_TEMPLATE, - "settings.gradle" to MinecraftTemplates.ARCHITECTURY_SETTINGS_GRADLE_TEMPLATE, - "common/build.gradle" to MinecraftTemplates.ARCHITECTURY_COMMON_BUILD_GRADLE_TEMPLATE, - "forge/build.gradle" to MinecraftTemplates.ARCHITECTURY_FORGE_BUILD_GRADLE_TEMPLATE, - "forge/gradle.properties" to MinecraftTemplates.ARCHITECTURY_FORGE_GRADLE_PROPERTIES_TEMPLATE, - "fabric/build.gradle" to MinecraftTemplates.ARCHITECTURY_FABRIC_BUILD_GRADLE_TEMPLATE, - ) - - assets.addGradleWrapperProperties(project) - - if (gitEnabled) { - assets.addGradleGitignore(project) - } - } -} Index: src/main/kotlin/platform/architectury/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/architectury/creator/ui-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/architectury/creator/ui-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,212 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.architectury.creator - -import com.demonwav.mcdev.creator.platformtype.ModPlatformStep -import com.demonwav.mcdev.creator.step.AbstractCollapsibleStep -import com.demonwav.mcdev.creator.step.AbstractLatentStep -import com.demonwav.mcdev.creator.step.AbstractMcVersionChainStep -import com.demonwav.mcdev.creator.step.AuthorsStep -import com.demonwav.mcdev.creator.step.DescriptionStep -import com.demonwav.mcdev.creator.step.ForgeStyleModIdStep -import com.demonwav.mcdev.creator.step.IssueTrackerStep -import com.demonwav.mcdev.creator.step.LicenseStep -import com.demonwav.mcdev.creator.step.ModNameStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.creator.step.RepositoryStep -import com.demonwav.mcdev.creator.step.UseMixinsStep -import com.demonwav.mcdev.creator.step.VersionChainComboBox -import com.demonwav.mcdev.creator.step.WebsiteStep -import com.demonwav.mcdev.platform.architectury.ArchitecturyVersion -import com.demonwav.mcdev.platform.fabric.util.FabricApiVersions -import com.demonwav.mcdev.platform.fabric.util.FabricVersions -import com.demonwav.mcdev.platform.forge.version.ForgeVersion -import com.demonwav.mcdev.util.SemanticVersion -import com.demonwav.mcdev.util.asyncIO -import com.demonwav.mcdev.util.bindEnabled -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.observable.util.bindBooleanStorage -import com.intellij.openapi.observable.util.transform -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key -import com.intellij.ui.JBColor -import com.intellij.ui.dsl.builder.Cell -import com.intellij.ui.dsl.builder.Row -import com.intellij.ui.dsl.builder.bindSelected -import com.intellij.ui.dsl.builder.bindText -import com.intellij.util.IncorrectOperationException -import kotlinx.coroutines.coroutineScope - -class ArchitecturyPlatformStep(parent: ModPlatformStep) : AbstractLatentStep(parent) { - override val description = "download Forge, Fabric and Architectury versions" - - override suspend fun computeData() = coroutineScope { - val forgeJob = asyncIO { ForgeVersion.downloadData() } - val fabricJob = asyncIO { FabricVersions.downloadData() } - val fabricApiJob = asyncIO { FabricApiVersions.downloadData() } - val archJob = asyncIO { ArchitecturyVersion.downloadData() } - - val forge = forgeJob.await() ?: return@coroutineScope null - val fabric = fabricJob.await() ?: return@coroutineScope null - val fabricApi = fabricApiJob.await() ?: return@coroutineScope null - val arch = archJob.await() ?: return@coroutineScope null - - ArchitecturyVersionData(forge, fabric, fabricApi, arch) - } - - override fun createStep(data: ArchitecturyVersionData): NewProjectWizardStep { - return ArchitecturyVersionChainStep(this, data) - .nextStep(::UseMixinsStep) - .nextStep(::ForgeStyleModIdStep) - .nextStep(::ModNameStep) - .nextStep(::LicenseStep) - .nextStep(::ArchitecturyOptionalSettingsStep) - .nextStep(::ArchitecturyBuildSystemStep) - .nextStep(::ArchitecturyProjectFilesStep) - .nextStep(::ArchitecturyCommonMainClassStep) - .nextStep(::ArchitecturyForgeMainClassStep) - .nextStep(::ArchitecturyFabricMainClassStep) - .nextStep(::ArchitecturyPostBuildSystemStep) - .nextStep(::ArchitecturyReformatPackDescriptorStep) - } - - class Factory : ModPlatformStep.Factory { - override val name = "Architectury" - override fun createStep(parent: ModPlatformStep) = ArchitecturyPlatformStep(parent) - } -} - -class ArchitecturyVersionChainStep( - parent: NewProjectWizardStep, - private val versionData: ArchitecturyVersionData, -) : AbstractMcVersionChainStep( - parent, - "Forge Version:", - "Fabric Loader Version:", - "Fabric API Version:", - "Architectury API Version:", -) { - companion object { - private const val FORGE_VERSION = 1 - private const val FABRIC_LOADER_VERSION = 2 - private const val FABRIC_API_VERSION = 3 - private const val ARCHITECTURY_API_VERSION = 4 - - val MC_VERSION_KEY = - Key.create("${ArchitecturyVersionChainStep::class.java.name}.mcVersion") - val FORGE_VERSION_KEY = - Key.create("${ArchitecturyVersionChainStep::class.java.name}.forgeVersion") - val FABRIC_LOADER_VERSION_KEY = - Key.create("${ArchitecturyVersionChainStep::class.java.name}.fabricLoaderVersion") - val FABRIC_API_VERSION_KEY = - Key.create("${ArchitecturyVersionChainStep::class.java.name}.fabricApiVersion") - val ARCHITECTURY_API_VERSION_KEY = - Key.create("${ArchitecturyVersionChainStep::class.java.name}.architecturyApiVersion") - } - - private val mcVersions by lazy { - versionData.architecturyVersions.versions.keys - .intersect(versionData.forgeVersions.sortedMcVersions.toSet()) - .intersect( - versionData.fabricVersions.game.mapNotNullTo(mutableSetOf()) { - SemanticVersion.tryParse(it.version) - }, - ) - .toList() - } - - private val useFabricApiProperty = propertyGraph.property(true) - .bindBooleanStorage("${javaClass.name}.useFabricApi") - private var useFabricApi by useFabricApiProperty - - private val useArchApiProperty = propertyGraph.property(true) - .bindBooleanStorage("${javaClass.name}.useArchApi") - private var useArchApi by useArchApiProperty - - override fun createComboBox(row: Row, index: Int, items: List>): Cell { - return when (index) { - FABRIC_API_VERSION -> { - val comboBox = super.createComboBox(row, index, items).bindEnabled(useFabricApiProperty) - row.checkBox("Use Fabric API").bindSelected(useFabricApiProperty) - row.label("").bindText( - getVersionProperty(MINECRAFT_VERSION).transform { mcVersion -> - val versionStr = mcVersion.toString() - val matched = versionData.fabricApiVersions.versions.any { versionStr in it.gameVersions } - if (matched) { - "" - } else { - "Unable to match API versions to Minecraft version" - } - }, - ).bindEnabled(useFabricApiProperty).component.foreground = JBColor.YELLOW - comboBox - } - ARCHITECTURY_API_VERSION -> { - val comboBox = super.createComboBox(row, index, items).bindEnabled(useArchApiProperty) - row.checkBox("Use Architectury API").bindSelected(useArchApiProperty) - comboBox - } - else -> super.createComboBox(row, index, items) - } - } - - override fun getAvailableVersions(versionsAbove: List>): List> { - val mcVersion by lazy { versionsAbove[MINECRAFT_VERSION] as SemanticVersion } - - return when (versionsAbove.size) { - MINECRAFT_VERSION -> mcVersions - FORGE_VERSION -> versionData.forgeVersions.getForgeVersions(mcVersion) - FABRIC_LOADER_VERSION -> versionData.fabricVersions.loader - FABRIC_API_VERSION -> { - val versionStr = mcVersion.toString() - val apiVersions = versionData.fabricApiVersions.versions - .filter { versionStr in it.gameVersions } - .map { it.version } - apiVersions.ifEmpty { versionData.fabricApiVersions.versions.map { it.version } } - } - ARCHITECTURY_API_VERSION -> versionData.architecturyVersions.getArchitecturyVersions(mcVersion) - else -> throw IncorrectOperationException() - } - } - - override fun setupProject(project: Project) { - super.setupProject(project) - data.putUserData(MC_VERSION_KEY, getVersion(MINECRAFT_VERSION) as SemanticVersion) - data.putUserData(FORGE_VERSION_KEY, getVersion(FORGE_VERSION) as SemanticVersion) - data.putUserData(FABRIC_LOADER_VERSION_KEY, getVersion(FABRIC_LOADER_VERSION) as SemanticVersion) - if (useFabricApi) { - data.putUserData(FABRIC_API_VERSION_KEY, getVersion(FABRIC_API_VERSION) as SemanticVersion) - } - if (useArchApi) { - data.putUserData(ARCHITECTURY_API_VERSION_KEY, getVersion(ARCHITECTURY_API_VERSION) as SemanticVersion) - } - } -} - -class ArchitecturyOptionalSettingsStep(parent: NewProjectWizardStep) : AbstractCollapsibleStep(parent) { - override val title = "Optional Settings" - - override fun createStep() = DescriptionStep(this) - .nextStep(::AuthorsStep) - .nextStep(::WebsiteStep) - .nextStep(::RepositoryStep) - .nextStep(::IssueTrackerStep) -} Index: src/main/kotlin/platform/bukkit/creator/LoadOrder.kt =================================================================== --- src/main/kotlin/platform/bukkit/creator/LoadOrder.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/bukkit/creator/LoadOrder.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,29 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.bukkit.creator - -enum class LoadOrder(private val myName: String) { - STARTUP("Startup"), - POSTWORLD("Post World"), - ; - - override fun toString() = myName -} Index: src/main/kotlin/platform/bukkit/creator/asset-steps.kt =================================================================== --- src/main/kotlin/platform/bukkit/creator/asset-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/bukkit/creator/asset-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,128 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2026 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.bukkit.creator - -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.buildsystem.AbstractBuildSystemStep -import com.demonwav.mcdev.creator.buildsystem.AbstractRunBuildSystemStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemSupport -import com.demonwav.mcdev.creator.splitPackage -import com.demonwav.mcdev.creator.step.AbstractLongRunningAssetsStep -import com.demonwav.mcdev.creator.step.AbstractModNameStep -import com.demonwav.mcdev.creator.step.AuthorsStep -import com.demonwav.mcdev.creator.step.DependStep -import com.demonwav.mcdev.creator.step.DescriptionStep -import com.demonwav.mcdev.creator.step.MainClassStep -import com.demonwav.mcdev.creator.step.SimpleMcVersionStep -import com.demonwav.mcdev.creator.step.SoftDependStep -import com.demonwav.mcdev.creator.step.WebsiteStep -import com.demonwav.mcdev.platform.bukkit.BukkitModuleType -import com.demonwav.mcdev.util.MinecraftTemplates -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key - -class BukkitProjectFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating project files" - - override fun setupAssets(project: Project) { - val pluginName = data.getUserData(AbstractModNameStep.KEY) ?: return - val mainClass = data.getUserData(MainClassStep.KEY) ?: return - val versionRef = data.getUserData(VERSION_REF_KEY) ?: $$"${version}" - val prefix = data.getUserData(BukkitLogPrefixStep.KEY) ?: "" - val loadOrder = data.getUserData(BukkitLoadOrderStep.KEY) ?: return - val loadBefore = data.getUserData(BukkitLoadBeforeStep.KEY) ?: emptyList() - val deps = data.getUserData(DependStep.KEY) ?: emptyList() - val softDeps = data.getUserData(SoftDependStep.KEY) ?: emptyList() - val authors = data.getUserData(AuthorsStep.KEY) ?: emptyList() - val description = data.getUserData(DescriptionStep.KEY) ?: "" - val website = data.getUserData(WebsiteStep.KEY) ?: "" - val mcVersion = data.getUserData(SimpleMcVersionStep.KEY) ?: return - val bukkitPlatform = data.getUserData(AbstractBukkitPlatformStep.KEY) ?: return - - val (packageName, className) = splitPackage(mainClass) - - assets.addTemplateProperties( - "MAIN" to mainClass, - "VERSION" to versionRef, - "NAME" to pluginName, - "PACKAGE" to packageName, - "CLASS_NAME" to className, - ) - - if (prefix.isNotBlank()) { - assets.addTemplateProperties("PREFIX" to prefix) - } - - if (loadOrder != LoadOrder.POSTWORLD) { - assets.addTemplateProperties("LOAD" to loadOrder.name) - } - - if (loadBefore.isNotEmpty()) { - assets.addTemplateProperties("LOAD_BEFORE" to loadBefore) - } - - if (deps.isNotEmpty()) { - assets.addTemplateProperties("DEPEND" to deps) - } - - if (softDeps.isNotEmpty()) { - assets.addTemplateProperties("SOFT_DEPEND" to softDeps) - } - - if (authors.isNotEmpty()) { - assets.addTemplateProperties("AUTHOR_LIST" to authors) - } - - if (description.isNotBlank()) { - assets.addTemplateProperties("DESCRIPTION" to description) - } - - if (website.isNotEmpty()) { - assets.addTemplateProperties("WEBSITE" to website) - } - - if (mcVersion >= BukkitModuleType.API_TAG_VERSION) { - assets.addTemplateProperties("API_VERSION" to mcVersion.take(2)) - } - - val (manifestPath, manifestTemplate) = bukkitPlatform.getManifest() - assets.addTemplates( - project, - manifestPath to manifestTemplate, - "src/main/java/${mainClass.replace('.', '/')}.java" to MinecraftTemplates.BUKKIT_MAIN_CLASS_TEMPLATE, - ) - } - - companion object { - val VERSION_REF_KEY = Key.create("${BukkitProjectFilesStep::class.java.name}.versionRef") - } -} - -class BukkitBuildSystemStep(parent: NewProjectWizardStep) : AbstractBuildSystemStep(parent) { - override val platformName = "Bukkit" -} - -class BukkitPostBuildSystemStep( - parent: NewProjectWizardStep, -) : AbstractRunBuildSystemStep(parent, BukkitBuildSystemStep::class.java) { - override val step = BuildSystemSupport.POST_STEP -} Index: src/main/kotlin/platform/bukkit/creator/bukkit-platforms.kt =================================================================== --- src/main/kotlin/platform/bukkit/creator/bukkit-platforms.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/bukkit/creator/bukkit-platforms.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,131 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.bukkit.creator - -import com.demonwav.mcdev.creator.buildsystem.BuildDependency -import com.demonwav.mcdev.creator.buildsystem.BuildRepository -import com.demonwav.mcdev.platform.PlatformType -import com.demonwav.mcdev.util.MinecraftTemplates -import com.demonwav.mcdev.util.MinecraftVersions -import com.demonwav.mcdev.util.SemanticVersion -import com.intellij.icons.AllIcons -import com.intellij.openapi.observable.util.bindBooleanStorage -import com.intellij.openapi.ui.validation.WHEN_GRAPH_PROPAGATION_FINISHED -import com.intellij.ui.content.AlertIcon -import com.intellij.ui.dsl.builder.Panel -import com.intellij.ui.dsl.builder.bindSelected - -class SpigotPlatformStep(parent: BukkitPlatformStep) : AbstractBukkitPlatformStep(parent, PlatformType.SPIGOT) { - override fun getRepositories(mcVersion: SemanticVersion) = listOf( - BuildRepository( - "spigotmc-repo", - "https://hub.spigotmc.org/nexus/content/repositories/snapshots/", - ), - BuildRepository( - "sonatype", - "https://oss.sonatype.org/content/groups/public/", - ), - ) - - override fun getDependencies(mcVersion: SemanticVersion) = listOf( - BuildDependency( - "org.spigotmc", - "spigot-api", - "$mcVersion-R0.1-SNAPSHOT", - mavenScope = "provided", - gradleConfiguration = "compileOnly", - ), - ) - - override fun getManifest(): Pair { - return "src/main/resources/plugin.yml" to MinecraftTemplates.BUKKIT_PLUGIN_YML_TEMPLATE - } - - class Factory : BukkitPlatformStep.Factory { - override val name = "Spigot" - - override fun createStep(parent: BukkitPlatformStep) = SpigotPlatformStep(parent) - } -} - -class PaperPlatformStep(parent: BukkitPlatformStep) : AbstractBukkitPlatformStep(parent, PlatformType.PAPER) { - - private val usePaperManifestProperty = propertyGraph.property(false) - .bindBooleanStorage("${javaClass.name}.usePaperManifest") - - private val usePaperManifest by usePaperManifestProperty - - override fun setupUI(builder: Panel) { - super.setupUI(builder) - with(builder) { - row("Paper Manifest:") { - icon(AlertIcon(AllIcons.General.Warning)).comment( - "Paper plugins are " + - "still experimental, their usage is discouraged for general purpose development. " - ) - checkBox("Use paper-plugin.yml") - .bindSelected(usePaperManifestProperty) - .validationRequestor(WHEN_GRAPH_PROPAGATION_FINISHED(propertyGraph)) - } - } - } - - override fun getRepositories(mcVersion: SemanticVersion) = listOf( - BuildRepository( - "papermc-repo", - "https://repo.papermc.io/repository/maven-public/", - ), - BuildRepository( - "sonatype", - "https://oss.sonatype.org/content/groups/public/", - ), - ) - - override fun getDependencies(mcVersion: SemanticVersion): List { - val paperGroupId = when { - mcVersion >= MinecraftVersions.MC1_17 -> "io.papermc.paper" - else -> "com.destroystokyo.paper" - } - return listOf( - BuildDependency( - paperGroupId, - "paper-api", - "$mcVersion-R0.1-SNAPSHOT", - mavenScope = "provided", - gradleConfiguration = "compileOnly", - ), - ) - } - - override fun getManifest(): Pair { - if (usePaperManifest) { - return "src/main/resources/paper-plugin.yml" to MinecraftTemplates.PAPER_PLUGIN_YML_TEMPLATE - } - - return "src/main/resources/plugin.yml" to MinecraftTemplates.BUKKIT_PLUGIN_YML_TEMPLATE - } - - class Factory : BukkitPlatformStep.Factory { - override val name = "Paper" - - override fun createStep(parent: BukkitPlatformStep) = PaperPlatformStep(parent) - } -} Index: src/main/kotlin/platform/bukkit/creator/gradle-steps.kt =================================================================== --- src/main/kotlin/platform/bukkit/creator/gradle-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/bukkit/creator/gradle-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,92 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.bukkit.creator - -import com.demonwav.mcdev.creator.EmptyStep -import com.demonwav.mcdev.creator.JdkProjectSetupFinalizer -import com.demonwav.mcdev.creator.addGradleGitignore -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.buildsystem.AbstractPatchGradleFilesStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemPropertiesStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemSupport -import com.demonwav.mcdev.creator.buildsystem.GradleImportStep -import com.demonwav.mcdev.creator.buildsystem.GradleWrapperStep -import com.demonwav.mcdev.creator.buildsystem.ReformatBuildGradleStep -import com.demonwav.mcdev.creator.buildsystem.addGradleWrapperProperties -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.gitEnabled -import com.demonwav.mcdev.creator.step.AbstractLongRunningAssetsStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.creator.step.SimpleMcVersionStep -import com.demonwav.mcdev.util.MinecraftTemplates -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project - -class BukkitGradleSupport : BuildSystemSupport { - override fun createStep(step: String, parent: NewProjectWizardStep): NewProjectWizardStep { - return when (step) { - BuildSystemSupport.PRE_STEP -> BukkitGradleFilesStep(parent) - .nextStep(::BukkitPatchBuildGradleStep) - .nextStep(::GradleWrapperStep) - BuildSystemSupport.POST_STEP -> GradleImportStep(parent).nextStep(::ReformatBuildGradleStep) - else -> EmptyStep(parent) - } - } -} - -class BukkitGradleFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating Gradle files" - - override fun setupAssets(project: Project) { - val buildSystemProps = findStep>() - val javaVersion = findStep().preferredJdk.ordinal - val (manifestPath, _) = data.getUserData(AbstractBukkitPlatformStep.KEY)!!.getManifest() - assets.addTemplateProperties( - "GROUP_ID" to buildSystemProps.groupId, - "ARTIFACT_ID" to buildSystemProps.artifactId, - "PLUGIN_VERSION" to buildSystemProps.version, - "JAVA_VERSION" to javaVersion, - "MANIFEST_NAME" to manifestPath.substringAfterLast('/') - ) - assets.addTemplates( - project, - "build.gradle" to MinecraftTemplates.BUKKIT_BUILD_GRADLE_TEMPLATE, - "gradle.properties" to MinecraftTemplates.BUKKIT_GRADLE_PROPERTIES_TEMPLATE, - "settings.gradle" to MinecraftTemplates.BUKKIT_SETTINGS_GRADLE_TEMPLATE, - ) - assets.addGradleWrapperProperties(project) - - if (gitEnabled) { - assets.addGradleGitignore(project) - } - } -} - -class BukkitPatchBuildGradleStep(parent: NewProjectWizardStep) : AbstractPatchGradleFilesStep(parent) { - override fun patch(project: Project, gradleFiles: GradleFiles) { - val platform = data.getUserData(AbstractBukkitPlatformStep.KEY) ?: return - val mcVersion = data.getUserData(SimpleMcVersionStep.KEY) ?: return - val repositories = platform.getRepositories(mcVersion) - val dependencies = platform.getDependencies(mcVersion) - addRepositories(project, gradleFiles.buildGradle, repositories) - addDependencies(project, gradleFiles.buildGradle, dependencies) - } -} Index: src/main/kotlin/platform/bukkit/creator/maven-steps.kt =================================================================== --- src/main/kotlin/platform/bukkit/creator/maven-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/bukkit/creator/maven-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,75 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2026 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.bukkit.creator - -import com.demonwav.mcdev.creator.EmptyStep -import com.demonwav.mcdev.creator.addMavenGitignore -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.buildsystem.AbstractPatchPomStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemSupport -import com.demonwav.mcdev.creator.buildsystem.MavenImportStep -import com.demonwav.mcdev.creator.buildsystem.ReformatPomStep -import com.demonwav.mcdev.creator.buildsystem.addDefaultMavenProperties -import com.demonwav.mcdev.creator.gitEnabled -import com.demonwav.mcdev.creator.step.AbstractLongRunningAssetsStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.creator.step.SimpleMcVersionStep -import com.demonwav.mcdev.util.MinecraftTemplates -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project -import com.intellij.psi.xml.XmlTag -import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel - -class BukkitMavenSupport : BuildSystemSupport { - override val preferred = true - - override fun createStep(step: String, parent: NewProjectWizardStep): NewProjectWizardStep { - return when (step) { - BuildSystemSupport.PRE_STEP -> BukkitMavenFilesStep(parent).nextStep(::BukkitPatchPomStep) - BuildSystemSupport.POST_STEP -> MavenImportStep(parent).nextStep(::ReformatPomStep) - else -> EmptyStep(parent) - } - } -} - -class BukkitMavenFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating Maven files" - - override fun setupAssets(project: Project) { - data.putUserData(BukkitProjectFilesStep.VERSION_REF_KEY, $$"${project.version}") - assets.addDefaultMavenProperties() - assets.addTemplates(project, "pom.xml" to MinecraftTemplates.BUKKIT_POM_TEMPLATE) - if (gitEnabled) { - assets.addMavenGitignore(project) - } - } -} - -class BukkitPatchPomStep(parent: NewProjectWizardStep) : AbstractPatchPomStep(parent) { - override fun patchPom(model: MavenDomProjectModel, root: XmlTag) { - super.patchPom(model, root) - val platform = data.getUserData(AbstractBukkitPlatformStep.KEY) ?: return - val mcVersion = data.getUserData(SimpleMcVersionStep.KEY) ?: return - val repositories = platform.getRepositories(mcVersion) - val dependencies = platform.getDependencies(mcVersion) - setupDependencies(model, repositories, dependencies) - } -} Index: src/main/kotlin/platform/bukkit/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/bukkit/creator/ui-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/bukkit/creator/ui-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,171 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2026 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.bukkit.creator - -import com.demonwav.mcdev.creator.PlatformVersion -import com.demonwav.mcdev.creator.buildsystem.BuildDependency -import com.demonwav.mcdev.creator.buildsystem.BuildRepository -import com.demonwav.mcdev.creator.getVersionSelector -import com.demonwav.mcdev.creator.platformtype.PluginPlatformStep -import com.demonwav.mcdev.creator.step.AbstractCollapsibleStep -import com.demonwav.mcdev.creator.step.AbstractLatentStep -import com.demonwav.mcdev.creator.step.AbstractOptionalStringStep -import com.demonwav.mcdev.creator.step.AuthorsStep -import com.demonwav.mcdev.creator.step.DependStep -import com.demonwav.mcdev.creator.step.DescriptionStep -import com.demonwav.mcdev.creator.step.MainClassStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.creator.step.PluginNameStep -import com.demonwav.mcdev.creator.step.SimpleMcVersionStep -import com.demonwav.mcdev.creator.step.SoftDependStep -import com.demonwav.mcdev.creator.step.WebsiteStep -import com.demonwav.mcdev.platform.PlatformType -import com.demonwav.mcdev.util.SemanticVersion -import com.demonwav.mcdev.util.asyncIO -import com.intellij.ide.wizard.AbstractNewProjectWizardMultiStep -import com.intellij.ide.wizard.AbstractNewProjectWizardStep -import com.intellij.ide.wizard.NewProjectWizardMultiStepFactory -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.extensions.ExtensionPointName -import com.intellij.openapi.observable.util.bindStorage -import com.intellij.openapi.observable.util.transform -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key -import com.intellij.ui.dsl.builder.Panel -import kotlinx.coroutines.coroutineScope - -class BukkitPlatformStep( - parent: PluginPlatformStep, -) : AbstractNewProjectWizardMultiStep(parent, EP_NAME) { - companion object { - val EP_NAME = ExtensionPointName("com.demonwav.minecraft-dev.bukkitPlatformWizard") - } - - override val self = this - override val label = "Bukkit Platform:" - - class PlatformFactory : PluginPlatformStep.Factory { - override val name = "Bukkit" - - override fun createStep(parent: PluginPlatformStep) = BukkitPlatformStep(parent) - } - - interface Factory : NewProjectWizardMultiStepFactory -} - -abstract class AbstractBukkitPlatformStep( - parent: BukkitPlatformStep, - private val platform: PlatformType, -) : AbstractLatentStep(parent) { - override val description = "download versions" - - override suspend fun computeData() = coroutineScope { - asyncIO { getVersionSelector(platform) }.await() - } - - override fun createStep(data: PlatformVersion) = - SimpleMcVersionStep(this, data.versions.mapNotNull(SemanticVersion::tryParse)) - .nextStep(::PluginNameStep) - .nextStep(::MainClassStep) - .nextStep(::BukkitOptionalSettingsStep) - .nextStep(::BukkitBuildSystemStep) - .nextStep(::BukkitProjectFilesStep) - .nextStep(::BukkitPostBuildSystemStep) - - override fun setupProject(project: Project) { - data.putUserData(KEY, this) - super.setupProject(project) - } - - abstract fun getRepositories(mcVersion: SemanticVersion): List - - abstract fun getDependencies(mcVersion: SemanticVersion): List - - abstract fun getManifest(): Pair - - companion object { - val KEY = Key.create("${AbstractBukkitPlatformStep::class.java.name}.platform") - } -} - -class BukkitOptionalSettingsStep(parent: NewProjectWizardStep) : AbstractCollapsibleStep(parent) { - override val title = "Optional Settings" - - override fun createStep() = DescriptionStep(this) - .nextStep(::AuthorsStep) - .nextStep(::WebsiteStep) - .nextStep(::BukkitLogPrefixStep) - .nextStep(::BukkitLoadOrderStep) - .nextStep(::BukkitLoadBeforeStep) - .nextStep(::DependStep) - .nextStep(::SoftDependStep) -} - -class BukkitLogPrefixStep(parent: NewProjectWizardStep) : AbstractOptionalStringStep(parent) { - override val label = "Log Prefix:" - - override fun setupProject(project: Project) { - data.putUserData(KEY, value) - } - - companion object { - val KEY = Key.create("${BukkitLogPrefixStep::class.java.name}.logPrefix") - } -} - -class BukkitLoadOrderStep(parent: NewProjectWizardStep) : AbstractNewProjectWizardStep(parent) { - private val loadOrderProperty = propertyGraph.property(LoadOrder.POSTWORLD) - private var loadOrder by loadOrderProperty - - init { - loadOrderProperty.transform(LoadOrder::name, LoadOrder::valueOf) - .bindStorage("${javaClass.name}.loadOrder") - } - - override fun setupUI(builder: Panel) { - with(builder) { - row("Load at:") { - segmentedButton(LoadOrder.entries) { text = it.toString() } - .bind(loadOrderProperty) - } - } - } - - override fun setupProject(project: Project) { - data.putUserData(KEY, loadOrder) - } - - companion object { - val KEY = Key.create("${BukkitLoadOrderStep::class.java.name}.loadOrder") - } -} - -class BukkitLoadBeforeStep(parent: NewProjectWizardStep) : AbstractOptionalStringStep(parent) { - override val label = "Load Before:" - - override fun setupProject(project: Project) { - data.putUserData(KEY, AuthorsStep.parseAuthors(value)) - } - - companion object { - val KEY = Key.create>("${BukkitLoadBeforeStep::class.java.name}.loadBefore") - } -} Index: src/main/kotlin/platform/bungeecord/creator/asset-steps.kt =================================================================== --- src/main/kotlin/platform/bungeecord/creator/asset-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/bungeecord/creator/asset-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,102 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2026 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.bungeecord.creator - -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.buildsystem.AbstractBuildSystemStep -import com.demonwav.mcdev.creator.buildsystem.AbstractRunBuildSystemStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemSupport -import com.demonwav.mcdev.creator.splitPackage -import com.demonwav.mcdev.creator.step.AbstractLongRunningAssetsStep -import com.demonwav.mcdev.creator.step.AbstractModNameStep -import com.demonwav.mcdev.creator.step.AuthorsStep -import com.demonwav.mcdev.creator.step.DependStep -import com.demonwav.mcdev.creator.step.DescriptionStep -import com.demonwav.mcdev.creator.step.MainClassStep -import com.demonwav.mcdev.creator.step.SoftDependStep -import com.demonwav.mcdev.util.MinecraftTemplates -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key - -class BungeeProjectFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating project files" - - override fun setupAssets(project: Project) { - val mainClass = data.getUserData(MainClassStep.KEY) ?: return - val (packageName, className) = splitPackage(mainClass) - val versionRef = data.getUserData(VERSION_REF_KEY) ?: $$"${version}" - val pluginName = data.getUserData(AbstractModNameStep.KEY) ?: return - val authors = data.getUserData(AuthorsStep.KEY) ?: emptyList() - val description = data.getUserData(DescriptionStep.KEY) ?: "" - val depend = data.getUserData(DependStep.KEY) ?: emptyList() - val softDepend = data.getUserData(SoftDependStep.KEY) ?: emptyList() - - assets.addTemplateProperties( - "PACKAGE" to packageName, - "CLASS_NAME" to className, - "MAIN" to mainClass, - "VERSION" to versionRef, - "NAME" to pluginName, - ) - - if (authors.isNotEmpty()) { - assets.addTemplateProperties( - "AUTHOR" to authors.joinToString(", "), - ) - } - if (description.isNotBlank()) { - assets.addTemplateProperties( - "DESCRIPTION" to description, - ) - } - if (depend.isNotEmpty()) { - assets.addTemplateProperties( - "DEPEND" to depend, - ) - } - if (softDepend.isNotEmpty()) { - assets.addTemplateProperties( - "SOFT_DEPEND" to softDepend, - ) - } - - assets.addTemplates( - project, - "src/main/resources/bungee.yml" to MinecraftTemplates.BUNGEECORD_PLUGIN_YML_TEMPLATE, - "src/main/java/${mainClass.replace('.', '/')}.java" to MinecraftTemplates.BUNGEECORD_MAIN_CLASS_TEMPLATE, - ) - } - - companion object { - val VERSION_REF_KEY = Key.create("${BungeeProjectFilesStep::class.java.name}.versionRef") - } -} - -class BungeeBuildSystemStep(parent: NewProjectWizardStep) : AbstractBuildSystemStep(parent) { - override val platformName = "BungeeCord" -} - -class BungeePostBuildSystemStep( - parent: NewProjectWizardStep, -) : AbstractRunBuildSystemStep(parent, BungeeBuildSystemStep::class.java) { - override val step = BuildSystemSupport.POST_STEP -} Index: src/main/kotlin/platform/bungeecord/creator/bungee-platforms.kt =================================================================== --- src/main/kotlin/platform/bungeecord/creator/bungee-platforms.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/bungeecord/creator/bungee-platforms.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,76 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.bungeecord.creator - -import com.demonwav.mcdev.creator.buildsystem.BuildDependency -import com.demonwav.mcdev.creator.buildsystem.BuildRepository -import com.demonwav.mcdev.platform.PlatformType -import com.demonwav.mcdev.util.SemanticVersion - -class BungeeMainPlatformStep(parent: BungeePlatformStep) : AbstractBungeePlatformStep(parent, PlatformType.BUNGEECORD) { - override fun getRepositories(mcVersion: SemanticVersion) = listOf( - BuildRepository("sonatype", "https://oss.sonatype.org/content/groups/public/"), - // Seems to be required since 1.21 - BuildRepository("Minecraft Libraries", "https://libraries.minecraft.net/"), - ) - - override fun getDependencies(mcVersion: SemanticVersion) = listOf( - BuildDependency( - "net.md-5", - "bungeecord-api", - mcVersion.toString(), - mavenScope = "provided", - gradleConfiguration = "compileOnly", - ), - ) - - class Factory : BungeePlatformStep.Factory { - override val name = "BungeeCord" - - override fun createStep(parent: BungeePlatformStep) = BungeeMainPlatformStep(parent) - } -} - -class WaterfallPlatformStep(parent: BungeePlatformStep) : AbstractBungeePlatformStep(parent, PlatformType.WATERFALL) { - override fun getRepositories(mcVersion: SemanticVersion) = listOf( - BuildRepository("sonatype", "https://oss.sonatype.org/content/groups/public/"), - BuildRepository( - "papermc-repo", - "https://repo.papermc.io/repository/maven-public/", - ), - ) - - override fun getDependencies(mcVersion: SemanticVersion) = listOf( - BuildDependency( - "io.github.waterfallmc", - "waterfall-api", - "$mcVersion-SNAPSHOT", - mavenScope = "provided", - gradleConfiguration = "compileOnly", - ), - ) - - class Factory : BungeePlatformStep.Factory { - override val name = "Waterfall" - - override fun createStep(parent: BungeePlatformStep) = WaterfallPlatformStep(parent) - } -} Index: src/main/kotlin/platform/bungeecord/creator/gradle-steps.kt =================================================================== --- src/main/kotlin/platform/bungeecord/creator/gradle-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/bungeecord/creator/gradle-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,90 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.bungeecord.creator - -import com.demonwav.mcdev.creator.EmptyStep -import com.demonwav.mcdev.creator.addGradleGitignore -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.buildsystem.AbstractPatchGradleFilesStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemPropertiesStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemSupport -import com.demonwav.mcdev.creator.buildsystem.GradleImportStep -import com.demonwav.mcdev.creator.buildsystem.GradleWrapperStep -import com.demonwav.mcdev.creator.buildsystem.ReformatBuildGradleStep -import com.demonwav.mcdev.creator.buildsystem.addGradleWrapperProperties -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.gitEnabled -import com.demonwav.mcdev.creator.step.AbstractLongRunningAssetsStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.creator.step.SimpleMcVersionStep -import com.demonwav.mcdev.util.MinecraftTemplates -import com.intellij.ide.wizard.NewProjectWizardBaseData.Companion.baseData -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project - -class BungeeGradleSupport : BuildSystemSupport { - override fun createStep(step: String, parent: NewProjectWizardStep): NewProjectWizardStep { - return when (step) { - BuildSystemSupport.PRE_STEP -> BungeeGradleFilesStep(parent) - .nextStep(::BungeePatchBuildGradleStep) - .nextStep(::GradleWrapperStep) - BuildSystemSupport.POST_STEP -> GradleImportStep(parent).nextStep(::ReformatBuildGradleStep) - else -> EmptyStep(parent) - } - } -} - -class BungeeGradleFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating Gradle files" - - override fun setupAssets(project: Project) { - val projectName = baseData!!.name - val buildSystemProps = findStep>() - assets.addTemplateProperties( - "PROJECT_NAME" to projectName, - "GROUP_ID" to buildSystemProps.groupId, - "ARTIFACT_ID" to buildSystemProps.artifactId, - "PLUGIN_VERSION" to buildSystemProps.version, - ) - assets.addTemplates( - project, - "build.gradle" to MinecraftTemplates.BUNGEECORD_BUILD_GRADLE_TEMPLATE, - "gradle.properties" to MinecraftTemplates.BUNGEECORD_GRADLE_PROPERTIES_TEMPLATE, - "settings.gradle" to MinecraftTemplates.BUNGEECORD_SETTINGS_GRADLE_TEMPLATE, - ) - assets.addGradleWrapperProperties(project) - - if (gitEnabled) { - assets.addGradleGitignore(project) - } - } -} - -class BungeePatchBuildGradleStep(parent: NewProjectWizardStep) : AbstractPatchGradleFilesStep(parent) { - override fun patch(project: Project, gradleFiles: GradleFiles) { - val platform = data.getUserData(AbstractBungeePlatformStep.KEY) ?: return - val mcVersion = data.getUserData(SimpleMcVersionStep.KEY) ?: return - val repositories = platform.getRepositories(mcVersion) - val dependencies = platform.getDependencies(mcVersion) - addRepositories(project, gradleFiles.buildGradle, repositories) - addDependencies(project, gradleFiles.buildGradle, dependencies) - } -} Index: src/main/kotlin/platform/bungeecord/creator/maven-steps.kt =================================================================== --- src/main/kotlin/platform/bungeecord/creator/maven-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/bungeecord/creator/maven-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,75 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2026 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.bungeecord.creator - -import com.demonwav.mcdev.creator.EmptyStep -import com.demonwav.mcdev.creator.addMavenGitignore -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.buildsystem.AbstractPatchPomStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemSupport -import com.demonwav.mcdev.creator.buildsystem.MavenImportStep -import com.demonwav.mcdev.creator.buildsystem.ReformatPomStep -import com.demonwav.mcdev.creator.buildsystem.addDefaultMavenProperties -import com.demonwav.mcdev.creator.gitEnabled -import com.demonwav.mcdev.creator.step.AbstractLongRunningAssetsStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.creator.step.SimpleMcVersionStep -import com.demonwav.mcdev.util.MinecraftTemplates -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project -import com.intellij.psi.xml.XmlTag -import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel - -class BungeeMavenSupport : BuildSystemSupport { - override val preferred = true - - override fun createStep(step: String, parent: NewProjectWizardStep): NewProjectWizardStep { - return when (step) { - BuildSystemSupport.PRE_STEP -> BungeeMavenFilesStep(parent).nextStep(::BungeePatchPomStep) - BuildSystemSupport.POST_STEP -> MavenImportStep(parent).nextStep(::ReformatPomStep) - else -> EmptyStep(parent) - } - } -} - -class BungeeMavenFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating Maven files" - - override fun setupAssets(project: Project) { - data.putUserData(BungeeProjectFilesStep.VERSION_REF_KEY, $$"${project.version}") - assets.addDefaultMavenProperties() - assets.addTemplates(project, "pom.xml" to MinecraftTemplates.BUNGEECORD_POM_TEMPLATE) - if (gitEnabled) { - assets.addMavenGitignore(project) - } - } -} - -class BungeePatchPomStep(parent: NewProjectWizardStep) : AbstractPatchPomStep(parent) { - override fun patchPom(model: MavenDomProjectModel, root: XmlTag) { - super.patchPom(model, root) - val platform = data.getUserData(AbstractBungeePlatformStep.KEY) ?: return - val mcVersion = data.getUserData(SimpleMcVersionStep.KEY) ?: return - val repositories = platform.getRepositories(mcVersion) - val dependencies = platform.getDependencies(mcVersion) - setupDependencies(model, repositories, dependencies) - } -} Index: src/main/kotlin/platform/bungeecord/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/bungeecord/creator/ui-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/bungeecord/creator/ui-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,108 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.bungeecord.creator - -import com.demonwav.mcdev.creator.PlatformVersion -import com.demonwav.mcdev.creator.buildsystem.BuildDependency -import com.demonwav.mcdev.creator.buildsystem.BuildRepository -import com.demonwav.mcdev.creator.getVersionSelector -import com.demonwav.mcdev.creator.platformtype.PluginPlatformStep -import com.demonwav.mcdev.creator.step.AbstractCollapsibleStep -import com.demonwav.mcdev.creator.step.AbstractLatentStep -import com.demonwav.mcdev.creator.step.AuthorsStep -import com.demonwav.mcdev.creator.step.DependStep -import com.demonwav.mcdev.creator.step.DescriptionStep -import com.demonwav.mcdev.creator.step.MainClassStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.creator.step.PluginNameStep -import com.demonwav.mcdev.creator.step.SimpleMcVersionStep -import com.demonwav.mcdev.creator.step.SoftDependStep -import com.demonwav.mcdev.platform.PlatformType -import com.demonwav.mcdev.util.SemanticVersion -import com.demonwav.mcdev.util.asyncIO -import com.intellij.ide.wizard.AbstractNewProjectWizardMultiStep -import com.intellij.ide.wizard.NewProjectWizardMultiStepFactory -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.extensions.ExtensionPointName -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key -import kotlinx.coroutines.coroutineScope - -class BungeePlatformStep( - parent: PluginPlatformStep, -) : AbstractNewProjectWizardMultiStep(parent, EP_NAME) { - companion object { - val EP_NAME = ExtensionPointName("com.demonwav.minecraft-dev.bungeePlatformWizard") - } - - override val self = this - override val label = "Bungee Platform:" - - class PlatformFactory : PluginPlatformStep.Factory { - override val name = "BungeeCord" - - override fun createStep(parent: PluginPlatformStep) = BungeePlatformStep(parent) - } - - interface Factory : NewProjectWizardMultiStepFactory -} - -abstract class AbstractBungeePlatformStep( - parent: BungeePlatformStep, - private val platform: PlatformType, -) : AbstractLatentStep(parent) { - override val description = "download versions" - - override suspend fun computeData() = coroutineScope { - asyncIO { getVersionSelector(platform) }.await() - } - - override fun createStep(data: PlatformVersion) = - SimpleMcVersionStep(this, data.versions.mapNotNull(SemanticVersion::tryParse)) - .nextStep(::PluginNameStep) - .nextStep(::MainClassStep) - .nextStep(::BungeeOptionalSettingsStep) - .nextStep(::BungeeBuildSystemStep) - .nextStep(::BungeeProjectFilesStep) - .nextStep(::BungeePostBuildSystemStep) - - override fun setupProject(project: Project) { - data.putUserData(KEY, this) - super.setupProject(project) - } - - abstract fun getRepositories(mcVersion: SemanticVersion): List - - abstract fun getDependencies(mcVersion: SemanticVersion): List - - companion object { - val KEY = Key.create("${AbstractBungeePlatformStep::class.java.name}.platform") - } -} - -class BungeeOptionalSettingsStep(parent: NewProjectWizardStep) : AbstractCollapsibleStep(parent) { - override val title = "Optional Settings" - - override fun createStep() = DescriptionStep(this) - .nextStep(::AuthorsStep) - .nextStep(::DependStep) - .nextStep(::SoftDependStep) -} Index: src/main/kotlin/platform/fabric/creator/FabricMcVersion.kt =================================================================== --- src/main/kotlin/platform/fabric/creator/FabricMcVersion.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/fabric/creator/FabricMcVersion.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,30 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.fabric.creator - -class FabricMcVersion( - private val ordinal: Int, - val version: String, - val stable: Boolean, -) : Comparable { - override fun toString() = version - override fun compareTo(other: FabricMcVersion) = ordinal.compareTo(other.ordinal) -} Index: src/main/kotlin/platform/fabric/creator/asset-steps.kt =================================================================== --- src/main/kotlin/platform/fabric/creator/asset-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/fabric/creator/asset-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,153 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.fabric.creator - -import com.demonwav.mcdev.creator.JdkProjectSetupFinalizer -import com.demonwav.mcdev.creator.addLicense -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.buildsystem.AbstractBuildSystemStep -import com.demonwav.mcdev.creator.buildsystem.AbstractRunBuildSystemStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemPropertiesStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemSupport -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.step.AbstractLongRunningAssetsStep -import com.demonwav.mcdev.creator.step.AbstractModIdStep -import com.demonwav.mcdev.creator.step.AbstractModNameStep -import com.demonwav.mcdev.creator.step.AuthorsStep -import com.demonwav.mcdev.creator.step.DescriptionStep -import com.demonwav.mcdev.creator.step.LicenseStep -import com.demonwav.mcdev.creator.step.RepositoryStep -import com.demonwav.mcdev.creator.step.UseMixinsStep -import com.demonwav.mcdev.creator.step.WebsiteStep -import com.demonwav.mcdev.platform.fabric.EntryPoint -import com.demonwav.mcdev.platform.fabric.util.FabricConstants -import com.demonwav.mcdev.platform.forge.inspections.sideonly.Side -import com.demonwav.mcdev.util.MinecraftTemplates.Companion.FABRIC_MIXINS_JSON_TEMPLATE -import com.demonwav.mcdev.util.MinecraftTemplates.Companion.FABRIC_MOD_JSON_TEMPLATE -import com.demonwav.mcdev.util.toJavaClassName -import com.demonwav.mcdev.util.toPackageName -import com.intellij.ide.starters.local.GeneratorEmptyDirectory -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.application.WriteAction -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.text.StringUtil -import com.intellij.openapi.vfs.LocalFileSystem -import com.intellij.openapi.vfs.VfsUtil - -const val MAGIC_DEFERRED_INIT_FILE = ".hello_fabric_from_mcdev" - -class FabricBaseFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Adding Fabric project files (phase 1)" - - override fun setupAssets(project: Project) { - val buildSystemProps = findStep>() - val modId = data.getUserData(AbstractModIdStep.KEY) ?: return - val modName = data.getUserData(AbstractModNameStep.KEY) ?: return - val description = data.getUserData(DescriptionStep.KEY) ?: "" - val envName = when (data.getUserData(FabricEnvironmentStep.KEY) ?: Side.NONE) { - Side.CLIENT -> "client" - Side.SERVER -> "server" - else -> "*" - } - val loaderVersion = data.getUserData(FabricVersionChainStep.LOADER_VERSION_KEY) ?: return - val mcVersion = data.getUserData(FabricVersionChainStep.MC_VERSION_KEY) ?: return - val javaVersion = findStep().preferredJdk.ordinal - val license = data.getUserData(LicenseStep.KEY) ?: return - val apiVersion = data.getUserData(FabricVersionChainStep.API_VERSION_KEY) - val useMixins = data.getUserData(UseMixinsStep.KEY) ?: false - - assets.addTemplateProperties( - "ARTIFACT_ID" to buildSystemProps.artifactId, - "MOD_ID" to modId, - "MOD_NAME" to StringUtil.escapeStringCharacters(modName), - "MOD_DESCRIPTION" to StringUtil.escapeStringCharacters(description), - "MOD_ENVIRONMENT" to envName, - "LOADER_VERSION" to loaderVersion, - "MC_VERSION" to mcVersion, - "JAVA_VERSION" to javaVersion, - "LICENSE" to license.id, - ) - - if (apiVersion != null) { - assets.addTemplateProperties("API_VERSION" to apiVersion) - } - - if (useMixins) { - val packageName = - "${buildSystemProps.groupId.toPackageName()}.${modId.toPackageName()}.mixin" - assets.addTemplateProperties( - "MIXINS" to "true", - "MIXIN_PACKAGE_NAME" to packageName, - ) - val mixinsJsonFile = "src/main/resources/$modId.mixins.json" - assets.addTemplates(project, mixinsJsonFile to FABRIC_MIXINS_JSON_TEMPLATE) - } - - assets.addLicense(project) - - assets.addAssets( - GeneratorEmptyDirectory("src/main/java"), - GeneratorEmptyDirectory("src/main/resources"), - ) - - assets.addTemplates(project, "src/main/resources/fabric.mod.json" to FABRIC_MOD_JSON_TEMPLATE) - - WriteAction.runAndWait { - val dir = VfsUtil.createDirectoryIfMissing( - LocalFileSystem.getInstance(), - "${assets.outputDirectory}/.gradle", - ) - ?: throw IllegalStateException("Unable to create .gradle directory") - val file = dir.findOrCreateChildData(this, MAGIC_DEFERRED_INIT_FILE) - - val authors = data.getUserData(AuthorsStep.KEY) ?: emptyList() - val website = data.getUserData(WebsiteStep.KEY) - val repo = data.getUserData(RepositoryStep.KEY) - - val packageName = "${buildSystemProps.groupId.toPackageName()}.${modId.toPackageName()}" - val mainClassName = "$packageName.${modName.toJavaClassName()}" - val clientClassName = "$packageName.client.${modName.toJavaClassName()}Client" - - val entrypoints = listOf( - "main,${EntryPoint.Type.CLASS.name},$mainClassName,${FabricConstants.MOD_INITIALIZER}", - "client,${EntryPoint.Type.CLASS.name},$clientClassName,${FabricConstants.CLIENT_MOD_INITIALIZER}", - ) - val fileContents = """ - ${authors.joinToString(",")} - $website - $repo - ${entrypoints.joinToString(";")} - """.trimIndent() // TODO: un-hardcode? - - VfsUtil.saveText(file, fileContents) - } - } -} - -class FabricBuildSystemStep(parent: NewProjectWizardStep) : AbstractBuildSystemStep(parent) { - override val platformName = "Fabric" -} - -class FabricPostBuildSystemStep( - parent: NewProjectWizardStep, -) : AbstractRunBuildSystemStep(parent, FabricBuildSystemStep::class.java) { - override val step = BuildSystemSupport.POST_STEP -} Index: src/main/kotlin/platform/fabric/creator/gradle-steps.kt =================================================================== --- src/main/kotlin/platform/fabric/creator/gradle-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/fabric/creator/gradle-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,97 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.fabric.creator - -import com.demonwav.mcdev.creator.EmptyStep -import com.demonwav.mcdev.creator.JdkProjectSetupFinalizer -import com.demonwav.mcdev.creator.addGradleGitignore -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.buildsystem.BuildSystemPropertiesStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemSupport -import com.demonwav.mcdev.creator.buildsystem.GradleImportStep -import com.demonwav.mcdev.creator.buildsystem.GradleWrapperStep -import com.demonwav.mcdev.creator.buildsystem.addGradleWrapperProperties -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.gitEnabled -import com.demonwav.mcdev.creator.step.AbstractLongRunningAssetsStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.util.MinecraftTemplates -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project - -class FabricGradleSupport : BuildSystemSupport { - override val preferred = true - - override fun createStep(step: String, parent: NewProjectWizardStep): NewProjectWizardStep { - return when (step) { - BuildSystemSupport.PRE_STEP -> FabricGradleFilesStep(parent).nextStep(::GradleWrapperStep) - BuildSystemSupport.POST_STEP -> GradleImportStep(parent) - else -> EmptyStep(parent) - } - } -} - -class FabricGradleFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating Gradle files" - - override fun setupAssets(project: Project) { - val buildSystemProps = findStep>() - val mcVersion = data.getUserData(FabricVersionChainStep.MC_VERSION_KEY) ?: return - val yarnVersion = data.getUserData(FabricVersionChainStep.YARN_VERSION_KEY) ?: return - val loaderVersion = data.getUserData(FabricVersionChainStep.LOADER_VERSION_KEY) ?: return - val loomVersion = "1.6-SNAPSHOT" - val javaVersion = findStep().preferredJdk.ordinal - val apiVersion = data.getUserData(FabricVersionChainStep.API_VERSION_KEY) - val officialMappings = data.getUserData(FabricVersionChainStep.OFFICIAL_MAPPINGS_KEY) ?: false - - assets.addTemplateProperties( - "GROUP_ID" to buildSystemProps.groupId, - "ARTIFACT_ID" to buildSystemProps.artifactId, - "VERSION" to buildSystemProps.version, - "MC_VERSION" to mcVersion, - "YARN_MAPPINGS" to yarnVersion, - "LOADER_VERSION" to loaderVersion, - "LOOM_VERSION" to loomVersion, - "JAVA_VERSION" to javaVersion, - ) - - if (apiVersion != null) { - assets.addTemplateProperties("API_VERSION" to apiVersion) - } - - if (officialMappings) { - assets.addTemplateProperties("OFFICIAL_MAPPINGS" to "true") - } - - assets.addTemplates( - project, - "build.gradle" to MinecraftTemplates.FABRIC_BUILD_GRADLE_TEMPLATE, - "gradle.properties" to MinecraftTemplates.FABRIC_GRADLE_PROPERTIES_TEMPLATE, - "settings.gradle" to MinecraftTemplates.FABRIC_SETTINGS_GRADLE_TEMPLATE, - ) - - assets.addGradleWrapperProperties(project) - - if (gitEnabled) { - assets.addGradleGitignore(project) - } - } -} Index: src/main/kotlin/platform/fabric/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/fabric/creator/ui-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/fabric/creator/ui-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,268 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2026 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.fabric.creator - -import com.demonwav.mcdev.creator.platformtype.ModPlatformStep -import com.demonwav.mcdev.creator.step.AbstractCollapsibleStep -import com.demonwav.mcdev.creator.step.AbstractLatentStep -import com.demonwav.mcdev.creator.step.AbstractMcVersionChainStep -import com.demonwav.mcdev.creator.step.AuthorsStep -import com.demonwav.mcdev.creator.step.DescriptionStep -import com.demonwav.mcdev.creator.step.LicenseStep -import com.demonwav.mcdev.creator.step.ModIdStep -import com.demonwav.mcdev.creator.step.ModNameStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.creator.step.RepositoryStep -import com.demonwav.mcdev.creator.step.UseMixinsStep -import com.demonwav.mcdev.creator.step.VersionChainComboBox -import com.demonwav.mcdev.creator.step.WebsiteStep -import com.demonwav.mcdev.platform.fabric.util.FabricApiVersions -import com.demonwav.mcdev.platform.fabric.util.FabricVersions -import com.demonwav.mcdev.platform.forge.inspections.sideonly.Side -import com.demonwav.mcdev.util.SemanticVersion -import com.demonwav.mcdev.util.asyncIO -import com.demonwav.mcdev.util.bindEnabled -import com.intellij.ide.wizard.AbstractNewProjectWizardStep -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.observable.util.bindBooleanStorage -import com.intellij.openapi.observable.util.bindStorage -import com.intellij.openapi.observable.util.not -import com.intellij.openapi.observable.util.transform -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key -import com.intellij.ui.JBColor -import com.intellij.ui.dsl.builder.Cell -import com.intellij.ui.dsl.builder.Panel -import com.intellij.ui.dsl.builder.Row -import com.intellij.ui.dsl.builder.bindItem -import com.intellij.ui.dsl.builder.bindSelected -import com.intellij.ui.dsl.builder.bindText -import com.intellij.util.IncorrectOperationException -import kotlinx.coroutines.coroutineScope - -class FabricPlatformStep( - parent: ModPlatformStep, -) : AbstractLatentStep>(parent) { - override val description = "download Fabric versions" - - override suspend fun computeData() = coroutineScope { - val fabricVersions = asyncIO { FabricVersions.downloadData() } - val fabricApiVersions = asyncIO { FabricApiVersions.downloadData() } - fabricVersions.await()?.let { a -> fabricApiVersions.await()?.let { b -> a to b } } - } - - override fun createStep(data: Pair): NewProjectWizardStep { - val (fabricVersions, apiVersions) = data - return FabricVersionChainStep(this, fabricVersions, apiVersions) - .nextStep(::FabricEnvironmentStep) - .nextStep(::UseMixinsStep) - .nextStep(::ModIdStep) - .nextStep(::ModNameStep) - .nextStep(::LicenseStep) - .nextStep(::FabricOptionalSettingsStep) - .nextStep(::FabricBuildSystemStep) - .nextStep(::FabricBaseFilesStep) - .nextStep(::FabricPostBuildSystemStep) - } - - class Factory : ModPlatformStep.Factory { - override val name = "Fabric" - override fun createStep(parent: ModPlatformStep) = FabricPlatformStep(parent) - } -} - -class FabricVersionChainStep( - parent: NewProjectWizardStep, - private val fabricVersions: FabricVersions, - private val apiVersions: FabricApiVersions, -) : AbstractMcVersionChainStep(parent, "Loader Version:", "Yarn Version:", "API Version:") { - companion object { - private const val LOADER_VERSION = 1 - private const val YARN_VERSION = 2 - private const val API_VERSION = 3 - - val MC_VERSION_KEY = Key.create("${FabricVersionChainStep::class.java.name}.mcVersion") - val LOADER_VERSION_KEY = Key.create("${FabricVersionChainStep::class.java.name}.loaderVersion") - val YARN_VERSION_KEY = Key.create("${FabricVersionChainStep::class.java.name}.yarnVersion") - val API_VERSION_KEY = Key.create("${FabricVersionChainStep::class.java.name}.apiVersion") - val OFFICIAL_MAPPINGS_KEY = Key.create("${FabricVersionChainStep::class.java.name}.officialMappings") - } - - private val showSnapshotsProperty = propertyGraph.property(false) - .bindBooleanStorage("${javaClass.name}.showSnapshots") - private var showSnapshots by showSnapshotsProperty - - private val useApiProperty = propertyGraph.property(true) - .bindBooleanStorage("${javaClass.name}.useApi") - private var useApi by useApiProperty - - private val useOfficialMappingsProperty = propertyGraph.property(false) - .bindBooleanStorage("${javaClass.name}.useOfficialMappings") - private var useOfficialMappings by useOfficialMappingsProperty - - init { - showSnapshotsProperty.afterChange { updateVersionBox() } - } - - private val mcVersions by lazy { - fabricVersions.game.mapIndexed { index, version -> - FabricMcVersion(fabricVersions.game.size - 1 - index, version.version, version.stable) - } - } - - override fun createComboBox(row: Row, index: Int, items: List>): Cell { - return when (index) { - MINECRAFT_VERSION -> { - val comboBox = super.createComboBox(row, index, items) - row.checkBox("Show snapshots").bindSelected(showSnapshotsProperty) - comboBox - } - YARN_VERSION -> { - val comboBox = super.createComboBox(row, index, items).bindEnabled(useOfficialMappingsProperty.not()) - row.checkBox("Use official mappings").bindSelected(useOfficialMappingsProperty) - row.label("").bindText( - getVersionProperty(MINECRAFT_VERSION).transform { mcVersion -> - mcVersion as FabricMcVersion - val matched = fabricVersions.mappings.any { it.gameVersion == mcVersion.version } - if (matched) { - "" - } else { - "Unable to match Yarn versions to Minecraft version" - } - }, - ).bindEnabled(useOfficialMappingsProperty.not()).component.foreground = JBColor.YELLOW - comboBox - } - API_VERSION -> { - val comboBox = super.createComboBox(row, index, items).bindEnabled(useApiProperty) - row.checkBox("Use Fabric API").bindSelected(useApiProperty) - row.label("").bindText( - getVersionProperty(MINECRAFT_VERSION).transform { mcVersion -> - mcVersion as FabricMcVersion - val matched = apiVersions.versions.any { mcVersion.version in it.gameVersions } - if (matched) { - "" - } else { - "Unable to match API versions to Minecraft version" - } - }, - ).bindEnabled(useApiProperty).component.foreground = JBColor.YELLOW - comboBox - } - else -> super.createComboBox(row, index, items) - } - } - - override fun getAvailableVersions(versionsAbove: List>): List> { - return when (versionsAbove.size) { - MINECRAFT_VERSION -> mcVersions - LOADER_VERSION -> fabricVersions.loader - YARN_VERSION -> { - val mcVersion = versionsAbove[MINECRAFT_VERSION] as FabricMcVersion - val filteredVersions = fabricVersions.mappings.mapNotNull { mapping -> - mapping.version.takeIf { mapping.gameVersion == mcVersion.version } - } - filteredVersions.ifEmpty { fabricVersions.mappings.map { it.version } } - } - API_VERSION -> { - val mcVersion = versionsAbove[MINECRAFT_VERSION] as FabricMcVersion - val filteredVersions = apiVersions.versions.mapNotNull { api -> - api.version.takeIf { mcVersion.version in api.gameVersions } - } - filteredVersions.ifEmpty { apiVersions.versions.map { it.version } } - } - else -> throw IncorrectOperationException() - } - } - - override fun setupUI(builder: Panel) { - super.setupUI(builder) - if (!showSnapshots) { - updateVersionBox() - } - } - - private fun updateVersionBox() { - val versionBox = getVersionBox(MINECRAFT_VERSION) ?: return - val selectedItem = versionBox.selectedItem - versionBox.setSelectableItems(mcVersions.filter { gameVer -> showSnapshots || gameVer.stable }) - versionBox.selectedItem = selectedItem - } - - override fun setupProject(project: Project) { - super.setupProject(project) - data.putUserData(MC_VERSION_KEY, (getVersion(MINECRAFT_VERSION) as FabricMcVersion).version) - data.putUserData(LOADER_VERSION_KEY, getVersion(LOADER_VERSION) as SemanticVersion) - data.putUserData(YARN_VERSION_KEY, (getVersion(YARN_VERSION) as FabricVersions.YarnVersion).name) - if (useApi) { - data.putUserData(API_VERSION_KEY, getVersion(API_VERSION) as SemanticVersion) - } - data.putUserData(OFFICIAL_MAPPINGS_KEY, useOfficialMappings) - } -} - -class FabricEnvironmentStep(parent: NewProjectWizardStep) : AbstractNewProjectWizardStep(parent) { - private val environmentProperty = propertyGraph.property(Side.NONE) - init { - environmentProperty.transform(Side::name, Side::valueOf).bindStorage("${javaClass.name}.side") - } - private var environment by environmentProperty - - override fun setupUI(builder: Panel) { - with(builder) { - row("Environment:") { - comboBox(listOf("Both", "Client", "Server")) - .bindItem( - environmentProperty.transform({ - when (it) { - Side.CLIENT -> "Client" - Side.SERVER -> "Server" - else -> "Both" - } - }, { - when (it) { - "Client" -> Side.CLIENT - "Server" -> Side.SERVER - else -> Side.NONE - } - },), - ) - } - } - } - - override fun setupProject(project: Project) { - data.putUserData(KEY, environment) - } - - companion object { - val KEY = Key.create("${FabricEnvironmentStep::class.java.name}.environment") - } -} - -class FabricOptionalSettingsStep(parent: NewProjectWizardStep) : AbstractCollapsibleStep(parent) { - override val title = "Optional Settings" - - override fun createStep() = DescriptionStep(this) - .nextStep(::AuthorsStep) - .nextStep(::WebsiteStep) - .nextStep(::RepositoryStep) -} Index: src/main/kotlin/platform/forge/creator/asset-steps.kt =================================================================== --- src/main/kotlin/platform/forge/creator/asset-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/forge/creator/asset-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,180 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.forge.creator - -import com.demonwav.mcdev.creator.addLicense -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.buildsystem.AbstractBuildSystemStep -import com.demonwav.mcdev.creator.buildsystem.AbstractRunBuildSystemStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemPropertiesStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemSupport -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.splitPackage -import com.demonwav.mcdev.creator.step.AbstractLongRunningAssetsStep -import com.demonwav.mcdev.creator.step.AbstractModIdStep -import com.demonwav.mcdev.creator.step.AbstractModNameStep -import com.demonwav.mcdev.creator.step.AbstractReformatFilesStep -import com.demonwav.mcdev.creator.step.AuthorsStep -import com.demonwav.mcdev.creator.step.DescriptionStep -import com.demonwav.mcdev.creator.step.LicenseStep -import com.demonwav.mcdev.creator.step.MainClassStep -import com.demonwav.mcdev.creator.step.UpdateUrlStep -import com.demonwav.mcdev.creator.step.UseMixinsStep -import com.demonwav.mcdev.creator.step.WebsiteStep -import com.demonwav.mcdev.platform.forge.util.ForgeConstants -import com.demonwav.mcdev.platform.forge.util.ForgePackAdditionalData -import com.demonwav.mcdev.platform.forge.util.ForgePackDescriptor -import com.demonwav.mcdev.util.MinecraftTemplates -import com.demonwav.mcdev.util.MinecraftVersions -import com.demonwav.mcdev.util.SemanticVersion -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project - -class ForgeProjectFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating Forge project files" - - override fun setupAssets(project: Project) { - val mcVersion = data.getUserData(ForgeVersionChainStep.MC_VERSION_KEY) ?: return - val forgeVersion = data.getUserData(ForgeVersionChainStep.FORGE_VERSION_KEY) ?: return - val mainClass = data.getUserData(MainClassStep.KEY) ?: return - val (mainPackageName, mainClassName) = splitPackage(mainClass) - val buildSystemProps = findStep>() - val modId = data.getUserData(AbstractModIdStep.KEY) ?: return - val modName = data.getUserData(AbstractModNameStep.KEY) ?: return - val license = data.getUserData(LicenseStep.KEY) ?: return - val description = data.getUserData(DescriptionStep.KEY) ?: "" - val updateUrl = data.getUserData(UpdateUrlStep.KEY) ?: "" - val authors = data.getUserData(AuthorsStep.KEY) ?: emptyList() - val website = data.getUserData(WebsiteStep.KEY) ?: "" - - val nextMcVersion = when (val part = mcVersion.parts.getOrNull(1)) { - // Mimics the code used to get the next Minecraft version in Forge's MDK - // https://github.com/MinecraftForge/MinecraftForge/blob/0ff8a596fc1ef33d4070be89dd5cb4851f93f731/build.gradle#L884 - is SemanticVersion.Companion.VersionPart.ReleasePart -> (part.version + 1).toString() - null -> "?" - else -> part.versionString - } - - val packDescriptor = ForgePackDescriptor.forMcVersion(mcVersion) ?: ForgePackDescriptor.FORMAT_3 - val additionalPackData = ForgePackAdditionalData.forMcVersion(mcVersion) - - assets.addTemplateProperties( - "PACKAGE_NAME" to mainPackageName, - "CLASS_NAME" to mainClassName, - "ARTIFACT_ID" to buildSystemProps.artifactId, - "MOD_ID" to modId, - "MOD_NAME" to modName, - "MOD_VERSION" to buildSystemProps.version, - "SUPPORTS_CLIENT_SIDE_ONLY" to (forgeVersion >= ForgeConstants.CLIENT_ONLY_MANIFEST_VERSION), - "DISPLAY_TEST" to (forgeVersion >= ForgeConstants.DISPLAY_TEST_MANIFEST_VERSION), - "FORGE_SPEC_VERSION" to forgeVersion.parts[0].versionString, - "MC_VERSION" to mcVersion, - "MC_NEXT_VERSION" to "1.$nextMcVersion", - "LICENSE" to license, - "DESCRIPTION" to description, - "PACK_FORMAT" to packDescriptor.format, - "PACK_COMMENT" to packDescriptor.comment, - "FORGE_DATA" to (additionalPackData ?: ""), - ) - - if (updateUrl.isNotBlank()) { - assets.addTemplateProperties("UPDATE_URL" to updateUrl) - } - - if (authors.isNotEmpty()) { - assets.addTemplateProperties("AUTHOR_LIST" to authors.joinToString(", ")) - } - - if (website.isNotBlank()) { - assets.addTemplateProperties("WEBSITE" to website) - } - - val mainClassTemplate = when { - mcVersion >= MinecraftVersions.MC1_20_6 -> MinecraftTemplates.FG3_1_20_6_MAIN_CLASS_TEMPLATE - mcVersion >= MinecraftVersions.MC1_20 -> MinecraftTemplates.FG3_1_20_MAIN_CLASS_TEMPLATE - mcVersion >= MinecraftVersions.MC1_19_3 -> MinecraftTemplates.FG3_1_19_3_MAIN_CLASS_TEMPLATE - mcVersion >= MinecraftVersions.MC1_19 -> MinecraftTemplates.FG3_1_19_MAIN_CLASS_TEMPLATE - mcVersion >= MinecraftVersions.MC1_18 -> MinecraftTemplates.FG3_1_18_MAIN_CLASS_TEMPLATE - mcVersion >= MinecraftVersions.MC1_17 -> MinecraftTemplates.FG3_1_17_MAIN_CLASS_TEMPLATE - else -> MinecraftTemplates.FG3_1_16_MAIN_CLASS_TEMPLATE - } - - assets.addTemplates( - project, - "src/main/java/${mainClass.replace('.', '/')}.java" to mainClassTemplate, - "src/main/resources/pack.mcmeta" to MinecraftTemplates.PACK_MCMETA_TEMPLATE, - "src/main/resources/META-INF/mods.toml" to MinecraftTemplates.MODS_TOML_TEMPLATE, - ) - - val configTemplate = when { - mcVersion >= MinecraftVersions.MC1_21 -> MinecraftTemplates.FG3_1_21_CONFIG_TEMPLATE - mcVersion >= MinecraftVersions.MC1_20 -> MinecraftTemplates.FG3_1_20_CONFIG_TEMPLATE - else -> null - } - - if (configTemplate != null) { - val configPath = if (mainPackageName != null) { - "src/main/java/${mainPackageName.replace('.', '/')}/Config.java" - } else { - "src/main/java/Config.java" - } - assets.addTemplates(project, configPath to configTemplate) - } - - assets.addLicense(project) - } -} - -// Needs to be a separate step from above because of PACKAGE_NAME being different -class ForgeMixinsJsonStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating mixins json" - - override fun setupAssets(project: Project) { - val useMixins = data.getUserData(UseMixinsStep.KEY) ?: false - if (useMixins) { - val modId = data.getUserData(AbstractModIdStep.KEY) ?: return - val buildSystemProps = findStep>() - assets.addTemplateProperties( - "PACKAGE_NAME" to "${buildSystemProps.groupId}.$modId.mixin", - "MOD_ID" to buildSystemProps.artifactId, - ) - val mixinsJsonFile = "src/main/resources/$modId.mixins.json" - assets.addTemplates(project, mixinsJsonFile to MinecraftTemplates.FORGE_MIXINS_JSON_TEMPLATE) - } - } -} - -class ForgeReformatPackDescriptorStep(parent: NewProjectWizardStep) : AbstractReformatFilesStep(parent) { - - override fun addFilesToReformat() { - addFileToReformat("src/main/resources/pack.mcmeta") - } -} - -class ForgeBuildSystemStep(parent: NewProjectWizardStep) : AbstractBuildSystemStep(parent) { - override val platformName = "Forge" -} - -class ForgePostBuildSystemStep( - parent: NewProjectWizardStep, -) : AbstractRunBuildSystemStep(parent, ForgeBuildSystemStep::class.java) { - override val step = BuildSystemSupport.POST_STEP -} Index: src/main/kotlin/platform/forge/creator/gradle-steps.kt =================================================================== --- src/main/kotlin/platform/forge/creator/gradle-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/forge/creator/gradle-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,152 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.forge.creator - -import com.demonwav.mcdev.creator.EmptyStep -import com.demonwav.mcdev.creator.addGradleGitignore -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.buildsystem.AbstractRunGradleTaskStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemPropertiesStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemSupport -import com.demonwav.mcdev.creator.buildsystem.GRADLE_VERSION_KEY -import com.demonwav.mcdev.creator.buildsystem.GradleImportStep -import com.demonwav.mcdev.creator.buildsystem.GradleWrapperStep -import com.demonwav.mcdev.creator.buildsystem.addGradleWrapperProperties -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.gitEnabled -import com.demonwav.mcdev.creator.step.AbstractLongRunningAssetsStep -import com.demonwav.mcdev.creator.step.AbstractModIdStep -import com.demonwav.mcdev.creator.step.AbstractModNameStep -import com.demonwav.mcdev.creator.step.AuthorsStep -import com.demonwav.mcdev.creator.step.DescriptionStep -import com.demonwav.mcdev.creator.step.LicenseStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.creator.step.UseMixinsStep -import com.demonwav.mcdev.util.MinecraftTemplates -import com.demonwav.mcdev.util.MinecraftVersions -import com.demonwav.mcdev.util.SemanticVersion -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.application.WriteAction -import com.intellij.openapi.project.Project -import com.intellij.openapi.vfs.LocalFileSystem -import com.intellij.openapi.vfs.VfsUtil -import com.intellij.util.lang.JavaVersion - -private val fg6WrapperVersion = SemanticVersion.release(8, 4) - -const val MAGIC_RUN_CONFIGS_FILE = ".hello_from_mcdev" - -class ForgeGradleSupport : BuildSystemSupport { - override val preferred = true - - override fun createStep(step: String, parent: NewProjectWizardStep): NewProjectWizardStep { - return when (step) { - BuildSystemSupport.PRE_STEP -> ForgeGradleFilesStep(parent).nextStep(::GradleWrapperStep) - BuildSystemSupport.POST_STEP -> ForgeCompileJavaStep(parent).nextStep(::GradleImportStep) - else -> EmptyStep(parent) - } - } -} - -class ForgeGradleFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating Gradle files" - - override fun setupAssets(project: Project) { - val mcVersion = data.getUserData(ForgeVersionChainStep.MC_VERSION_KEY) ?: return - val forgeVersion = data.getUserData(ForgeVersionChainStep.FORGE_VERSION_KEY) ?: return - val modId = data.getUserData(AbstractModIdStep.KEY) ?: return - val modName = data.getUserData(AbstractModNameStep.KEY) ?: return - val buildSystemProps = findStep>() - val javaVersion = context.projectJdk?.versionString?.let(JavaVersion::parse) - val authors = data.getUserData(AuthorsStep.KEY) ?: emptyList() - val description = data.getUserData(DescriptionStep.KEY) ?: return - val license = data.getUserData(LicenseStep.KEY) ?: return - val useMixins = data.getUserData(UseMixinsStep.KEY) ?: false - val mcNextVersionPart = mcVersion.parts[1] - val mcNextVersion = if (mcNextVersionPart is SemanticVersion.Companion.VersionPart.ReleasePart) { - SemanticVersion.release(1, mcNextVersionPart.version + 1) - } else { - mcVersion - } - - data.putUserData(GRADLE_VERSION_KEY, fg6WrapperVersion) - - assets.addTemplateProperties( - "MOD_ID" to modId, - "MOD_NAME" to modName, - "MC_VERSION" to mcVersion, - "MC_NEXT_VERSION" to mcNextVersion, - "FORGE_VERSION" to forgeVersion, - "FORGE_SPEC_VERSION" to forgeVersion.parts[0].versionString, - "GROUP_ID" to buildSystemProps.groupId, - "ARTIFACT_ID" to buildSystemProps.artifactId, - "MOD_VERSION" to buildSystemProps.version, - "DESCRIPTION" to description, - "AUTHOR_LIST" to authors.joinToString(", "), - "LICENSE" to license.id, - "HAS_DATA" to "true", - "MERGE_RESOURCES_AND_CLASSES" to (mcVersion >= MinecraftVersions.MC1_20_3), - ) - - if (javaVersion != null) { - assets.addTemplateProperties("JAVA_VERSION" to javaVersion.feature) - } - - if (useMixins) { - assets.addTemplateProperties("MIXINS" to "true") - } - - if (forgeVersion >= SemanticVersion.release(39, 0, 88)) { - assets.addTemplateProperties("GAME_TEST_FRAMEWORK" to "true") - } - - assets.addTemplates( - project, - "build.gradle" to MinecraftTemplates.FG3_BUILD_GRADLE_TEMPLATE, - "gradle.properties" to MinecraftTemplates.FG3_GRADLE_PROPERTIES_TEMPLATE, - "settings.gradle" to MinecraftTemplates.FG3_SETTINGS_GRADLE_TEMPLATE, - ) - - assets.addGradleWrapperProperties(project) - - if (gitEnabled) { - assets.addGradleGitignore(project) - } - - WriteAction.runAndWait { - val dir = VfsUtil.createDirectoryIfMissing( - LocalFileSystem.getInstance(), - "${assets.outputDirectory}/.gradle", - ) - ?: throw IllegalStateException("Unable to create .gradle directory") - val file = dir.findOrCreateChildData(this, MAGIC_RUN_CONFIGS_FILE) - val fileContents = buildSystemProps.artifactId + "\n" + - mcVersion + "\n" + - forgeVersion + "\n" + - "genIntellijRuns" - VfsUtil.saveText(file, fileContents) - } - } -} - -class ForgeCompileJavaStep(parent: NewProjectWizardStep) : AbstractRunGradleTaskStep(parent) { - override val task = "compileJava" -} Index: src/main/kotlin/platform/forge/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/forge/creator/ui-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/forge/creator/ui-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,108 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.forge.creator - -import com.demonwav.mcdev.creator.platformtype.ModPlatformStep -import com.demonwav.mcdev.creator.step.AbstractCollapsibleStep -import com.demonwav.mcdev.creator.step.AbstractLatentStep -import com.demonwav.mcdev.creator.step.AbstractMcVersionChainStep -import com.demonwav.mcdev.creator.step.AuthorsStep -import com.demonwav.mcdev.creator.step.DescriptionStep -import com.demonwav.mcdev.creator.step.ForgeStyleModIdStep -import com.demonwav.mcdev.creator.step.LicenseStep -import com.demonwav.mcdev.creator.step.MainClassStep -import com.demonwav.mcdev.creator.step.ModNameStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.creator.step.UpdateUrlStep -import com.demonwav.mcdev.creator.step.UseMixinsStep -import com.demonwav.mcdev.creator.step.WebsiteStep -import com.demonwav.mcdev.platform.forge.version.ForgeVersion -import com.demonwav.mcdev.util.MinecraftVersions -import com.demonwav.mcdev.util.SemanticVersion -import com.demonwav.mcdev.util.asyncIO -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key -import com.intellij.util.IncorrectOperationException -import kotlinx.coroutines.coroutineScope - -private val minSupportedMcVersion = MinecraftVersions.MC1_16_5 - -class ForgePlatformStep(parent: ModPlatformStep) : AbstractLatentStep(parent) { - override val description = "fetch Forge versions" - - override suspend fun computeData() = coroutineScope { - asyncIO { ForgeVersion.downloadData() }.await() - } - - override fun createStep(data: ForgeVersion) = ForgeVersionChainStep(this, data) - .nextStep(::ForgeStyleModIdStep) - .nextStep(::ModNameStep) - .nextStep(::MainClassStep) - .nextStep(::UseMixinsStep) - .nextStep(::LicenseStep) - .nextStep(::ForgeOptionalSettingsStep) - .nextStep(::ForgeBuildSystemStep) - .nextStep(::ForgeProjectFilesStep) - .nextStep(::ForgeMixinsJsonStep) - .nextStep(::ForgePostBuildSystemStep) - .nextStep(::ForgeReformatPackDescriptorStep) - - class Factory : ModPlatformStep.Factory { - override val name = "Forge" - override fun createStep(parent: ModPlatformStep) = ForgePlatformStep(parent) - } -} - -class ForgeVersionChainStep( - parent: NewProjectWizardStep, - private val forgeVersionData: ForgeVersion, -) : AbstractMcVersionChainStep(parent, "Forge Version:") { - companion object { - private const val FORGE_VERSION = 1 - - val MC_VERSION_KEY = Key.create("${ForgeVersionChainStep::class.java}.mcVersion") - val FORGE_VERSION_KEY = Key.create("${ForgeVersionChainStep::class.java}.forgeVersion") - } - - override fun getAvailableVersions(versionsAbove: List>): List> { - return when (versionsAbove.size) { - MINECRAFT_VERSION -> forgeVersionData.sortedMcVersions.filter { it >= minSupportedMcVersion } - FORGE_VERSION -> forgeVersionData.getForgeVersions(versionsAbove[MINECRAFT_VERSION] as SemanticVersion) - else -> throw IncorrectOperationException() - } - } - - override fun setupProject(project: Project) { - super.setupProject(project) - data.putUserData(MC_VERSION_KEY, getVersion(MINECRAFT_VERSION) as SemanticVersion) - data.putUserData(FORGE_VERSION_KEY, getVersion(FORGE_VERSION) as SemanticVersion) - } -} - -class ForgeOptionalSettingsStep(parent: NewProjectWizardStep) : AbstractCollapsibleStep(parent) { - override val title = "Optional Settings" - - override fun createStep() = DescriptionStep(this) - .nextStep(::AuthorsStep) - .nextStep(::WebsiteStep) - .nextStep(::UpdateUrlStep) -} Index: src/main/kotlin/platform/forge/gradle/ForgeRunConfigDataService.kt =================================================================== --- src/main/kotlin/platform/forge/gradle/ForgeRunConfigDataService.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/forge/gradle/ForgeRunConfigDataService.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,221 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2026 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.forge.gradle - -import com.demonwav.mcdev.platform.forge.ForgeModuleType -import com.demonwav.mcdev.platform.forge.creator.MAGIC_RUN_CONFIGS_FILE -import com.demonwav.mcdev.util.SemanticVersion -import com.demonwav.mcdev.util.invokeAndWait -import com.demonwav.mcdev.util.invokeLater -import com.demonwav.mcdev.util.localFile -import com.demonwav.mcdev.util.runGradleTaskAndWait -import com.intellij.execution.RunManager -import com.intellij.execution.RunManagerListener -import com.intellij.execution.RunnerAndConfigurationSettings -import com.intellij.execution.application.ApplicationConfiguration -import com.intellij.execution.application.ApplicationConfigurationType -import com.intellij.openapi.externalSystem.model.DataNode -import com.intellij.openapi.externalSystem.model.ProjectKeys -import com.intellij.openapi.externalSystem.model.project.ProjectData -import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider -import com.intellij.openapi.externalSystem.service.project.manage.AbstractProjectDataService -import com.intellij.openapi.module.Module -import com.intellij.openapi.progress.ProgressIndicator -import com.intellij.openapi.progress.ProgressManager -import com.intellij.openapi.progress.Task -import com.intellij.openapi.project.Project -import com.intellij.openapi.project.guessProjectDir -import com.intellij.openapi.util.Disposer -import com.intellij.openapi.vfs.LocalFileSystem -import java.io.File -import java.nio.file.Files -import java.nio.file.Paths -import java.util.concurrent.atomic.AtomicInteger -import org.jetbrains.plugins.gradle.util.GradleConstants - -class ForgeRunConfigDataService : AbstractProjectDataService() { - - override fun getTargetDataKey() = ProjectKeys.PROJECT - - override fun postProcess( - toImport: Collection>, - projectData: ProjectData?, - project: Project, - modelsProvider: IdeModifiableModelsProvider, - ) { - if (projectData == null || projectData.owner != GradleConstants.SYSTEM_ID) { - return - } - - val baseDir = project.guessProjectDir() ?: return - val baseDirPath = baseDir.localFile.toPath() - val hello = baseDirPath.resolve(Paths.get(".gradle", MAGIC_RUN_CONFIGS_FILE)) - if (!Files.isRegularFile(hello)) { - return - } - - val lines = Files.readAllLines(hello, Charsets.UTF_8) - if (lines.size < 4) { - return - } - - val (moduleName, mcVersion, forgeVersion, task) = lines - val mcVersionParsed = SemanticVersion.parse(mcVersion) - val forgeVersionParsed = SemanticVersion.parse(forgeVersion) - - val moduleMap = modelsProvider.modules.associateBy { it.name } - val module = moduleMap[moduleName] ?: return - - // We've found the module we were expecting, so we can assume the project imported correctly - Files.delete(hello) - - val isPre113 = mcVersionParsed < ForgeModuleType.FG3_MC_VERSION - if (isPre113 && forgeVersionParsed < ForgeModuleType.FG3_FORGE_VERSION) { - manualCreate(project, moduleMap, module) - } else { - genIntellijRuns(project, moduleMap, module, task, hasData = !isPre113) - } - } - - private fun manualCreate( - project: Project, - moduleMap: Map, - module: Module, - ) { - invokeLater { - val mainModule = findMainModule(moduleMap, module) - - val runManager = RunManager.getInstance(project) - val factory = ApplicationConfigurationType.getInstance().configurationFactories.first() - - // Client run config - val clientSettings = runManager.createConfiguration(module.name + " run client", factory) - val runClientConfig = clientSettings.configuration as ApplicationConfiguration - runClientConfig.isAllowRunningInParallel = false - - val runningDir = File(project.basePath, "run") - if (!runningDir.exists()) { - runningDir.mkdir() - } - - runClientConfig.workingDirectory = project.basePath + File.separator + "run" - runClientConfig.mainClassName = "GradleStart" - runClientConfig.setModule(mainModule) - - clientSettings.isActivateToolWindowBeforeRun = true - - clientSettings.storeInLocalWorkspace() - runManager.addConfiguration(clientSettings) - runManager.selectedConfiguration = clientSettings - - // Server run config - val serverSettings = runManager.createConfiguration(module.name + " run server", factory) - val runServerConfig = serverSettings.configuration as ApplicationConfiguration - runServerConfig.isAllowRunningInParallel = false - - runServerConfig.mainClassName = "GradleStartServer" - runServerConfig.programParameters = "nogui" - runServerConfig.workingDirectory = project.basePath + File.separator + "run" - runServerConfig.setModule(mainModule) - - serverSettings.isActivateToolWindowBeforeRun = true - serverSettings.storeInLocalWorkspace() - runManager.addConfiguration(serverSettings) - } - } - - private fun genIntellijRuns( - project: Project, - moduleMap: Map, - module: Module, - task: String, - hasData: Boolean, - ) { - val mainModule = findMainModule(moduleMap, module) - - ProgressManager.getInstance().run( - object : Task.Backgroundable(project, @Suppress("DialogTitleCapitalization") "genIntellijRuns", false) { - override fun run(indicator: ProgressIndicator) { - indicator.isIndeterminate = true - - val projectDir = project.guessProjectDir() ?: return - indicator.text = "Creating run configurations" - indicator.text2 = "Running Gradle task: '$task'" - runGradleTaskAndWait(project, projectDir.localFile.toPath()) { settings -> - settings.taskNames = listOf(task) - } - - cleanupGeneratedRuns(project, mainModule, hasData) - } - }, - ) - } - - private fun cleanupGeneratedRuns(project: Project, module: Module, hasData: Boolean) { - invokeAndWait { - if (!module.isDisposed) { - ForgeRunManagerListener(module, hasData) - } - } - - if (project.isDisposed) { - return - } - - project.guessProjectDir()?.let { dir -> - LocalFileSystem.getInstance().refreshFiles(listOf(dir), true, true, null) - } - } - - private fun findMainModule(moduleMap: Map, module: Module): Module { - return moduleMap[module.name + ".main"] ?: module - } -} - -class ForgeRunManagerListener(private val module: Module, hasData: Boolean) : RunManagerListener { - private val count = AtomicInteger(3) - private val disposable = Disposer.newDisposable() - - init { - module.project.messageBus.connect(disposable).subscribe(RunManagerListener.TOPIC, this) - // If we don't have a data run, don't wait for it - if (!hasData) { - count.decrementAndGet() - } - } - - override fun runConfigurationAdded(settings: RunnerAndConfigurationSettings) { - val config = settings.configuration as? ApplicationConfiguration ?: return - - val postFixes = arrayOf("runClient", "runServer", "runData") - if (postFixes.none { settings.name.endsWith(it) }) { - return - } - - config.isAllowRunningInParallel = false - config.setModule(module) - RunManager.getInstance(module.project).addConfiguration(settings) - - if (count.decrementAndGet() == 0) { - Disposer.dispose(disposable) - } - } -} Index: src/main/kotlin/platform/mcp/fabricloom/FabricLoomDataService.kt =================================================================== --- src/main/kotlin/platform/mcp/fabricloom/FabricLoomDataService.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/mcp/fabricloom/FabricLoomDataService.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,248 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2026 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.mcp.fabricloom - -import com.demonwav.mcdev.asset.MCDevBundle -import com.demonwav.mcdev.platform.fabric.EntryPoint -import com.demonwav.mcdev.platform.fabric.creator.MAGIC_DEFERRED_INIT_FILE -import com.demonwav.mcdev.util.addImplements -import com.demonwav.mcdev.util.addMethod -import com.demonwav.mcdev.util.ifNotBlank -import com.demonwav.mcdev.util.invokeLater -import com.demonwav.mcdev.util.runWriteAction -import com.demonwav.mcdev.util.runWriteTaskInSmartMode -import com.intellij.codeInsight.actions.ReformatCodeProcessor -import com.intellij.codeInsight.generation.OverrideImplementUtil -import com.intellij.ide.util.EditorHelper -import com.intellij.json.psi.JsonArray -import com.intellij.json.psi.JsonElementGenerator -import com.intellij.json.psi.JsonFile -import com.intellij.json.psi.JsonObject -import com.intellij.openapi.externalSystem.model.DataNode -import com.intellij.openapi.externalSystem.model.Key -import com.intellij.openapi.externalSystem.model.project.ProjectData -import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider -import com.intellij.openapi.externalSystem.service.project.manage.AbstractProjectDataService -import com.intellij.openapi.fileEditor.impl.NonProjectFileWritingAccessProvider -import com.intellij.openapi.module.Module -import com.intellij.openapi.project.Project -import com.intellij.openapi.project.guessProjectDir -import com.intellij.openapi.ui.Messages -import com.intellij.openapi.util.text.StringUtil -import com.intellij.openapi.vfs.VfsUtil -import com.intellij.psi.JavaDirectoryService -import com.intellij.psi.JavaPsiFacade -import com.intellij.psi.PsiClass -import com.intellij.psi.PsiManager -import com.intellij.psi.search.GlobalSearchScope -import com.intellij.util.IncorrectOperationException -import java.nio.file.Path -import kotlin.io.path.deleteIfExists -import kotlin.io.path.div -import kotlin.io.path.isRegularFile -import kotlin.io.path.readLines -import org.jetbrains.plugins.gradle.util.GradleConstants - -class FabricLoomDataService : AbstractProjectDataService() { - - override fun getTargetDataKey(): Key = FabricLoomData.KEY - - override fun importData( - toImport: Collection>, - projectData: ProjectData?, - project: Project, - modelsProvider: IdeModifiableModelsProvider, - ) { - // Dummy service to enable platform-side DataNodes cache - } - - override fun postProcess( - toImport: MutableCollection>, - projectData: ProjectData?, - project: Project, - modelsProvider: IdeModifiableModelsProvider - ) { - if (projectData == null || toImport.isEmpty() || projectData.owner != GradleConstants.SYSTEM_ID) { - return - } - - deferredProjectInit(project) - } - - private fun deferredProjectInit(project: Project) { - val baseDir = project.guessProjectDir()?.toNioPath() - ?: return - val deferredInitFile = baseDir / ".gradle" / MAGIC_DEFERRED_INIT_FILE - if (!deferredInitFile.isRegularFile()) { - return - } - - val lines = deferredInitFile.readLines() - if (lines.size < 4) { - return - } - - val (rawAuthors, website, repo, rawEntrypoints) = lines - - val authors = rawAuthors.ifNotBlank { it.split(',') } ?: emptyList() - - val entrypoints = rawEntrypoints.split(';').map { rawEntrypoint -> - val (category, type, clazzName, interfaceName) = rawEntrypoint.split(',') - EntryPoint(category, EntryPoint.Type.valueOf(type), clazzName, interfaceName) - } - - project.runWriteTaskInSmartMode { - fixupFabricModJson(project, baseDir, authors, website, repo, entrypoints) - createEntryPoints(project, entrypoints) - deferredInitFile.deleteIfExists() - } - } - - private fun fixupFabricModJson( - project: Project, - baseDir: Path, - authors: List, - website: String, - repo: String, - entryPoints: List - ) { - val fabricModJsonFile = - VfsUtil.findFile(baseDir.resolve(Path.of("src", "main", "resources", "fabric.mod.json")), true) - ?: return - val jsonFile = PsiManager.getInstance(project).findFile(fabricModJsonFile) as? JsonFile ?: return - val json = jsonFile.topLevelValue as? JsonObject ?: return - val generator = JsonElementGenerator(project) - - NonProjectFileWritingAccessProvider.allowWriting(listOf(fabricModJsonFile)) - jsonFile.runWriteAction { - (json.findProperty("authors")?.value as? JsonArray)?.let { authorsArray -> - for (i in authors.indices) { - if (i != 0) { - authorsArray.addBefore(generator.createComma(), authorsArray.lastChild) - } - authorsArray.addBefore(generator.createStringLiteral(authors[i]), authorsArray.lastChild) - } - } - - (json.findProperty("contact")?.value as? JsonObject)?.let { contactObject -> - val properties = mutableListOf>() - if (website.isNotBlank()) { - properties += "website" to website - } - if (repo.isNotBlank()) { - properties += "repo" to repo - } - for (i in properties.indices) { - if (i != 0) { - contactObject.addBefore(generator.createComma(), contactObject.lastChild) - } - val key = StringUtil.escapeStringCharacters(properties[i].first) - val value = "\"" + StringUtil.escapeStringCharacters(properties[i].second) + "\"" - contactObject.addBefore(generator.createProperty(key, value), contactObject.lastChild) - } - } - - (json.findProperty("entrypoints")?.value as? JsonObject)?.let { entryPointsObject -> - val entryPointsByCategory = entryPoints - .groupBy { it.category } - .asSequence() - .sortedBy { it.key } - .toList() - for (i in entryPointsByCategory.indices) { - val entryPointCategory = entryPointsByCategory[i] - if (i != 0) { - entryPointsObject.addBefore(generator.createComma(), entryPointsObject.lastChild) - } - val values = generator.createValue("[]") - for (j in entryPointCategory.value.indices) { - if (j != 0) { - values.addBefore(generator.createComma(), values.lastChild) - } - val entryPointReference = entryPointCategory.value[j].computeReference(project) - val value = generator.createStringLiteral(entryPointReference) - values.addBefore(value, values.lastChild) - } - val key = StringUtil.escapeStringCharacters(entryPointCategory.key) - val prop = generator.createProperty(key, "[]") - prop.value?.replace(values) - entryPointsObject.addBefore(prop, entryPointsObject.lastChild) - } - } - - ReformatCodeProcessor(project, jsonFile, null, false).run() - } - } - - private fun createEntryPoints(project: Project, entryPoints: List) { - val root = project.guessProjectDir() ?: return - val psiManager = PsiManager.getInstance(project) - - val generatedClasses = mutableSetOf() - - for (entryPoint in entryPoints) { - // find the class, and create it if it doesn't exist - val clazz = JavaPsiFacade.getInstance(project).findClass( - entryPoint.className, - GlobalSearchScope.projectScope(project), - ) ?: run { - val packageName = entryPoint.className.substringBeforeLast('.', missingDelimiterValue = "") - val className = entryPoint.className.substringAfterLast('.') - - val dir = VfsUtil.createDirectoryIfMissing(root, "src/main/java/${packageName.replace('.', '/')}") - val psiDir = psiManager.findDirectory(dir) ?: return@run null - try { - JavaDirectoryService.getInstance().createClass(psiDir, className) - } catch (e: IncorrectOperationException) { - invokeLater { - val message = MCDevBundle( - "intention.error.cannot.create.class.message", - className, - e.localizedMessage, - ) - Messages.showErrorDialog( - project, - message, - MCDevBundle("intention.error.cannot.create.class.title"), - ) - } - return - } - } ?: continue - - clazz.containingFile.runWriteAction { - clazz.addImplements(entryPoint.interfaceName) - - val methodsToImplement = OverrideImplementUtil.getMethodsToOverrideImplement(clazz, true) - val methods = OverrideImplementUtil.overrideOrImplementMethodCandidates(clazz, methodsToImplement, true) - for (method in methods) { - clazz.addMethod(method) - } - } - - generatedClasses += clazz - } - - for (clazz in generatedClasses) { - ReformatCodeProcessor(project, clazz.containingFile, null, false).run() - EditorHelper.openInEditor(clazz) - } - } -} Index: src/main/kotlin/platform/neoforge/creator/asset-steps.kt =================================================================== --- src/main/kotlin/platform/neoforge/creator/asset-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/neoforge/creator/asset-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,175 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.neoforge.creator - -import com.demonwav.mcdev.creator.addLicense -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.buildsystem.AbstractBuildSystemStep -import com.demonwav.mcdev.creator.buildsystem.AbstractRunBuildSystemStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemPropertiesStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemSupport -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.splitPackage -import com.demonwav.mcdev.creator.step.AbstractLongRunningAssetsStep -import com.demonwav.mcdev.creator.step.AbstractModIdStep -import com.demonwav.mcdev.creator.step.AbstractModNameStep -import com.demonwav.mcdev.creator.step.AbstractReformatFilesStep -import com.demonwav.mcdev.creator.step.AuthorsStep -import com.demonwav.mcdev.creator.step.DescriptionStep -import com.demonwav.mcdev.creator.step.LicenseStep -import com.demonwav.mcdev.creator.step.MainClassStep -import com.demonwav.mcdev.creator.step.UpdateUrlStep -import com.demonwav.mcdev.creator.step.UseMixinsStep -import com.demonwav.mcdev.creator.step.WebsiteStep -import com.demonwav.mcdev.platform.forge.util.ForgePackDescriptor -import com.demonwav.mcdev.util.MinecraftTemplates -import com.demonwav.mcdev.util.MinecraftVersions -import com.demonwav.mcdev.util.SemanticVersion -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project - -class NeoForgeProjectFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating NeoForge project files" - - override fun setupAssets(project: Project) { - val mcVersion = data.getUserData(NeoForgeVersionChainStep.MC_VERSION_KEY) ?: return - val forgeVersion = data.getUserData(NeoForgeVersionChainStep.NEOFORGE_VERSION_KEY) ?: return - val mainClass = data.getUserData(MainClassStep.KEY) ?: return - val (mainPackageName, mainClassName) = splitPackage(mainClass) - val buildSystemProps = findStep>() - val modId = data.getUserData(AbstractModIdStep.KEY) ?: return - val modName = data.getUserData(AbstractModNameStep.KEY) ?: return - val license = data.getUserData(LicenseStep.KEY) ?: return - val description = data.getUserData(DescriptionStep.KEY) ?: "" - val updateUrl = data.getUserData(UpdateUrlStep.KEY) ?: "" - val authors = data.getUserData(AuthorsStep.KEY) ?: emptyList() - val website = data.getUserData(WebsiteStep.KEY) ?: "" - val useMixins = data.getUserData(UseMixinsStep.KEY) ?: false - - val nextMcVersion = when (val part = mcVersion.parts.getOrNull(1)) { - // Extract the major version and increment (1.20.4 -> 1.21), as is done manually in the MDK - is SemanticVersion.Companion.VersionPart.ReleasePart -> (part.version + 1).toString() - null -> "?" - else -> part.versionString - } - - val packDescriptor = ForgePackDescriptor.forMcVersion(mcVersion) ?: ForgePackDescriptor.FORMAT_3 - - assets.addTemplateProperties( - "PACKAGE_NAME" to mainPackageName, - "CLASS_NAME" to mainClassName, - "ARTIFACT_ID" to buildSystemProps.artifactId, - "MOD_ID" to modId, - "MOD_NAME" to modName, - "MOD_VERSION" to buildSystemProps.version, - "NEOFORGE_SPEC_VERSION" to forgeVersion.parts[0].versionString, - "MC_VERSION" to mcVersion, - "MC_NEXT_VERSION" to "1.$nextMcVersion", - "LICENSE" to license, - "DESCRIPTION" to description, - "MIXIN_CONFIG" to if (useMixins) "$modId.mixins.json" else null, - "PACK_FORMAT" to packDescriptor.format, - "PACK_COMMENT" to packDescriptor.comment, - ) - - if (updateUrl.isNotBlank()) { - assets.addTemplateProperties("UPDATE_URL" to updateUrl) - } - - if (authors.isNotEmpty()) { - assets.addTemplateProperties("AUTHOR_LIST" to authors.joinToString(", ")) - } - - if (website.isNotBlank()) { - assets.addTemplateProperties("WEBSITE" to website) - } - - val mainClassTemplate = when { - mcVersion >= MinecraftVersions.MC1_20_5 -> MinecraftTemplates.NEOFORGE_1_20_5_MAIN_CLASS_TEMPLATE - else -> MinecraftTemplates.NEOFORGE_MAIN_CLASS_TEMPLATE - } - - val (modManifestName, modManifestTemplate) = when { - mcVersion >= MinecraftVersions.MC1_20_5 -> - "neoforge.mods.toml" to MinecraftTemplates.NEOFORGE_NEOFORGE_MODS_TOML_TEMPLATE - - else -> "mods.toml" to MinecraftTemplates.NEOFORGE_MODS_TOML_TEMPLATE - } - - assets.addTemplates( - project, - "src/main/java/${mainClass.replace('.', '/')}.java" to mainClassTemplate, - "src/main/resources/pack.mcmeta" to MinecraftTemplates.NEOFORGE_PACK_MCMETA_TEMPLATE, - "src/main/resources/META-INF/$modManifestName" to modManifestTemplate, - ) - - val configClassTemplate = when { - mcVersion >= MinecraftVersions.MC1_21 -> MinecraftTemplates.NEOFORGE_1_21_CONFIG_TEMPLATE - mcVersion >= MinecraftVersions.MC1_20_5 -> MinecraftTemplates.NEOFORGE_1_20_5_CONFIG_TEMPLATE - else -> MinecraftTemplates.NEOFORGE_CONFIG_TEMPLATE - } - - val configPath = if (mainPackageName != null) { - "src/main/java/${mainPackageName.replace('.', '/')}/Config.java" - } else { - "src/main/java/Config.java" - } - assets.addTemplates(project, configPath to configClassTemplate) - - assets.addLicense(project) - } -} - -// Needs to be a separate step from above because of PACKAGE_NAME being different -class NeoForgeMixinsJsonStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating mixins json" - - override fun setupAssets(project: Project) { - val useMixins = data.getUserData(UseMixinsStep.KEY) ?: false - if (useMixins) { - val modId = data.getUserData(AbstractModIdStep.KEY) ?: return - val buildSystemProps = findStep>() - assets.addTemplateProperties( - "PACKAGE_NAME" to "${buildSystemProps.groupId}.$modId.mixin", - "MOD_ID" to buildSystemProps.artifactId, - ) - val mixinsJsonFile = "src/main/resources/$modId.mixins.json" - assets.addTemplates(project, mixinsJsonFile to MinecraftTemplates.NEOFORGE_MIXINS_JSON_TEMPLATE) - } - } -} - -class NeoForgeReformatPackDescriptorStep(parent: NewProjectWizardStep) : AbstractReformatFilesStep(parent) { - - override fun addFilesToReformat() { - addFileToReformat("src/main/resources/pack.mcmeta") - } -} - -class NeoForgeBuildSystemStep(parent: NewProjectWizardStep) : AbstractBuildSystemStep(parent) { - override val platformName = "NeoForge" -} - -class NeoForgePostBuildSystemStep( - parent: NewProjectWizardStep, -) : AbstractRunBuildSystemStep(parent, NeoForgeBuildSystemStep::class.java) { - override val step = BuildSystemSupport.POST_STEP -} Index: src/main/kotlin/platform/neoforge/creator/gradle-steps.kt =================================================================== --- src/main/kotlin/platform/neoforge/creator/gradle-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/neoforge/creator/gradle-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,162 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.neoforge.creator - -import com.demonwav.mcdev.creator.EmptyStep -import com.demonwav.mcdev.creator.ParchmentStep -import com.demonwav.mcdev.creator.addGradleGitignore -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.buildsystem.AbstractRunGradleTaskStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemPropertiesStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemSupport -import com.demonwav.mcdev.creator.buildsystem.GRADLE_VERSION_KEY -import com.demonwav.mcdev.creator.buildsystem.GradleImportStep -import com.demonwav.mcdev.creator.buildsystem.GradleWrapperStep -import com.demonwav.mcdev.creator.buildsystem.addGradleWrapperProperties -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.gitEnabled -import com.demonwav.mcdev.creator.step.AbstractLongRunningAssetsStep -import com.demonwav.mcdev.creator.step.AbstractModIdStep -import com.demonwav.mcdev.creator.step.AbstractModNameStep -import com.demonwav.mcdev.creator.step.AuthorsStep -import com.demonwav.mcdev.creator.step.DescriptionStep -import com.demonwav.mcdev.creator.step.LicenseStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.util.MinecraftTemplates -import com.demonwav.mcdev.util.MinecraftVersions -import com.demonwav.mcdev.util.SemanticVersion -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.application.WriteAction -import com.intellij.openapi.project.Project -import com.intellij.openapi.vfs.LocalFileSystem -import com.intellij.openapi.vfs.VfsUtil -import com.intellij.util.lang.JavaVersion - -private val ngWrapperVersion = SemanticVersion.release(8, 7) - -const val MAGIC_RUN_CONFIGS_FILE = ".hello_from_mcdev" - -class NeoForgeGradleSupport : BuildSystemSupport { - override val preferred = true - - override fun createStep(step: String, parent: NewProjectWizardStep): NewProjectWizardStep { - return when (step) { - BuildSystemSupport.PRE_STEP -> NeoForgeGradleFilesStep(parent).nextStep(::GradleWrapperStep) - BuildSystemSupport.POST_STEP -> NeoForgeCompileJavaStep(parent).nextStep(::GradleImportStep) - else -> EmptyStep(parent) - } - } -} - -class NeoForgeGradleFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating Gradle files" - - override fun setupAssets(project: Project) { - val mcVersion = data.getUserData(NeoForgeVersionChainStep.MC_VERSION_KEY) ?: return - val neoforgeVersion = data.getUserData(NeoForgeVersionChainStep.NEOFORGE_VERSION_KEY) ?: return - val neogradleVersion = data.getUserData(NeoForgeVersionChainStep.NEOGRADLE_VERSION_KEY) ?: return - val modId = data.getUserData(AbstractModIdStep.KEY) ?: return - val modName = data.getUserData(AbstractModNameStep.KEY) ?: return - val buildSystemProps = findStep>() - val javaVersion = context.projectJdk?.versionString?.let(JavaVersion::parse) - val authors = data.getUserData(AuthorsStep.KEY) ?: emptyList() - val description = data.getUserData(DescriptionStep.KEY) ?: return - val license = data.getUserData(LicenseStep.KEY) ?: return - val parchment = findStep() - val mcNextVersionPart = mcVersion.parts[1] - val mcNextVersion = if (mcNextVersionPart is SemanticVersion.Companion.VersionPart.ReleasePart) { - SemanticVersion.release(1, mcNextVersionPart.version + 1) - } else { - mcVersion - } - val loaderVersion = when { - mcVersion < MinecraftVersions.MC1_21 -> "2" - else -> "4" - } - - data.putUserData(GRADLE_VERSION_KEY, ngWrapperVersion) - - assets.addTemplateProperties( - "MOD_ID" to modId, - "MOD_NAME" to modName, - "MC_VERSION" to mcVersion, - "MC_NEXT_VERSION" to mcNextVersion, - "NEOFORGE_VERSION" to neoforgeVersion, - "NEOFORGE_SPEC_VERSION" to neoforgeVersion.parts[0].versionString, - "LOADER_VERSION" to loaderVersion, - "NEOGRADLE_VERSION" to neogradleVersion, - "GROUP_ID" to buildSystemProps.groupId, - "ARTIFACT_ID" to buildSystemProps.artifactId, - "MOD_VERSION" to buildSystemProps.version, - "DESCRIPTION" to description, - "AUTHOR_LIST" to authors.joinToString(", "), - "LICENSE" to license.id, - "HAS_DATA" to "true" - ) - - if (parchment.useParchment) { - assets.addTemplateProperties( - "PARCHMENT_MC_VERSION" to parchment.parchmentVersion?.mcVersion.toString(), - "PARCHMENT_VERSION" to parchment.parchmentVersion?.parchmentVersion, - ) - } - - if (javaVersion != null) { - assets.addTemplateProperties("JAVA_VERSION" to javaVersion.feature) - } - - val buildGradleTemplate = when { - mcVersion >= MinecraftVersions.MC1_20_5 -> MinecraftTemplates.NEOFORGE_1_20_5_BUILD_GRADLE_TEMPLATE - else -> MinecraftTemplates.NEOFORGE_BUILD_GRADLE_TEMPLATE - } - - assets.addTemplates( - project, - "build.gradle" to buildGradleTemplate, - "gradle.properties" to MinecraftTemplates.NEOFORGE_GRADLE_PROPERTIES_TEMPLATE, - "settings.gradle" to MinecraftTemplates.NEOFORGE_SETTINGS_GRADLE_TEMPLATE, - ) - - assets.addGradleWrapperProperties(project) - - if (gitEnabled) { - assets.addGradleGitignore(project) - } - - WriteAction.runAndWait { - val dir = VfsUtil.createDirectoryIfMissing( - LocalFileSystem.getInstance(), - "${assets.outputDirectory}/.gradle", - ) - ?: throw IllegalStateException("Unable to create .gradle directory") - val file = dir.findOrCreateChildData(this, MAGIC_RUN_CONFIGS_FILE) - val fileContents = buildSystemProps.artifactId + "\n" + - mcVersion + "\n" + - neoforgeVersion + "\n" + - "genIntellijRuns" - VfsUtil.saveText(file, fileContents) - } - } -} - -class NeoForgeCompileJavaStep(parent: NewProjectWizardStep) : AbstractRunGradleTaskStep(parent) { - override val task = "compileJava" -} Index: src/main/kotlin/platform/neoforge/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/neoforge/creator/ui-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/neoforge/creator/ui-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,126 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.neoforge.creator - -import com.demonwav.mcdev.creator.ParchmentStep -import com.demonwav.mcdev.creator.platformtype.ModPlatformStep -import com.demonwav.mcdev.creator.step.AbstractCollapsibleStep -import com.demonwav.mcdev.creator.step.AbstractLatentStep -import com.demonwav.mcdev.creator.step.AbstractMcVersionChainStep -import com.demonwav.mcdev.creator.step.AuthorsStep -import com.demonwav.mcdev.creator.step.DescriptionStep -import com.demonwav.mcdev.creator.step.ForgeStyleModIdStep -import com.demonwav.mcdev.creator.step.LicenseStep -import com.demonwav.mcdev.creator.step.MainClassStep -import com.demonwav.mcdev.creator.step.ModNameStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.creator.step.UpdateUrlStep -import com.demonwav.mcdev.creator.step.UseMixinsStep -import com.demonwav.mcdev.creator.step.WebsiteStep -import com.demonwav.mcdev.platform.neoforge.version.NeoForgeVersion -import com.demonwav.mcdev.platform.neoforge.version.NeoGradleVersion -import com.demonwav.mcdev.util.MinecraftVersions -import com.demonwav.mcdev.util.SemanticVersion -import com.demonwav.mcdev.util.asyncIO -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key -import com.intellij.util.IncorrectOperationException -import kotlinx.coroutines.coroutineScope - -private val minSupportedMcVersion = MinecraftVersions.MC1_20_2 - -class NeoForgePlatformStep(parent: ModPlatformStep) : - AbstractLatentStep>(parent) { - override val description = "fetch NeoForge versions" - - override suspend fun computeData() = coroutineScope { - val neoforgeJob = asyncIO { NeoForgeVersion.downloadData() } - val neogradleJob = asyncIO { NeoGradleVersion.downloadData() } - val neoforge = neoforgeJob.await() ?: return@coroutineScope null - val neogradle = neogradleJob.await() ?: return@coroutineScope null - neoforge to neogradle - } - - override fun createStep(data: Pair): NewProjectWizardStep = - NeoForgeVersionChainStep(this, data.first, data.second) - .nextStep(::ForgeStyleModIdStep) - .nextStep(::ModNameStep) - .nextStep(::MainClassStep) - .nextStep(::UseMixinsStep) - .nextStep(::LicenseStep) - .nextStep(::NeoForgeOptionalSettingsStep) - .nextStep(::NeoForgeBuildSystemStep) - .nextStep(::NeoForgeProjectFilesStep) - .nextStep(::NeoForgeMixinsJsonStep) - .nextStep(::NeoForgePostBuildSystemStep) - .nextStep(::NeoForgeReformatPackDescriptorStep) - - class Factory : ModPlatformStep.Factory { - override val name = "NeoForge" - override fun createStep(parent: ModPlatformStep) = NeoForgePlatformStep(parent) - } -} - -class NeoForgeVersionChainStep( - parent: NewProjectWizardStep, - private val neoforgeVersionData: NeoForgeVersion, - private val neogradleVersionData: NeoGradleVersion, -) : AbstractMcVersionChainStep(parent, "NeoForge Version:", "NeoGradle Version:") { - companion object { - private const val NEOFORGE_VERSION = 1 - private const val NEOGRADLE_VERSION = 2 - - val MC_VERSION_KEY = Key.create("${NeoForgeVersionChainStep::class.java}.mcVersion") - val NEOFORGE_VERSION_KEY = - Key.create("${NeoForgeVersionChainStep::class.java}.neoforgeVersion") - val NEOGRADLE_VERSION_KEY = - Key.create("${NeoForgeVersionChainStep::class.java}.neogradleVersion") - } - - override fun getAvailableVersions(versionsAbove: List>): List> { - return when (versionsAbove.size) { - MINECRAFT_VERSION -> neoforgeVersionData.sortedMcVersions.filter { it >= minSupportedMcVersion } - NEOFORGE_VERSION -> - neoforgeVersionData.getNeoForgeVersions(versionsAbove[MINECRAFT_VERSION] as SemanticVersion) - - NEOGRADLE_VERSION -> neogradleVersionData.versions - else -> throw IncorrectOperationException() - } - } - - override fun setupProject(project: Project) { - super.setupProject(project) - data.putUserData(MC_VERSION_KEY, getVersion(MINECRAFT_VERSION) as SemanticVersion) - data.putUserData(NEOFORGE_VERSION_KEY, getVersion(NEOFORGE_VERSION) as SemanticVersion) - data.putUserData(NEOGRADLE_VERSION_KEY, getVersion(NEOGRADLE_VERSION) as SemanticVersion) - } -} - -class NeoForgeOptionalSettingsStep(parent: NewProjectWizardStep) : AbstractCollapsibleStep(parent) { - override val title = "Optional Settings" - - override fun createStep() = DescriptionStep(this) - .nextStep(::AuthorsStep) - .nextStep(::WebsiteStep) - .nextStep(::UpdateUrlStep) - .nextStep(::ParchmentStep) -} Index: src/main/kotlin/platform/neoforge/gradle/NeoForgeRunConfigDataService.kt =================================================================== --- src/main/kotlin/platform/neoforge/gradle/NeoForgeRunConfigDataService.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/neoforge/gradle/NeoForgeRunConfigDataService.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,157 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2026 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.neoforge.gradle - -import com.demonwav.mcdev.platform.neoforge.creator.MAGIC_RUN_CONFIGS_FILE -import com.demonwav.mcdev.util.invokeAndWait -import com.demonwav.mcdev.util.localFile -import com.demonwav.mcdev.util.runGradleTaskAndWait -import com.intellij.execution.RunManager -import com.intellij.execution.RunManagerListener -import com.intellij.execution.RunnerAndConfigurationSettings -import com.intellij.execution.application.ApplicationConfiguration -import com.intellij.openapi.externalSystem.model.DataNode -import com.intellij.openapi.externalSystem.model.ProjectKeys -import com.intellij.openapi.externalSystem.model.project.ProjectData -import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider -import com.intellij.openapi.externalSystem.service.project.manage.AbstractProjectDataService -import com.intellij.openapi.module.Module -import com.intellij.openapi.progress.ProgressIndicator -import com.intellij.openapi.progress.ProgressManager -import com.intellij.openapi.progress.Task -import com.intellij.openapi.project.Project -import com.intellij.openapi.project.guessProjectDir -import com.intellij.openapi.util.Disposer -import com.intellij.openapi.vfs.LocalFileSystem -import java.nio.file.Files -import java.nio.file.Paths -import java.util.concurrent.atomic.AtomicInteger -import org.jetbrains.plugins.gradle.util.GradleConstants - -class NeoForgeRunConfigDataService : AbstractProjectDataService() { - - override fun getTargetDataKey() = ProjectKeys.PROJECT - - override fun postProcess( - toImport: Collection>, - projectData: ProjectData?, - project: Project, - modelsProvider: IdeModifiableModelsProvider, - ) { - if (projectData == null || projectData.owner != GradleConstants.SYSTEM_ID) { - return - } - - val baseDir = project.guessProjectDir() ?: return - val baseDirPath = baseDir.localFile.toPath() - val hello = baseDirPath.resolve(Paths.get(".gradle", MAGIC_RUN_CONFIGS_FILE)) - if (!Files.isRegularFile(hello)) { - return - } - - val lines = Files.readAllLines(hello, Charsets.UTF_8) - if (lines.size < 4) { - return - } - - val (moduleName, _, _, task) = lines - - val moduleMap = modelsProvider.modules.associateBy { it.name } - val module = moduleMap[moduleName] ?: return - - // We've found the module we were expecting, so we can assume the project imported correctly - Files.delete(hello) - - genIntellijRuns(project, moduleMap, module, task) - } - - private fun genIntellijRuns( - project: Project, - moduleMap: Map, - module: Module, - task: String, - ) { - val mainModule = findMainModule(moduleMap, module) - - ProgressManager.getInstance().run( - object : Task.Backgroundable(project, @Suppress("DialogTitleCapitalization") "genIntellijRuns", false) { - override fun run(indicator: ProgressIndicator) { - indicator.isIndeterminate = true - - val projectDir = project.guessProjectDir() ?: return - indicator.text = "Creating run configurations" - indicator.text2 = "Running Gradle task: '$task'" - runGradleTaskAndWait(project, projectDir.localFile.toPath()) { settings -> - settings.taskNames = listOf(task) - } - - cleanupGeneratedRuns(project, mainModule) - } - }, - ) - } - - private fun cleanupGeneratedRuns(project: Project, module: Module) { - invokeAndWait { - if (!module.isDisposed) { - NeoForgeRunManagerListener(module, true) - } - } - - project.guessProjectDir()?.let { dir -> - LocalFileSystem.getInstance().refreshFiles(listOf(dir), true, true, null) - } - } - - private fun findMainModule(moduleMap: Map, module: Module): Module { - return moduleMap[module.name + ".main"] ?: module - } -} - -class NeoForgeRunManagerListener(private val module: Module, hasData: Boolean) : RunManagerListener { - private val count = AtomicInteger(3) - private val disposable = Disposer.newDisposable() - - init { - module.project.messageBus.connect(disposable).subscribe(RunManagerListener.TOPIC, this) - // If we don't have a data run, don't wait for it - if (!hasData) { - count.decrementAndGet() - } - } - - override fun runConfigurationAdded(settings: RunnerAndConfigurationSettings) { - val config = settings.configuration as? ApplicationConfiguration ?: return - - val postFixes = arrayOf("runClient", "runServer", "runData") - if (postFixes.none { settings.name.endsWith(it) }) { - return - } - - config.isAllowRunningInParallel = false - config.setModule(module) - RunManager.getInstance(module.project).addConfiguration(settings) - - if (count.decrementAndGet() == 0) { - Disposer.dispose(disposable) - } - } -} Index: src/main/kotlin/platform/sponge/creator/asset-steps.kt =================================================================== --- src/main/kotlin/platform/sponge/creator/asset-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/sponge/creator/asset-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,67 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.sponge.creator - -import com.demonwav.mcdev.creator.addLicense -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.buildsystem.AbstractBuildSystemStep -import com.demonwav.mcdev.creator.buildsystem.AbstractRunBuildSystemStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemPropertiesStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemSupport -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.splitPackage -import com.demonwav.mcdev.creator.step.AbstractLongRunningAssetsStep -import com.demonwav.mcdev.creator.step.MainClassStep -import com.demonwav.mcdev.util.MinecraftTemplates -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project - -class SpongeProjectFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating project files" - - override fun setupAssets(project: Project) { - val buildSystemProps = findStep>() - val mainClass = data.getUserData(MainClassStep.KEY) ?: return - val (packageName, className) = splitPackage(mainClass) - - assets.addTemplateProperties( - "PLUGIN_ID" to buildSystemProps.artifactId, - "PACKAGE" to packageName, - "CLASS_NAME" to className, - ) - val mainClassFile = "src/main/java/${mainClass.replace('.', '/')}.java" - assets.addTemplates( - project, - mainClassFile to MinecraftTemplates.SPONGE8_MAIN_CLASS_TEMPLATE, - ) - assets.addLicense(project) - } -} - -class SpongeBuildSystemStep(parent: NewProjectWizardStep) : AbstractBuildSystemStep(parent) { - override val platformName = "Sponge" -} - -class SpongePostBuildSystemStep( - parent: NewProjectWizardStep, -) : AbstractRunBuildSystemStep(parent, SpongeBuildSystemStep::class.java) { - override val step = BuildSystemSupport.POST_STEP -} Index: src/main/kotlin/platform/sponge/creator/gradle-steps.kt =================================================================== --- src/main/kotlin/platform/sponge/creator/gradle-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/sponge/creator/gradle-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,125 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.sponge.creator - -import com.demonwav.mcdev.creator.EmptyStep -import com.demonwav.mcdev.creator.JdkProjectSetupFinalizer -import com.demonwav.mcdev.creator.addGradleGitignore -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.buildsystem.BuildSystemPropertiesStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemSupport -import com.demonwav.mcdev.creator.buildsystem.GradleImportStep -import com.demonwav.mcdev.creator.buildsystem.GradleWrapperStep -import com.demonwav.mcdev.creator.buildsystem.ReformatBuildGradleStep -import com.demonwav.mcdev.creator.buildsystem.addGradleWrapperProperties -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.gitEnabled -import com.demonwav.mcdev.creator.step.AbstractLongRunningAssetsStep -import com.demonwav.mcdev.creator.step.AbstractModIdStep -import com.demonwav.mcdev.creator.step.AbstractModNameStep -import com.demonwav.mcdev.creator.step.AuthorsStep -import com.demonwav.mcdev.creator.step.DependStep -import com.demonwav.mcdev.creator.step.DescriptionStep -import com.demonwav.mcdev.creator.step.LicenseStep -import com.demonwav.mcdev.creator.step.MainClassStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.creator.step.WebsiteStep -import com.demonwav.mcdev.util.MinecraftTemplates -import com.intellij.ide.starters.local.GeneratorEmptyDirectory -import com.intellij.ide.wizard.NewProjectWizardBaseData -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project - -class SpongeGradleSupport : BuildSystemSupport { - override val preferred = true - - override fun createStep(step: String, parent: NewProjectWizardStep): NewProjectWizardStep { - return when (step) { - BuildSystemSupport.PRE_STEP -> SpongeGradleFilesStep(parent).nextStep(::GradleWrapperStep) - BuildSystemSupport.POST_STEP -> SpongeGradleImportStep(parent).nextStep(::ReformatBuildGradleStep) - else -> EmptyStep(parent) - } - } -} - -class SpongeGradleFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating Gradle files" - - override fun setupAssets(project: Project) { - val buildSystemProps = findStep>() - val javaVersion = findStep().preferredJdk.ordinal - val spongeVersion = data.getUserData(SpongeApiVersionStep.KEY) ?: return - val license = data.getUserData(LicenseStep.KEY) ?: return - val pluginId = data.getUserData(AbstractModIdStep.KEY) ?: return - val pluginName = data.getUserData(AbstractModNameStep.KEY) ?: return - val mainClass = data.getUserData(MainClassStep.KEY) ?: return - val description = data.getUserData(DescriptionStep.KEY) ?: "" - val website = data.getUserData(WebsiteStep.KEY) ?: "" - val authors = data.getUserData(AuthorsStep.KEY) ?: emptyList() - val dependencies = data.getUserData(DependStep.KEY) ?: emptyList() - val baseData = data.getUserData(NewProjectWizardBaseData.KEY) ?: return - - assets.addTemplateProperties( - "GROUP_ID" to buildSystemProps.groupId, - "ARTIFACT_ID" to buildSystemProps.artifactId, - "PLUGIN_ID" to pluginId, - "PLUGIN_VERSION" to buildSystemProps.version, - "JAVA_VERSION" to javaVersion, - "SPONGEAPI_VERSION" to spongeVersion, - "LICENSE" to license.id, - "PLUGIN_NAME" to pluginName, - "MAIN_CLASS" to mainClass, - "AUTHORS" to authors, - "DEPENDENCIES" to dependencies, - "PROJECT_NAME" to baseData.name, - ) - - if (description.isNotBlank()) { - assets.addTemplateProperties("DESCRIPTION" to description) - } - - if (website.isNotBlank()) { - assets.addTemplateProperties("WEBSITE" to website) - } - - assets.addTemplates( - project, - "build.gradle.kts" to MinecraftTemplates.SPONGE8_BUILD_GRADLE_TEMPLATE, - "settings.gradle.kts" to MinecraftTemplates.SPONGE8_SETTINGS_GRADLE_TEMPLATE, - "gradle.properties" to MinecraftTemplates.SPONGE8_GRADLE_PROPERTIES_TEMPLATE, - ) - - assets.addGradleWrapperProperties(project) - - assets.addAssets( - GeneratorEmptyDirectory("src/main/java"), - GeneratorEmptyDirectory("src/main/resources"), - ) - - if (gitEnabled) { - assets.addGradleGitignore(project) - } - } -} - -class SpongeGradleImportStep(parent: NewProjectWizardStep) : GradleImportStep(parent) { - override val additionalRunTasks = listOf("runServer") -} Index: src/main/kotlin/platform/sponge/creator/maven-steps.kt =================================================================== --- src/main/kotlin/platform/sponge/creator/maven-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/sponge/creator/maven-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,138 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2026 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.sponge.creator - -import com.demonwav.mcdev.creator.EmptyStep -import com.demonwav.mcdev.creator.JdkProjectSetupFinalizer -import com.demonwav.mcdev.creator.addLicense -import com.demonwav.mcdev.creator.addMavenGitignore -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.buildsystem.AbstractPatchPomStep -import com.demonwav.mcdev.creator.buildsystem.BuildDependency -import com.demonwav.mcdev.creator.buildsystem.BuildRepository -import com.demonwav.mcdev.creator.buildsystem.BuildSystemSupport -import com.demonwav.mcdev.creator.buildsystem.BuildSystemType -import com.demonwav.mcdev.creator.buildsystem.MavenImportStep -import com.demonwav.mcdev.creator.buildsystem.ReformatPomStep -import com.demonwav.mcdev.creator.buildsystem.addDefaultMavenProperties -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.gitEnabled -import com.demonwav.mcdev.creator.step.AbstractLongRunningAssetsStep -import com.demonwav.mcdev.creator.step.AbstractModIdStep -import com.demonwav.mcdev.creator.step.AbstractModNameStep -import com.demonwav.mcdev.creator.step.AuthorsStep -import com.demonwav.mcdev.creator.step.DependStep -import com.demonwav.mcdev.creator.step.DescriptionStep -import com.demonwav.mcdev.creator.step.LicenseStep -import com.demonwav.mcdev.creator.step.MainClassStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.creator.step.WebsiteStep -import com.demonwav.mcdev.util.MinecraftTemplates -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project -import com.intellij.psi.xml.XmlTag -import java.util.EnumSet -import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel - -class SpongeMavenSupport : BuildSystemSupport { - override fun createStep(step: String, parent: NewProjectWizardStep): NewProjectWizardStep { - return when (step) { - BuildSystemSupport.PRE_STEP -> SpongeMavenFilesStep(parent).nextStep(::SpongePatchPomStep) - BuildSystemSupport.POST_STEP -> SpongeMavenProjectFilesStep(parent) - .nextStep(::MavenImportStep) - .nextStep(::ReformatPomStep) - else -> EmptyStep(parent) - } - } -} - -class SpongeMavenFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating Maven files" - - override fun setupAssets(project: Project) { - assets.addDefaultMavenProperties() - val javaVersion = findStep().preferredJdk.ordinal - assets.addTemplateProperties("JAVA_VERSION" to javaVersion) - assets.addTemplates(project, "pom.xml" to MinecraftTemplates.SPONGE_POM_TEMPLATE) - if (gitEnabled) { - assets.addMavenGitignore(project) - } - } -} - -class SpongeMavenProjectFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating Maven project files" - - override fun setupAssets(project: Project) { - val mainClass = data.getUserData(MainClassStep.KEY) ?: return - val spongeApiVersion = data.getUserData(SpongeApiVersionStep.KEY) ?: return - val license = data.getUserData(LicenseStep.KEY) ?: return - val pluginId = data.getUserData(AbstractModIdStep.KEY) ?: return - val pluginName = data.getUserData(AbstractModNameStep.KEY) ?: return - val description = data.getUserData(DescriptionStep.KEY) ?: "" - val website = data.getUserData(WebsiteStep.KEY) ?: "" - val authors = data.getUserData(AuthorsStep.KEY) ?: emptyList() - val dependencies = data.getUserData(DependStep.KEY) ?: emptyList() - - assets.addTemplateProperties( - "PLUGIN_ID" to pluginId, - "VERSION_PLACEHOLDER" to $$"${version}", - "SPONGEAPI_VERSION" to spongeApiVersion, - "LICENSE" to license.id, - "PLUGIN_NAME" to pluginName, - "MAIN_CLASS" to mainClass, - "DESCRIPTION" to description, - "WEBSITE" to website, - "AUTHORS" to authors, - "DEPENDENCIES" to dependencies, - ) - assets.addTemplates( - project, - "src/main/resources/META-INF/sponge_plugins.json" to MinecraftTemplates.SPONGE8_PLUGINS_JSON_TEMPLATE, - ) - assets.addLicense(project) - } -} - -class SpongePatchPomStep(parent: NewProjectWizardStep) : AbstractPatchPomStep(parent) { - override fun patchPom(model: MavenDomProjectModel, root: XmlTag) { - super.patchPom(model, root) - val spongeApiVersion = data.getUserData(SpongeApiVersionStep.KEY) ?: return - setupDependencies( - model, - listOf( - BuildRepository( - "spongepowered-repo", - "https://repo.spongepowered.org/maven/", - buildSystems = EnumSet.of(BuildSystemType.MAVEN), - ), - ), - listOf( - BuildDependency( - "org.spongepowered", - "spongeapi", - spongeApiVersion.toString(), - mavenScope = "provided", - ), - ), - ) - } -} Index: src/main/kotlin/platform/sponge/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/sponge/creator/ui-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/sponge/creator/ui-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,118 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.sponge.creator - -import com.demonwav.mcdev.creator.JdkProjectSetupFinalizer -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.platformtype.PluginPlatformStep -import com.demonwav.mcdev.creator.step.AbstractCollapsibleStep -import com.demonwav.mcdev.creator.step.AbstractLatentStep -import com.demonwav.mcdev.creator.step.AbstractSelectVersionStep -import com.demonwav.mcdev.creator.step.AuthorsStep -import com.demonwav.mcdev.creator.step.DependStep -import com.demonwav.mcdev.creator.step.DescriptionStep -import com.demonwav.mcdev.creator.step.LicenseStep -import com.demonwav.mcdev.creator.step.MainClassStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.creator.step.PluginIdStep -import com.demonwav.mcdev.creator.step.PluginNameStep -import com.demonwav.mcdev.creator.step.WebsiteStep -import com.demonwav.mcdev.platform.sponge.SpongeVersion -import com.demonwav.mcdev.platform.sponge.util.SpongeConstants -import com.demonwav.mcdev.util.SemanticVersion -import com.demonwav.mcdev.util.onShown -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project -import com.intellij.openapi.projectRoots.JavaSdkVersion -import com.intellij.openapi.util.Key -import com.intellij.ui.dsl.builder.Panel - -private val MIN_SPONGE_VERSION = SpongeConstants.API8 - -class SpongePlatformStep(parent: PluginPlatformStep) : AbstractLatentStep(parent) { - override val description = "download Sponge versions" - - override suspend fun computeData() = SpongeVersion.downloadData() - - override fun createStep(data: SpongeVersion) = SpongeApiVersionStep(this, data) - .nextStep(::PluginIdStep) - .nextStep(::PluginNameStep) - .nextStep(::MainClassStep) - .nextStep(::LicenseStep) - .nextStep(::SpongeOptionalSettingsStep) - .nextStep(::SpongeBuildSystemStep) - .nextStep(::SpongeProjectFilesStep) - .nextStep(::SpongePostBuildSystemStep) - - class Factory : PluginPlatformStep.Factory { - override val name = "Sponge" - - override fun createStep(parent: PluginPlatformStep) = SpongePlatformStep(parent) - } -} - -class SpongeApiVersionStep( - parent: NewProjectWizardStep, - data: SpongeVersion, -) : AbstractSelectVersionStep( - parent, - data.versions.keys.mapNotNull(SemanticVersion::tryParse).filter { it >= MIN_SPONGE_VERSION }, -) { - override val label = "Sponge API Version:" - - override fun setupUI(builder: Panel) { - super.setupUI(builder) - versionProperty.afterChange { - applyJdkVersion() - } - versionBox.onShown { - applyJdkVersion() - } - } - - override fun setupProject(project: Project) { - data.putUserData(KEY, SemanticVersion.tryParse(version)) - applyJdkVersion() - } - - private fun applyJdkVersion() { - SemanticVersion.tryParse(version)?.let { version -> - val preferredJdk = when { - version >= SpongeConstants.API9 -> JavaSdkVersion.JDK_17 - else -> JavaSdkVersion.JDK_1_8 - } - findStep().setPreferredJdk(preferredJdk, "Sponge $version") - } - } - - companion object { - val KEY = Key.create("${SpongeApiVersionStep::class.java.name}.version") - } -} - -class SpongeOptionalSettingsStep(parent: NewProjectWizardStep) : AbstractCollapsibleStep(parent) { - override val title = "Optional Settings" - - override fun createStep() = DescriptionStep(this) - .nextStep(::AuthorsStep) - .nextStep(::WebsiteStep) - .nextStep(::DependStep) -} Index: src/main/kotlin/platform/velocity/creator/asset-steps.kt =================================================================== --- src/main/kotlin/platform/velocity/creator/asset-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/velocity/creator/asset-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,173 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.velocity.creator - -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.buildsystem.AbstractBuildSystemStep -import com.demonwav.mcdev.creator.buildsystem.AbstractRunBuildSystemStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemPropertiesStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemSupport -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.splitPackage -import com.demonwav.mcdev.creator.step.AbstractLongRunningAssetsStep -import com.demonwav.mcdev.creator.step.AbstractLongRunningStep -import com.demonwav.mcdev.creator.step.AbstractModIdStep -import com.demonwav.mcdev.creator.step.AbstractModNameStep -import com.demonwav.mcdev.creator.step.AuthorsStep -import com.demonwav.mcdev.creator.step.DependStep -import com.demonwav.mcdev.creator.step.DescriptionStep -import com.demonwav.mcdev.creator.step.MainClassStep -import com.demonwav.mcdev.creator.step.WebsiteStep -import com.demonwav.mcdev.platform.velocity.util.VelocityConstants -import com.demonwav.mcdev.util.MinecraftTemplates -import com.demonwav.mcdev.util.runWriteAction -import com.demonwav.mcdev.util.runWriteTaskInSmartMode -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.fileEditor.impl.NonProjectFileWritingAccessProvider -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.text.StringUtil -import com.intellij.openapi.vfs.VfsUtil -import com.intellij.psi.JavaPsiFacade -import com.intellij.psi.PsiJavaFile -import com.intellij.psi.PsiManager -import com.intellij.psi.codeStyle.CodeStyleManager -import java.nio.file.Path - -class VelocityProjectFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating project files" - - override fun setupAssets(project: Project) { - val mainClass = data.getUserData(MainClassStep.KEY) ?: return - val dependencies = data.getUserData(DependStep.KEY) ?: emptyList() - val (packageName, className) = splitPackage(mainClass) - val version = data.getUserData(VelocityVersionStep.KEY) ?: return - - assets.addTemplateProperties( - "PACKAGE" to packageName, - "CLASS_NAME" to className, - ) - - if (dependencies.isNotEmpty()) { - assets.addTemplateProperties( - "HAS_DEPENDENCIES" to "true", - ) - } - - val template = if (version < VelocityConstants.API_2 || - (version >= VelocityConstants.API_3 && version < VelocityConstants.API_4) - ) { - MinecraftTemplates.VELOCITY_MAIN_CLASS_TEMPLATE // API 1 and 3 - } else { - MinecraftTemplates.VELOCITY_MAIN_CLASS_V2_TEMPLATE // API 2 and 4 (4+ maybe ?) - } - - assets.addTemplates( - project, - "src/main/java/${mainClass.replace('.', '/')}.java" to template, - ) - } -} - -class VelocityModifyMainClassStep( - parent: NewProjectWizardStep, - private val isGradle: Boolean, -) : AbstractLongRunningStep(parent) { - override val description = "Patching main class" - - override fun perform(project: Project) { - val buildSystemProps = findStep>() - val pluginId = data.getUserData(AbstractModIdStep.KEY) ?: return - val pluginName = data.getUserData(AbstractModNameStep.KEY) ?: return - val mainClassName = data.getUserData(MainClassStep.KEY) ?: return - val mainClassFile = "${context.projectFileDirectory}/src/main/java/${mainClassName.replace('.', '/')}.java" - val description = data.getUserData(DescriptionStep.KEY) ?: "" - val website = data.getUserData(WebsiteStep.KEY) ?: "" - val authors = data.getUserData(AuthorsStep.KEY) ?: emptyList() - val dependencies = data.getUserData(DependStep.KEY) ?: emptyList() - - project.runWriteTaskInSmartMode { - NonProjectFileWritingAccessProvider.disableChecksDuring { - val mainClassVirtualFile = VfsUtil.findFile(Path.of(mainClassFile), true) - ?: return@disableChecksDuring - val mainClassPsi = PsiManager.getInstance(project).findFile(mainClassVirtualFile) as? PsiJavaFile - ?: return@disableChecksDuring - - val psiClass = mainClassPsi.classes[0] - val annotation = buildString { - append("@Plugin(") - append("\nid = ${literal(pluginId)}") - append(",\nname = ${literal(pluginName)}") - - if (isGradle) { - append(",\nversion = BuildConstants.VERSION") - } else { - append(",\nversion = \"${buildSystemProps.version}\"") - } - - if (description.isNotBlank()) { - append(",\ndescription = ${literal(description)}") - } - - if (website.isNotBlank()) { - append(",\nurl = ${literal(website)}") - } - - if (authors.isNotEmpty()) { - append(",\nauthors = {${authors.joinToString(", ", transform = ::literal)}}") - } - - if (dependencies.isNotEmpty()) { - val deps = dependencies.joinToString(",\n") { "@Dependency(id = ${literal(it)})" } - append(",\ndependencies = {\n$deps\n}") - } - - append("\n)") - } - - val factory = JavaPsiFacade.getElementFactory(project) - val pluginAnnotation = factory.createAnnotationFromText(annotation, null) - - mainClassPsi.runWriteAction { - psiClass.modifierList?.let { it.addBefore(pluginAnnotation, it.firstChild) } - CodeStyleManager.getInstance(project).reformat(psiClass) - } - } - } - } - - private fun literal(text: String?): String { - if (text == null) { - return "\"\"" - } - return '"' + StringUtil.escapeStringCharacters(text) + '"' - } -} - -class VelocityBuildSystemStep(parent: NewProjectWizardStep) : AbstractBuildSystemStep(parent) { - override val platformName = "Velocity" -} - -class VelocityPostBuildSystemStep(parent: NewProjectWizardStep) : AbstractRunBuildSystemStep( - parent, - VelocityBuildSystemStep::class.java, -) { - override val step = BuildSystemSupport.POST_STEP -} Index: src/main/kotlin/platform/velocity/creator/gradle-steps.kt =================================================================== --- src/main/kotlin/platform/velocity/creator/gradle-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/velocity/creator/gradle-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,143 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.velocity.creator - -import com.demonwav.mcdev.creator.EmptyStep -import com.demonwav.mcdev.creator.JdkProjectSetupFinalizer -import com.demonwav.mcdev.creator.addGradleGitignore -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.buildsystem.AbstractPatchGradleFilesStep -import com.demonwav.mcdev.creator.buildsystem.BuildDependency -import com.demonwav.mcdev.creator.buildsystem.BuildRepository -import com.demonwav.mcdev.creator.buildsystem.BuildSystemPropertiesStep -import com.demonwav.mcdev.creator.buildsystem.BuildSystemSupport -import com.demonwav.mcdev.creator.buildsystem.GradleImportStep -import com.demonwav.mcdev.creator.buildsystem.GradlePlugin -import com.demonwav.mcdev.creator.buildsystem.GradleWrapperStep -import com.demonwav.mcdev.creator.buildsystem.ReformatBuildGradleStep -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.gitEnabled -import com.demonwav.mcdev.creator.splitPackage -import com.demonwav.mcdev.creator.step.AbstractLongRunningAssetsStep -import com.demonwav.mcdev.creator.step.MainClassStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.platform.velocity.util.VelocityConstants -import com.demonwav.mcdev.util.MinecraftTemplates -import com.intellij.ide.wizard.NewProjectWizardBaseData.Companion.baseData -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project - -class VelocityGradleSupport : BuildSystemSupport { - override fun createStep(step: String, parent: NewProjectWizardStep): NewProjectWizardStep { - return when (step) { - BuildSystemSupport.PRE_STEP -> VelocityGradleFilesStep(parent) - .nextStep(::VelocityPatchGradleFilesStep) - .nextStep(::GradleWrapperStep) - BuildSystemSupport.POST_STEP -> GradleImportStep(parent) - .nextStep(::ReformatBuildGradleStep) - .nextStep { VelocityModifyMainClassStep(it, true) } - else -> EmptyStep(parent) - } - } -} - -class VelocityGradleFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating Gradle files" - - override fun setupAssets(project: Project) { - val projectName = baseData!!.name - val buildSystemProps = findStep>() - val javaVersion = findStep().preferredJdk.ordinal - val mainClass = data.getUserData(MainClassStep.KEY) ?: return - val (mainPackage, _) = splitPackage(mainClass) - - assets.addTemplateProperties( - "GROUP_ID" to buildSystemProps.groupId, - "ARTIFACT_ID" to buildSystemProps.artifactId, - "PLUGIN_ID" to buildSystemProps.artifactId, - "PLUGIN_VERSION" to buildSystemProps.version, - "JAVA_VERSION" to javaVersion, - "PROJECT_NAME" to projectName, - "PACKAGE" to mainPackage, - ) - - val buildConstantsJava = if (mainPackage != null) { - "src/main/templates/${mainPackage.replace('.', '/')}/BuildConstants.java" - } else { - "src/main/templates/BuildConstants.java" - } - assets.addTemplates( - project, - "build.gradle" to MinecraftTemplates.VELOCITY_BUILD_GRADLE_TEMPLATE, - "gradle.properties" to MinecraftTemplates.VELOCITY_GRADLE_PROPERTIES_TEMPLATE, - "settings.gradle" to MinecraftTemplates.VELOCITY_SETTINGS_GRADLE_TEMPLATE, - buildConstantsJava to MinecraftTemplates.VELOCITY_BUILD_CONSTANTS_TEMPLATE, - ) - - if (gitEnabled) { - assets.addGradleGitignore(project) - } - } -} - -class VelocityPatchGradleFilesStep(parent: NewProjectWizardStep) : AbstractPatchGradleFilesStep(parent) { - override fun patch(project: Project, gradleFiles: GradleFiles) { - val velocityApiVersion = data.getUserData(VelocityVersionStep.KEY) ?: return - - addPlugins( - project, - gradleFiles.buildGradle, - listOf( - GradlePlugin("org.jetbrains.gradle.plugin.idea-ext", "1.0.1"), - ), - ) - addRepositories( - project, - gradleFiles.buildGradle, - listOf( - BuildRepository( - "papermc-repo", - "https://repo.papermc.io/repository/maven-public/", - ), - ), - ) - val annotationArtifactId = - if (velocityApiVersion >= VelocityConstants.API_4) "velocity-annotation-processor" else "velocity-api" - addDependencies( - project, - gradleFiles.buildGradle, - listOf( - BuildDependency( - "com.velocitypowered", - "velocity-api", - velocityApiVersion.toString(), - gradleConfiguration = "compileOnly", - ), - BuildDependency( - "com.velocitypowered", - annotationArtifactId, - velocityApiVersion.toString(), - gradleConfiguration = "annotationProcessor", - ), - ), - ) - } -} Index: src/main/kotlin/platform/velocity/creator/maven-steps.kt =================================================================== --- src/main/kotlin/platform/velocity/creator/maven-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/velocity/creator/maven-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,108 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.velocity.creator - -import com.demonwav.mcdev.creator.EmptyStep -import com.demonwav.mcdev.creator.JdkProjectSetupFinalizer -import com.demonwav.mcdev.creator.addMavenGitignore -import com.demonwav.mcdev.creator.addTemplates -import com.demonwav.mcdev.creator.buildsystem.AbstractPatchPomStep -import com.demonwav.mcdev.creator.buildsystem.BuildDependency -import com.demonwav.mcdev.creator.buildsystem.BuildRepository -import com.demonwav.mcdev.creator.buildsystem.BuildSystemSupport -import com.demonwav.mcdev.creator.buildsystem.MavenImportStep -import com.demonwav.mcdev.creator.buildsystem.ReformatPomStep -import com.demonwav.mcdev.creator.buildsystem.addDefaultMavenProperties -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.gitEnabled -import com.demonwav.mcdev.creator.step.AbstractLongRunningAssetsStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.platform.velocity.util.VelocityConstants -import com.demonwav.mcdev.util.MinecraftTemplates -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project -import com.intellij.psi.xml.XmlTag -import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel - -class VelocityMavenSupport : BuildSystemSupport { - override fun createStep(step: String, parent: NewProjectWizardStep): NewProjectWizardStep { - return when (step) { - BuildSystemSupport.PRE_STEP -> VelocityMavenFilesStep(parent).nextStep(::VelocityPatchPomStep) - BuildSystemSupport.POST_STEP -> MavenImportStep(parent) - .nextStep(::ReformatPomStep) - .nextStep { VelocityModifyMainClassStep(it, false) } - else -> EmptyStep(parent) - } - } -} - -class VelocityMavenFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAssetsStep(parent) { - override val description = "Creating Maven files" - - override fun setupAssets(project: Project) { - assets.addDefaultMavenProperties() - val javaVersion = findStep().preferredJdk.ordinal - assets.addTemplateProperties( - "JAVA_VERSION" to javaVersion, - ) - assets.addTemplates( - project, - "pom.xml" to MinecraftTemplates.VELOCITY_POM_TEMPLATE, - ) - if (gitEnabled) { - assets.addMavenGitignore(project) - } - } -} - -class VelocityPatchPomStep(parent: NewProjectWizardStep) : AbstractPatchPomStep(parent) { - override fun patchPom(model: MavenDomProjectModel, root: XmlTag) { - super.patchPom(model, root) - - val velocityApiVersion = data.getUserData(VelocityVersionStep.KEY) ?: return - - val annotationArtifactId = - if (velocityApiVersion >= VelocityConstants.API_4) "velocity-annotation-processor" else "velocity-api" - setupDependencies( - model, - listOf( - BuildRepository( - "papermc-repo", - "https://repo.papermc.io/repository/maven-public/", - ), - ), - listOf( - BuildDependency( - "com.velocitypowered", - "velocity-api", - velocityApiVersion.toString(), - mavenScope = "provided", - ), - BuildDependency( - "com.velocitypowered", - annotationArtifactId, - velocityApiVersion.toString(), - mavenScope = if (velocityApiVersion >= VelocityConstants.API_4) "provided" else null, - ), - ), - ) - } -} Index: src/main/kotlin/platform/velocity/creator/ui-steps.kt =================================================================== --- src/main/kotlin/platform/velocity/creator/ui-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/kotlin/platform/velocity/creator/ui-steps.kt (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,118 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2025 minecraft-dev - * - * This program 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 3.0 only. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.platform.velocity.creator - -import com.demonwav.mcdev.creator.JdkProjectSetupFinalizer -import com.demonwav.mcdev.creator.PlatformVersion -import com.demonwav.mcdev.creator.findStep -import com.demonwav.mcdev.creator.getVersionSelector -import com.demonwav.mcdev.creator.platformtype.PluginPlatformStep -import com.demonwav.mcdev.creator.step.AbstractCollapsibleStep -import com.demonwav.mcdev.creator.step.AbstractLatentStep -import com.demonwav.mcdev.creator.step.AbstractSelectVersionStep -import com.demonwav.mcdev.creator.step.AuthorsStep -import com.demonwav.mcdev.creator.step.DependStep -import com.demonwav.mcdev.creator.step.DescriptionStep -import com.demonwav.mcdev.creator.step.MainClassStep -import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep -import com.demonwav.mcdev.creator.step.PluginIdStep -import com.demonwav.mcdev.creator.step.PluginNameStep -import com.demonwav.mcdev.creator.step.WebsiteStep -import com.demonwav.mcdev.platform.PlatformType -import com.demonwav.mcdev.util.SemanticVersion -import com.demonwav.mcdev.util.asyncIO -import com.demonwav.mcdev.util.onShown -import com.intellij.ide.wizard.NewProjectWizardStep -import com.intellij.openapi.project.Project -import com.intellij.openapi.projectRoots.JavaSdkVersion -import com.intellij.openapi.util.Key -import com.intellij.ui.dsl.builder.Panel -import kotlinx.coroutines.coroutineScope - -class VelocityPlatformStep(parent: PluginPlatformStep) : AbstractLatentStep(parent) { - override val description = "download Velocity versions" - - override suspend fun computeData() = coroutineScope { - asyncIO { getVersionSelector(PlatformType.VELOCITY) }.await() - } - - override fun createStep(data: PlatformVersion) = - VelocityVersionStep(this, data.versions.mapNotNull(SemanticVersion::tryParse)) - .nextStep(::PluginIdStep) - .nextStep(::PluginNameStep) - .nextStep(::MainClassStep) - .nextStep(::VelocityOptionalSettingsStep) - .nextStep(::VelocityBuildSystemStep) - .nextStep(::VelocityProjectFilesStep) - .nextStep(::VelocityPostBuildSystemStep) - - class Factory : PluginPlatformStep.Factory { - override val name = "Velocity" - - override fun createStep(parent: PluginPlatformStep) = VelocityPlatformStep(parent) - } -} - -class VelocityVersionStep( - parent: NewProjectWizardStep, - versions: List, -) : AbstractSelectVersionStep(parent, versions) { - override val label = "Velocity Version:" - - override fun setupUI(builder: Panel) { - super.setupUI(builder) - versionProperty.afterChange { - applyJdkVersion() - } - versionBox.onShown { - applyJdkVersion() - } - } - - override fun setupProject(project: Project) { - data.putUserData(KEY, SemanticVersion.tryParse(version)) - applyJdkVersion() - } - - private fun applyJdkVersion() { - SemanticVersion.tryParse(version)?.let { version -> - val preferredJdk = when { - version >= SemanticVersion.release(3, 3) -> JavaSdkVersion.JDK_17 - version >= SemanticVersion.release(3) -> JavaSdkVersion.JDK_11 - else -> JavaSdkVersion.JDK_1_8 - } - findStep().setPreferredJdk(preferredJdk, "Velocity $version") - } - } - - companion object { - val KEY = Key.create("${VelocityVersionStep::class.java.name}.version") - } -} - -class VelocityOptionalSettingsStep(parent: NewProjectWizardStep) : AbstractCollapsibleStep(parent) { - override val title = "Optional Settings" - - override fun createStep() = DescriptionStep(this) - .nextStep(::AuthorsStep) - .nextStep(::WebsiteStep) - .nextStep(::DependStep) -} Index: src/main/resources/META-INF/mcdev-kotlin.xml =================================================================== --- src/main/resources/META-INF/mcdev-kotlin.xml (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/META-INF/mcdev-kotlin.xml (revision 5b58533d2538785c831cb16e30c6c4cf0e696381) @@ -3,7 +3,7 @@ https://mcdev.io/ - Copyright (C) 2025 minecraft-dev + Copyright (C) 2026 minecraft-dev This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -20,8 +20,6 @@ - - Index: src/main/resources/META-INF/plugin.xml =================================================================== --- src/main/resources/META-INF/plugin.xml (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/META-INF/plugin.xml (revision 5b58533d2538785c831cb16e30c6c4cf0e696381) @@ -62,32 +62,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -352,7 +269,6 @@ - @@ -574,9 +490,6 @@ - - @@ -589,9 +502,6 @@ - - @@ -615,7 +525,6 @@ - Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_build.gradle.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,51 +0,0 @@ -plugins { - id "architectury-plugin" version "3.4-SNAPSHOT" - id "dev.architectury.loom" version "1.3-SNAPSHOT" apply false -} - -architectury { - minecraft = rootProject.minecraft_version -} - -subprojects { - apply plugin: "dev.architectury.loom" - - loom { - silentMojangMappingsLicense() - } - - dependencies { - minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" - // The following line declares the mojmap mappings, you may use other mappings as well - mappings loom.officialMojangMappings() - // The following line declares the yarn mappings you may select this one as well. - // mappings "net.fabricmc:yarn:@YARN_MAPPINGS@:v2" - } -} - -allprojects { - apply plugin: "java" - apply plugin: "architectury-plugin" - apply plugin: "maven-publish" - - archivesBaseName = rootProject.archives_base_name - version = rootProject.mod_version - group = rootProject.maven_group - - repositories { - // Add repositories to retrieve artifacts from in here. - // You should only use this when depending on other mods because - // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. - // See https://docs.gradle.org/current/userguide/declaring_repositories.html - // for more information about repositories. - } - - tasks.withType(JavaCompile) { - options.encoding = "UTF-8" - options.release.set(${JAVA_VERSION}) - } - - java { - withSourcesJar() - } -} Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_build.gradle.html =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new build.gradle file for Architectury projects.

- - Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_common_build.gradle.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_common_build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_common_build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,27 +0,0 @@ -architectury { - common(rootProject.enabled_platforms.split(",")) -} - -dependencies { - // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies - // Do NOT use other classes from fabric loader - modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" -#if (${ARCHITECTURY_API}) - // Remove the next line if you don't want to depend on the API - modApi "${ARCHITECTURY_GROUP}:architectury:${rootProject.architectury_version}" -#end -} - -publishing { - publications { - mavenCommon(MavenPublication) { - artifactId = rootProject.archives_base_name - from components.java - } - } - - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - // Add repositories to publish to here. - } -} Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_common_build.gradle.html =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_common_build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_common_build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new build.gradle file for Common Architectury projects.

- - Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_common_main_class.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_common_main_class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_common_main_class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,10 +0,0 @@ -package ${PACKAGE_NAME}; - -public class ${CLASS_NAME} -{ - public static final String MOD_ID = "${MOD_ID}"; - - public static void init() { - - } -} Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_common_main_class.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_common_main_class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_common_main_class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new main class for Common Architectury projects.

- - Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_common_mixins.json.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_common_mixins.json.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_common_mixins.json.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,13 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "${PACKAGE_NAME}.mixin", - "compatibilityLevel": "JAVA_${JAVA_VERSION}", - "mixins": [ - ], - "client": [ - ], - "injectors": { - "defaultRequire": 1 - } -} Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_common_mixins.json.html =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_common_mixins.json.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_common_mixins.json.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new modid.mixins.json file for Common Architectury projects.

- - Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_build.gradle.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,80 +0,0 @@ -plugins { - id "com.github.johnrengelman.shadow" version "7.1.2" -} - -architectury { - platformSetupLoomIde() - fabric() -} - -configurations { - common - shadowCommon // Don't use shadow from the shadow plugin since it *excludes* files. - compileClasspath.extendsFrom common - runtimeClasspath.extendsFrom common - developmentFabric.extendsFrom common -} - -dependencies { - modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" -#if (${FABRIC_API}) - modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" -#end -#if (${ARCHITECTURY_API}) - // Remove the next line if you don't want to depend on the API - modApi "${ARCHITECTURY_GROUP}:architectury-fabric:${rootProject.architectury_version}" -#end - - common(project(path: ":common", configuration: "namedElements")) { transitive false } - shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } -} - -processResources { - inputs.property "version", project.version - - filesMatching("fabric.mod.json") { - expand "version": project.version - } -} - -shadowJar { - configurations = [project.configurations.shadowCommon] - archiveClassifier = "dev-shadow" -} - -remapJar { - injectAccessWidener = true - inputFile.set(shadowJar.archiveFile) - dependsOn shadowJar - archiveClassifier = null -} - -jar { - archiveClassifier.set("dev") -} - -sourcesJar { - def commonSources = project(":common").sourcesJar - dependsOn commonSources - from commonSources.archiveFile.map { zipTree(it) } -} - -components.java { - withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { - skip() - } -} - -publishing { - publications { - mavenFabric(MavenPublication) { - artifactId = rootProject.archives_base_name + "-" + project.name - from components.java - } - } - - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - // Add repositories to publish to here. - } -} Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_build.gradle.html =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new build.gradle file for Fabric Architectury projects.

- - Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_main_class.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_main_class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_main_class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,11 +0,0 @@ -package ${PACKAGE_NAME}.fabric; - -import ${PACKAGE_NAME}.${CLASS_NAME}; -import net.fabricmc.api.ModInitializer; - -public class ${CLASS_NAME}Fabric implements ModInitializer { - @Override - public void onInitialize() { - ${CLASS_NAME}.init(); - } -} \ No newline at end of file Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_main_class.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_main_class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_main_class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new main class for Fabric Architectury projects.

- - Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_mixins.json.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_mixins.json.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_mixins.json.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,13 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "${PACKAGE_NAME}.fabric.mixin", - "compatibilityLevel": "JAVA_${JAVA_VERSION}", - "mixins": [ - ], - "client": [ - ], - "injectors": { - "defaultRequire": 1 - } -} Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_mixins.json.html =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_mixins.json.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_mixins.json.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new modid.mixins.json file for Fabric Architectury projects.

- - Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_mod.json.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_mod.json.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_mod.json.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,37 +0,0 @@ -#set ( $d = "$" ) -{ - "schemaVersion": 1, - "id": "${MOD_ID}", - "version": "${d}{version}", - - "name": "${MOD_NAME}", - "description": "${MOD_DESCRIPTION}", - "authors": [], - "contact": {}, - - "license": "${LICENSE}", - "icon": "icon.png", - - "environment": "${MOD_ENVIRONMENT}", - "entrypoints": { - "main": [ - "${FABRIC_CLASS_NAME_FQN}" - ] - }, -#if (${MIXINS}) - "mixins": [ - "${MOD_ID}.mixins.json", - "${MOD_ID}-common.mixins.json" - ], -#end - "depends": { - "fabricloader": ">=${FABRIC_LOADER_VERSION}", -#if (${FABRIC_API}) - "fabric": ">=${FABRIC_API_VERSION}", -#end -#if (${ARCHITECTURY_API}) - "architectury": ">=${ARCHITECTURY_API_VERSION}", -#end - "minecraft": ">=${MC_VERSION}" - } -} Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_mod.json.html =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_mod.json.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_fabric_mod.json.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new fabric.mod.json for Fabric Architectury projects.

- - Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_build.gradle.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,85 +0,0 @@ -plugins { - id "com.github.johnrengelman.shadow" version "7.1.2" -} -#if (${MIXINS}) -loom { - forge { - mixinConfig "${MOD_ID}-common.mixins.json" - mixinConfig "${MOD_ID}.mixins.json" - } -} -#end -architectury { - platformSetupLoomIde() - forge() -} - -configurations { - common - shadowCommon // Don't use shadow from the shadow plugin since it *excludes* files. - compileClasspath.extendsFrom common - runtimeClasspath.extendsFrom common - developmentForge.extendsFrom common -} - -dependencies { - forge "net.minecraftforge:forge:${rootProject.forge_version}" -#if (${ARCHITECTURY_API}) - // Remove the next line if you don't want to depend on the API - modApi "${ARCHITECTURY_GROUP}:architectury-forge:${rootProject.architectury_version}" -#end - - common(project(path: ":common", configuration: "namedElements")) { transitive false } - shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false } -} - -processResources { - inputs.property "version", project.version - - filesMatching("META-INF/mods.toml") { - expand "version": project.version - } -} - -shadowJar { - exclude "fabric.mod.json" - - configurations = [project.configurations.shadowCommon] - archiveClassifier = "dev-shadow" -} - -remapJar { - inputFile.set(shadowJar.archiveFile) - dependsOn shadowJar - archiveClassifier.set(null) -} - -jar { - archiveClassifier.set("dev") -} - -sourcesJar { - def commonSources = project(":common").sourcesJar - dependsOn commonSources - from commonSources.archiveFile.map { zipTree(it) } -} - -components.java { - withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { - skip() - } -} - -publishing { - publications { - mavenForge(MavenPublication) { - artifactId = rootProject.archives_base_name + "-" + project.name - from components.java - } - } - - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - // Add repositories to publish to here. - } -} Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_build.gradle.html =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new build.gradle file for Forge Architectury projects.

- - Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_gradle.properties.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_gradle.properties.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_gradle.properties.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,1 +0,0 @@ -loom.platform=forge \ No newline at end of file Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_gradle.properties.html =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_gradle.properties.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_gradle.properties.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new gradle.properties file for Forge Architectury projects.

- - Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_main_class.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_main_class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_main_class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,19 +0,0 @@ -package ${PACKAGE_NAME}.forge; - -#if (${ARCHITECTURY_API}) -import ${ARCHITECTURY_PACKAGE}.platform.forge.EventBuses; -#end -import ${PACKAGE_NAME}.${CLASS_NAME}; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; - -@Mod(${CLASS_NAME}.MOD_ID) -public class ${CLASS_NAME}Forge { - public ${CLASS_NAME}Forge() { -#if (${ARCHITECTURY_API}) - // Submit our event bus to let architectury register our content on the right time - EventBuses.registerModEventBus(${CLASS_NAME}.MOD_ID, FMLJavaModLoadingContext.get().getModEventBus()); - #end - ${CLASS_NAME}.init(); - } -} \ No newline at end of file Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_main_class.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_main_class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_main_class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new main class for Forge Architectury projects.

- - Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_mixins.json.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_mixins.json.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_mixins.json.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,13 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "${PACKAGE_NAME}.forge.mixin", - "compatibilityLevel": "JAVA_${JAVA_VERSION}", - "mixins": [ - ], - "client": [ - ], - "injectors": { - "defaultRequire": 1 - } -} Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_mixins.json.html =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_mixins.json.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_mixins.json.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new modid.mixins.json file for Forge Architectury projects.

- - Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_mods.toml.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_mods.toml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_mods.toml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,92 +0,0 @@ -# This is an example mods.toml file. It contains the data relating to the loading mods. -# There are several mandatory fields (#mandatory), and many more that are optional (#optional). -# The overall format is standard TOML format, v0.5.0. -# Note that there are a couple of TOML lists in this file. -# Find more information on toml format here: https://github.com/toml-lang/toml -# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml -modLoader="javafml" #mandatory -# A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion="[${FORGE_SPEC_VERSION},)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. -# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. -# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. -license="${LICENSE}" -# A URL to refer people to when problems occur with this mod -#if (${ISSUE}) -issueTrackerURL="${ISSUE}" -#else -#issueTrackerURL="http://my.issue.tracker/" #optional -#end -# A list of mods - how many allowed here is determined by the individual mod loader -[[mods]] #mandatory -# The modid of the mod -modId="${MOD_ID}" #mandatory -# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it -# ${version} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata -# see the associated build.gradle script for how to populate this completely automatically during a build -version="${version}" #mandatory -# A display name for the mod -displayName="${MOD_NAME}" #mandatory -# A URL to query for updates for this mod. See the JSON update specification -#if (${UPDATE_URL}) -updateJSONURL="${UPDATE_URL}" #optional -#else -#updateJSONURL="http://myurl.me/" #optional -#end -# A URL for the "homepage" for this mod, displayed in the mod UI -#if (${WEBSITE}) -displayURL="${WEBSITE}" -#else -#displayURL="http://example.com/" #optional -#end -# A file name (in the root of the mod JAR) containing a logo for display -logoFile="icon.png" #optional -# A text field displayed in the mod UI -#credits="Thanks for this example mod goes to Java" #optional -# A text field displayed in the mod UI -#if (${AUTHOR_LIST}) -authors="${AUTHOR_LIST}" #optional -#else -#authors="Love, Cheese and small house plants" #optional -#end -#if (${DISPLAY_TEST}) -# Display Test controls the display for your mod in the server connection screen -# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod. -# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod. -# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component. -# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value. -# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself. -#displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional) - -#end -# The description text for the mod (multi line!) (#mandatory) -description=''' -${DESCRIPTION} -''' -# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. -[[dependencies.${MOD_ID}]] #optional - # the modid of the dependency - modId="forge" #mandatory - # Does this dependency have to exist - if not, ordering below must be specified - mandatory=true #mandatory - # The version range of the dependency - versionRange="[${FORGE_SPEC_VERSION},)" #mandatory - # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory - ordering="NONE" - # Side this dependency is applied on - BOTH, CLIENT or SERVER - side="BOTH" -# Here's another dependency -[[dependencies.${MOD_ID}]] - modId="minecraft" - mandatory=true - # This version range declares a minimum of the current minecraft version up to but not including the next major version - versionRange="[${MC_VERSION},${MC_NEXT_VERSION})" - ordering="NONE" - side="BOTH" -#if (${ARCHITECTURY_API}) -[[dependencies.${MOD_ID}]] - modId = "architectury" - mandatory = true - versionRange = "[${ARCHITECTURY_API_VERSION},)" - ordering = "AFTER" - side = "BOTH" -#end Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_mods.toml.html =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_mods.toml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_mods.toml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new mods.toml for Forge Architectury projects.

- - Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_pack.mcmeta.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_pack.mcmeta.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_pack.mcmeta.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,22 +0,0 @@ -{ - "pack": { - "description": "${ARTIFACT_ID} resources", - #if (${PACK_COMMENT} != "") - "pack_format": ${PACK_FORMAT}, - "_comment": "${PACK_COMMENT}" - #else - "pack_format": ${PACK_FORMAT} - #end - #if (${FORGE_DATA}) - #if (${FORGE_DATA.resourcePackFormat}) - ,"forge:resource_pack_format": ${FORGE_DATA.resourcePackFormat} - #end - #if (${FORGE_DATA.dataPackFormat}) - ,"forge:data_pack_format": ${FORGE_DATA.dataPackFormat} - #end - #if (${FORGE_DATA.serverDataPackFormat}) - ,"forge:server_data_pack_format": ${FORGE_DATA.serverDataPackFormat} - #end - #end - } -} Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_pack.mcmeta.html =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_pack.mcmeta.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_forge_pack.mcmeta.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new pack.mcmeta for Forge Architectury projects.

- - Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_gradle.properties.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_gradle.properties.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_gradle.properties.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,15 +0,0 @@ -org.gradle.jvmargs=-Xmx2048M - -minecraft_version=${MC_VERSION} -enabled_platforms=fabric,forge - -archives_base_name=${ARTIFACT_ID} -mod_version=${VERSION} -maven_group=${GROUP_ID} - -architectury_version=${ARCHITECTURY_API_VERSION} - -fabric_loader_version=${FABRIC_LOADER_VERSION} -fabric_api_version=${FABRIC_API_VERSION} - -forge_version=${FORGE_VERSION} Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_gradle.properties.html =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_gradle.properties.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_gradle.properties.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new gradle.properties file for Architectury projects.

- - Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_settings.gradle.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_settings.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_settings.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,12 +0,0 @@ -pluginManagement { - repositories { - maven { url "https://maven.fabricmc.net/" } - maven { url "https://maven.architectury.dev/" } - maven { url "https://maven.minecraftforge.net/" } - gradlePluginPortal() - } -} - -include("common") -include("fabric") -include("forge") \ No newline at end of file Index: src/main/resources/fileTemplates/j2ee/architectury/architectury_settings.gradle.html =================================================================== --- src/main/resources/fileTemplates/j2ee/architectury/architectury_settings.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/architectury/architectury_settings.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new settings.gradle file for Architectury projects.

- - Index: src/main/resources/fileTemplates/j2ee/bukkit/Bukkit Main Class.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/bukkit/Bukkit Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bukkit/Bukkit Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,17 +0,0 @@ -package ${PACKAGE}; - -import org.bukkit.plugin.java.JavaPlugin; - -public final class ${CLASS_NAME} extends JavaPlugin { - - @Override - public void onEnable() { - // Plugin startup logic - - } - - @Override - public void onDisable() { - // Plugin shutdown logic - } -} Index: src/main/resources/fileTemplates/j2ee/bukkit/Bukkit Main Class.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/bukkit/Bukkit Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bukkit/Bukkit Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new main class for Bukkit.

- - Index: src/main/resources/fileTemplates/j2ee/bukkit/Bukkit build.gradle.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/bukkit/Bukkit build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bukkit/Bukkit build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,40 +0,0 @@ -plugins { - id 'java' -} - -group = '${GROUP_ID}' -version = '${PLUGIN_VERSION}' - -repositories { - mavenCentral() -} - -dependencies { -} - -def targetJavaVersion = ${JAVA_VERSION} -java { - def javaVersion = JavaVersion.toVersion(targetJavaVersion) - sourceCompatibility = javaVersion - targetCompatibility = javaVersion - if (JavaVersion.current() < javaVersion) { - toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) - } -} - -tasks.withType(JavaCompile).configureEach { - options.encoding = 'UTF-8' - - if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { - options.release.set(targetJavaVersion) - } -} - -processResources { - def props = [version: version] - inputs.properties props - filteringCharset 'UTF-8' - filesMatching('${MANIFEST_NAME}') { - expand props - } -} Index: src/main/resources/fileTemplates/j2ee/bukkit/Bukkit build.gradle.html =================================================================== --- src/main/resources/fileTemplates/j2ee/bukkit/Bukkit build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bukkit/Bukkit build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new build.gradle for Bukkit projects.

- - Index: src/main/resources/fileTemplates/j2ee/bukkit/Bukkit gradle.properties.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/bukkit/Bukkit gradle.properties.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bukkit/Bukkit gradle.properties.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,0 +0,0 @@ Index: src/main/resources/fileTemplates/j2ee/bukkit/Bukkit gradle.properties.html =================================================================== --- src/main/resources/fileTemplates/j2ee/bukkit/Bukkit gradle.properties.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bukkit/Bukkit gradle.properties.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new gradle.properties file for Bukkit projects.

- - Index: src/main/resources/fileTemplates/j2ee/bukkit/Bukkit plugin.yml.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/bukkit/Bukkit plugin.yml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bukkit/Bukkit plugin.yml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,30 +0,0 @@ -name: ${NAME} -version: '${VERSION}' -main: ${MAIN} -#if (${API_VERSION}) -api-version: '${API_VERSION}' -#end -#if (${PREFIX}) -prefix: ${PREFIX} -#end -#if (${LOAD}) -load: ${LOAD} -#end -#if (${LOAD_BEFORE}) -loadbefore: ${LOAD_BEFORE} -#end -#if (${DEPEND}) -depend: ${DEPEND} -#end -#if (${SOFT_DEPEND}) -softdepend: ${SOFT_DEPEND} -#end -#if (${AUTHOR_LIST}) -authors: ${AUTHOR_LIST} -#end -#if (${DESCRIPTION}) -description: ${DESCRIPTION} -#end -#if (${WEBSITE}) -website: ${WEBSITE} -#end Index: src/main/resources/fileTemplates/j2ee/bukkit/Bukkit plugin.yml.html =================================================================== --- src/main/resources/fileTemplates/j2ee/bukkit/Bukkit plugin.yml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bukkit/Bukkit plugin.yml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new plugin.yml for Bukkit.

- - Index: src/main/resources/fileTemplates/j2ee/bukkit/Bukkit pom.xml.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/bukkit/Bukkit pom.xml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bukkit/Bukkit pom.xml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,55 +0,0 @@ - - - 4.0.0 - - - - - jar - - - - - 1.8 - UTF-8 - - - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven_compiler_plugin_version} - - ${java.version} - ${java.version} - - - - org.apache.maven.plugins - maven-shade-plugin - ${maven_shade_plugin_version} - - - package - - shade - - - - - - - - src/main/resources - true - - - - - - - - Index: src/main/resources/fileTemplates/j2ee/bukkit/Bukkit pom.xml.html =================================================================== --- src/main/resources/fileTemplates/j2ee/bukkit/Bukkit pom.xml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bukkit/Bukkit pom.xml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new pom.xml for Bukkit.

- - Index: src/main/resources/fileTemplates/j2ee/bukkit/Bukkit settings.gradle.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/bukkit/Bukkit settings.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bukkit/Bukkit settings.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,1 +0,0 @@ -rootProject.name = '${ARTIFACT_ID}' Index: src/main/resources/fileTemplates/j2ee/bukkit/Bukkit settings.gradle.html =================================================================== --- src/main/resources/fileTemplates/j2ee/bukkit/Bukkit settings.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bukkit/Bukkit settings.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new settings.gradle for Bukkit projects.

- - Index: src/main/resources/fileTemplates/j2ee/bukkit/Paper paper-plugin.yml.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/bukkit/Paper paper-plugin.yml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bukkit/Paper paper-plugin.yml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,38 +0,0 @@ -name: ${NAME} -version: '${VERSION}' -main: ${MAIN} -#if (${API_VERSION}) -api-version: '${API_VERSION}' -#end -#if (${PREFIX}) -prefix: ${PREFIX} -#end -#if (${LOAD}) -load: ${LOAD} -#end -#if (${LOAD_BEFORE}) -load-before: -#foreach (${DEP_NAME} in ${LOAD_BEFORE}) - - name: ${DEP_NAME} -#end -#end -#if (${DEPEND} || ${SOFT_DEPEND}) -dependencies: -#foreach (${DEP_NAME} in ${DEPEND}) - - name: ${DEP_NAME} - required: true -#end -#foreach (${DEP_NAME} in ${SOFT_DEPEND}) - - name: ${DEP_NAME} - required: false -#end -#end -#if (${AUTHOR_LIST}) -authors: ${AUTHOR_LIST} -#end -#if (${DESCRIPTION}) -description: ${DESCRIPTION} -#end -#if (${WEBSITE}) -website: ${WEBSITE} -#end Index: src/main/resources/fileTemplates/j2ee/bukkit/Paper paper-plugin.yml.html =================================================================== --- src/main/resources/fileTemplates/j2ee/bukkit/Paper paper-plugin.yml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bukkit/Paper paper-plugin.yml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new paper-plugin.yml for Paper.

- - Index: src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord Main Class.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,16 +0,0 @@ -package ${PACKAGE}; - -import net.md_5.bungee.api.plugin.Plugin; - -public final class ${CLASS_NAME} extends Plugin { - - @Override - public void onEnable() { - // Plugin startup logic - } - - @Override - public void onDisable() { - // Plugin shutdown logic - } -} Index: src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord Main Class.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new main class for BungeeCord.

- - Index: src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord build.gradle.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,39 +0,0 @@ -apply plugin: 'java' - -group = '${GROUP_ID}' -version = '${PLUGIN_VERSION}' - -repositories { - mavenCentral() -} - -dependencies { -} - -def targetJavaVersion = 8 -java { - def javaVersion = JavaVersion.toVersion(targetJavaVersion) - sourceCompatibility = javaVersion - targetCompatibility = javaVersion - if (JavaVersion.current() < javaVersion) { - toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) - } -} - -tasks.withType(JavaCompile).configureEach { - options.encoding = 'UTF-8' - - if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { - options.release.set(targetJavaVersion) - } -} - -processResources { - def props = [version: version] - inputs.properties props - expand props - filteringCharset 'UTF-8' - filesMatching('bungee.yml') { - expand props - } -} Index: src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord build.gradle.html =================================================================== --- src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new build.gradle for BungeeCord projects.

- - Index: src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord bungee.yml.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord bungee.yml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord bungee.yml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,15 +0,0 @@ -name: ${NAME} -version: '${VERSION}' -main: ${MAIN} -#if (${DEPEND}) -depend: ${DEPEND} -#end -#if (${SOFT_DEPEND}) -softdepend: ${SOFT_DEPEND} -#end -#if (${AUTHOR}) -author: ${AUTHOR} -#end -#if (${DESCRIPTION}) -description: ${DESCRIPTION} -#end Index: src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord bungee.yml.html =================================================================== --- src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord bungee.yml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord bungee.yml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new bungee.yml for BungeeCord.

- - Index: src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord gradle.properties.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord gradle.properties.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord gradle.properties.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,0 +0,0 @@ Index: src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord gradle.properties.html =================================================================== --- src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord gradle.properties.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord gradle.properties.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new gradle.properties file for BungeeCord projects.

- - Index: src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord pom.xml.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord pom.xml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord pom.xml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,56 +0,0 @@ - - - 4.0.0 - - - - - jar - - - - - 1.8 - UTF-8 - - - - clean package - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven_compiler_plugin_version} - - ${java.version} - ${java.version} - - - - org.apache.maven.plugins - maven-shade-plugin - ${maven_shade_plugin_version} - - - package - - shade - - - - - - - - src/main/resources - true - - - - - - - - Index: src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord pom.xml.html =================================================================== --- src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord pom.xml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord pom.xml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new pom.xml for BungeeCord.

- - Index: src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord settings.gradle.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord settings.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord settings.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,1 +0,0 @@ -rootProject.name = '${PROJECT_NAME}' Index: src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord settings.gradle.html =================================================================== --- src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord settings.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/bungeecord/BungeeCord settings.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new settings.gradle for BungeeCord projects.

- - Index: src/main/resources/fileTemplates/j2ee/common/Gradle.gitignore.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/common/Gradle.gitignore.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/common/Gradle.gitignore.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,123 +0,0 @@ -# User-specific stuff -.idea/ - -*.iml -*.ipr -*.iws - -# IntelliJ -out/ -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Compiled class file -*.class - -# Log file -*.log - -# BlueJ files -*.ctxt - -# Package Files # -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* - -### Linux ### -*~ - -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* - -# .nfs files are created when an open file is removed but is still being accessed -.nfs* - -### macOS ### -# General -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -### Windows ### -# Windows thumbnail cache files -Thumbs.db -Thumbs.db:encryptable -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -[Dd]esktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp - -# Windows shortcuts -*.lnk - -### Gradle ### -.gradle -build/ - -# Ignore Gradle GUI config -gradle-app.setting - -# Cache of project -.gradletasknamecache - -### Gradle Patch ### -**/build/ - -# Common working directory -run/ - -# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) -!gradle-wrapper.jar Index: src/main/resources/fileTemplates/j2ee/common/Gradle.gitignore.html =================================================================== --- src/main/resources/fileTemplates/j2ee/common/Gradle.gitignore.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/common/Gradle.gitignore.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new .gitignore for Gradle projects.

- - Index: src/main/resources/fileTemplates/j2ee/common/Maven.gitignore.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/common/Maven.gitignore.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/common/Maven.gitignore.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,117 +0,0 @@ -# User-specific stuff -.idea/ - -*.iml -*.ipr -*.iws - -# IntelliJ -out/ - -# Compiled class file -*.class - -# Log file -*.log - -# BlueJ files -*.ctxt - -# Package Files # -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* - -### Linux ### -*~ - -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* - -# .nfs files are created when an open file is removed but is still being accessed -.nfs* - -### macOS ### -# General -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -### Windows ### -# Windows thumbnail cache files -Thumbs.db -Thumbs.db:encryptable -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -[Dd]esktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp - -# Windows shortcuts -*.lnk - -### Maven ### -target/ - -pom.xml.tag -pom.xml.releaseBackup -pom.xml.versionsBackup -pom.xml.next - -release.properties -dependency-reduced-pom.xml -buildNumber.properties -.mvn/timing.properties -.mvn/wrapper/maven-wrapper.jar -.flattened-pom.xml - -# Common working directory -run/ Index: src/main/resources/fileTemplates/j2ee/common/Maven.gitignore.html =================================================================== --- src/main/resources/fileTemplates/j2ee/common/Maven.gitignore.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/common/Maven.gitignore.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new .gitignore for Maven projects.

- - Index: src/main/resources/fileTemplates/j2ee/common/MinecraftDev gradle-wrapper.properties.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/common/MinecraftDev gradle-wrapper.properties.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/common/MinecraftDev gradle-wrapper.properties.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,1 +0,0 @@ -distributionUrl=https\://services.gradle.org/distributions/gradle-${GRADLE_WRAPPER_VERSION}-bin.zip Index: src/main/resources/fileTemplates/j2ee/common/MinecraftDev gradle-wrapper.properties.html =================================================================== --- src/main/resources/fileTemplates/j2ee/common/MinecraftDev gradle-wrapper.properties.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/common/MinecraftDev gradle-wrapper.properties.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new gradle-wrapper.properties file for Minecraft projects.

- - Index: src/main/resources/fileTemplates/j2ee/fabric/fabric_build.gradle.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/fabric/fabric_build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/fabric/fabric_build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,95 +0,0 @@ -plugins { - id 'fabric-loom' version '${LOOM_VERSION}' - id 'maven-publish' -} - -version = project.mod_version -group = project.maven_group - -base { - archivesName = project.archives_base_name -} - -repositories { - // Add repositories to retrieve artifacts from in here. - // You should only use this when depending on other mods because - // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. - // See https://docs.gradle.org/current/userguide/declaring_repositories.html - // for more information about repositories. -} - -dependencies { - // To change the versions see the gradle.properties file - minecraft "com.mojang:minecraft:${project.minecraft_version}" -#if (${OFFICIAL_MAPPINGS}) - mappings loom.officialMojangMappings() -#else - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" -#end - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" - - #if (${API_VERSION}) - // Fabric API. This is technically optional, but you probably want it anyway. - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - #end -} - -processResources { - inputs.property "version", project.version - inputs.property "minecraft_version", project.minecraft_version - inputs.property "loader_version", project.loader_version - filteringCharset "UTF-8" - - filesMatching("fabric.mod.json") { - expand "version": project.version, - "minecraft_version": project.minecraft_version, - "loader_version": project.loader_version - } -} - -def targetJavaVersion = ${JAVA_VERSION} -tasks.withType(JavaCompile).configureEach { - // ensure that the encoding is set to UTF-8, no matter what the system default is - // this fixes some edge cases with special characters not displaying correctly - // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html - // If Javadoc is generated, this must be specified in that task too. - it.options.encoding = "UTF-8" - if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { - it.options.release.set(targetJavaVersion) - } -} - -java { - def javaVersion = JavaVersion.toVersion(targetJavaVersion) - if (JavaVersion.current() < javaVersion) { - toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) - } - // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task - // if it is present. - // If you remove this line, sources will not be generated. - withSourcesJar() -} - -jar { - from("LICENSE") { - rename { "${it}_${project.archivesBaseName}"} - } -} - -// configure the maven publication -publishing { - publications { - create("mavenJava", MavenPublication) { - artifactId = project.archives_base_name - from components.java - } - } - - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - // Add repositories to publish to here. - // Notice: This block does NOT have the same function as the block in the top level. - // The repositories here will be used for publishing your artifact, not for - // retrieving dependencies. - } -} Index: src/main/resources/fileTemplates/j2ee/fabric/fabric_build.gradle.html =================================================================== --- src/main/resources/fileTemplates/j2ee/fabric/fabric_build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/fabric/fabric_build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new build.gradle file for Fabric projects.

- - Index: src/main/resources/fileTemplates/j2ee/fabric/fabric_gradle.properties.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/fabric/fabric_gradle.properties.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/fabric/fabric_gradle.properties.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,21 +0,0 @@ -# Done to increase the memory available to gradle. -org.gradle.jvmargs=-Xmx1G - -# Fabric Properties - # check these on https://fabricmc.net/develop - minecraft_version=${MC_VERSION} -#if (!${OFFICIAL_MAPPINGS}) - yarn_mappings=${YARN_MAPPINGS} -#end - loader_version=${LOADER_VERSION} - -# Mod Properties - mod_version = ${VERSION} - maven_group = ${GROUP_ID} - archives_base_name = ${ARTIFACT_ID} - -#if (${API_VERSION}) -# Dependencies - # check this on https://fabricmc.net/develop - fabric_version=${API_VERSION} -#end Index: src/main/resources/fileTemplates/j2ee/fabric/fabric_gradle.properties.html =================================================================== --- src/main/resources/fileTemplates/j2ee/fabric/fabric_gradle.properties.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/fabric/fabric_gradle.properties.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new gradle.properties file for Fabric projects.

- - Index: src/main/resources/fileTemplates/j2ee/fabric/fabric_mixins.json.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/fabric/fabric_mixins.json.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/fabric/fabric_mixins.json.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,13 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "${MIXIN_PACKAGE_NAME}", - "compatibilityLevel": "JAVA_${JAVA_VERSION}", - "mixins": [ - ], - "client": [ - ], - "injectors": { - "defaultRequire": 1 - } -} Index: src/main/resources/fileTemplates/j2ee/fabric/fabric_mixins.json.html =================================================================== --- src/main/resources/fileTemplates/j2ee/fabric/fabric_mixins.json.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/fabric/fabric_mixins.json.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new modid.mixins.json file for Fabric projects.

- - Index: src/main/resources/fileTemplates/j2ee/fabric/fabric_mod.json.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/fabric/fabric_mod.json.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/fabric/fabric_mod.json.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,31 +0,0 @@ -#set ( $d = "$" ) -{ - "schemaVersion": 1, - "id": "${MOD_ID}", - "version": "${d}{version}", - - "name": "${MOD_NAME}", - "description": "${MOD_DESCRIPTION}", - "authors": [], - "contact": {}, - - "license": "${LICENSE}", - "icon": "assets/${MOD_ID}/icon.png", - - "environment": "${MOD_ENVIRONMENT}", - "entrypoints": {}, - - #if (${MIXINS}) - "mixins": [ - "${MOD_ID}.mixins.json" - ], - #end - - "depends": { - "fabricloader": ">=${d}{loader_version}", - #if (${API_VERSION}) - "fabric": "*", - #end - "minecraft": "${d}{minecraft_version}" - } -} Index: src/main/resources/fileTemplates/j2ee/fabric/fabric_mod.json.html =================================================================== --- src/main/resources/fileTemplates/j2ee/fabric/fabric_mod.json.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/fabric/fabric_mod.json.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new fabric.mod.json for Fabric projects.

- - Index: src/main/resources/fileTemplates/j2ee/fabric/fabric_settings.gradle.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/fabric/fabric_settings.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/fabric/fabric_settings.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,9 +0,0 @@ -pluginManagement { - repositories { - maven { - name = 'Fabric' - url = 'https://maven.fabricmc.net/' - } - gradlePluginPortal() - } -} Index: src/main/resources/fileTemplates/j2ee/fabric/fabric_settings.gradle.html =================================================================== --- src/main/resources/fileTemplates/j2ee/fabric/fabric_settings.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/fabric/fabric_settings.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new settings.gradle file for Fabric projects.

- - Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) build.gradle.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,239 +0,0 @@ -#if (${MIXINS}) -buildscript { - repositories { - // These repositories are only for Gradle plugins, put any other repositories in the repository block further below - maven { url = 'https://repo.spongepowered.org/repository/maven-public/' } - mavenCentral() - } - dependencies { - classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT' - } -} -#end - -plugins { - id 'eclipse' - id 'idea' - id 'net.minecraftforge.gradle' version '[6.0.16,6.2)' -} - -#if (${MIXINS}) -apply plugin: 'org.spongepowered.mixin' -#end - -group = mod_group_id -version = mod_version - -base { - archivesName = mod_id -} - -java { - toolchain.languageVersion = JavaLanguageVersion.of(${JAVA_VERSION}) -} - -minecraft { - // The mappings can be changed at any time and must be in the following format. - // Channel: Version: - // official MCVersion Official field/method names from Mojang mapping files - // parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official - // - // You must be aware of the Mojang license when using the 'official' or 'parchment' mappings. - // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md - // - // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge - // Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started - // - // Use non-default mappings at your own risk. They may not always work. - // Simply re-run your setup task after changing the mappings to update your workspace. - mappings channel: mapping_channel, version: mapping_version - - // When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game. - // In most cases, it is not necessary to enable. - // enableEclipsePrepareRuns = true - // enableIdeaPrepareRuns = true - - // This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game. - // It is REQUIRED to be set to true for this template to function. - // See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html - copyIdeResources = true - - // When true, this property will add the folder name of all declared run configurations to generated IDE run configurations. - // The folder name can be set on a run configuration using the "folderName" property. - // By default, the folder name of a run configuration is the name of the Gradle project containing it. - // generateRunFolders = true - - // This property enables access transformers for use in development. - // They will be applied to the Minecraft artifact. - // The access transformer file can be anywhere in the project. - // However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge. - // This default location is a best practice to automatically put the file in the right place in the final jar. - // See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information. - // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') - - // Default run configurations. - // These can be tweaked, removed, or duplicated as needed. - runs { - // applies to all the run configs below - configureEach { - workingDirectory project.file('run') - - // Recommended logging data for a userdev environment - // The markers can be added/remove as needed separated by commas. - // "SCAN": For mods scan. - // "REGISTRIES": For firing of registry events. - // "REGISTRYDUMP": For getting the contents of all registries. - property 'forge.logging.markers', 'REGISTRIES' - - - // Recommended logging level for the console - // You can set various levels here. - // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels - property 'forge.logging.console.level', 'debug' -#if (!${MERGE_RESOURCES_AND_CLASSES}) - - mods { - "${mod_id}" { - source sourceSets.main - } - } -#end - } - - client { -#if (${GAME_TEST_FRAMEWORK}) - // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. - property 'forge.enabledGameTestNamespaces', mod_id -#end - } - - server { -#if (${GAME_TEST_FRAMEWORK}) - property 'forge.enabledGameTestNamespaces', mod_id -#end - args '--nogui' - } -#if (${GAME_TEST_FRAMEWORK}) - - // This run config launches GameTestServer and runs all registered gametests, then exits. - // By default, the server will crash when no gametests are provided. - // The gametest system is also enabled by default for other run configs under the /test command. - gameTestServer { - property 'forge.enabledGameTestNamespaces', mod_id - } -#end -#if (${HAS_DATA}) - - data { - // example of overriding the workingDirectory set in configureEach above - workingDirectory project.file('run-data') - - // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. - args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') - } -#end - } -} -#if (${MIXINS}) - -mixin { - add sourceSets.main, "${mod_id}.refmap.json" - - config "${mod_id}.mixins.json" -} -#end - -// Include resources generated by data generators. -sourceSets.main.resources { srcDir 'src/generated/resources' } - -repositories { - // Put repositories for dependencies here - // ForgeGradle automatically adds the Forge maven and Maven Central for you - - // If you have mod jar dependencies in ./libs, you can declare them as a repository like so. - // See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver - // flatDir { - // dir 'libs' - // } -} - -dependencies { - // Specify the version of Minecraft to use. - // Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact. - // The "userdev" classifier will be requested and setup by ForgeGradle. - // If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"], - // then special handling is done to allow a setup of a vanilla dependency without the use of an external repository. - minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" - - // Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings - // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime - // compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}") - // compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}") - // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}") - - // Example mod dependency using a mod jar from ./libs with a flat dir repository - // This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar - // The group id is ignored when searching -- in this case, it is "blank" - // implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}") - - // For more info: - // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html - // http://www.gradle.org/docs/current/userguide/dependency_management.html -#if (${MIXINS}) - - annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' -#end -} - -// This block of code expands all declared replace properties in the specified resource targets. -// A missing property will result in an error. Properties are expanded using ${} Groovy notation. -// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments. -// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html -tasks.named('processResources', ProcessResources).configure { - var replaceProperties = [ - minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range, - forge_version: forge_version, forge_version_range: forge_version_range, - loader_version_range: loader_version_range, - mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, - mod_authors: mod_authors, mod_description: mod_description, - ] - - inputs.properties replaceProperties - - filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { - expand replaceProperties + [project: project] - }} - -// Example for how to get properties into the manifest for reading at runtime. -tasks.named('jar', Jar).configure { - manifest { - attributes([ - "Specification-Title": mod_id, - "Specification-Vendor": mod_authors, - "Specification-Version": "1", // We are version 1 of ourselves - "Implementation-Title": project.name, - "Implementation-Version": project.jar.archiveVersion, - "Implementation-Vendor": mod_authors, - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") - ]) - } - - // This is the preferred method to reobfuscate your jar file - finalizedBy 'reobfJar' -} - -tasks.withType(JavaCompile).configureEach { - options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation -} -#if (${MERGE_RESOURCES_AND_CLASSES}) - -// Merge the resources and classes into the same directory. -// This is done because java expects modules to be in a single directory. -// And if we have it in multiple we have to do performance intensive hacks like having the UnionFileSystem -// This will eventually be migrated to ForgeGradle so modders don't need to manually do it. But that is later. -sourceSets.each { - def dir = layout.buildDirectory.dir("sourcesSets/$it.name") - it.output.resourcesDir = dir - it.java.destinationDirectory = dir -} -#end Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) build.gradle.html =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new build.gradle for Forge projects 1.13 and above.

- - Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) gradle.properties.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) gradle.properties.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) gradle.properties.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,55 +0,0 @@ -org.gradle.jvmargs=-Xmx3G -org.gradle.daemon=false - -## Environment Properties - -# The Minecraft version must agree with the Forge version to get a valid artifact -minecraft_version=${MC_VERSION} -# The Minecraft version range can use any release version of Minecraft as bounds. -# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly -# as they do not follow standard versioning conventions. -minecraft_version_range=[${MC_VERSION},${MC_NEXT_VERSION}) -# The Forge version must agree with the Minecraft version to get a valid artifact -forge_version=${FORGE_VERSION} -# The Forge version range can use any version of Forge as bounds or match the loader version range -forge_version_range=[${FORGE_SPEC_VERSION},) -# The loader version range can only use the major version of Forge/FML as bounds -loader_version_range=[${FORGE_SPEC_VERSION},) -# The mapping channel to use for mappings. -# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"]. -# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin. -# -# | Channel | Version | | -# |-----------|----------------------|--------------------------------------------------------------------------------| -# | official | MCVersion | Official field/method names from Mojang mapping files | -# | parchment | YYYY.MM.DD-MCVersion | Open community-sourced parameter names and javadocs layered on top of official | -# -# You must be aware of the Mojang license when using the 'official' or 'parchment' mappings. -# See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md -# -# Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge. -# Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started -mapping_channel=official -# The mapping version to query from the mapping channel. -# This must match the format required by the mapping channel. -mapping_version=${MC_VERSION} - -## Mod Properties - -# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63} -# Must match the String constant located in the main mod class annotated with @Mod. -mod_id=${MOD_ID} -# The human-readable display name for the mod. -mod_name=${MOD_NAME} -# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. -mod_license=${LICENSE} -# The mod version. See https://semver.org/ -mod_version=${MOD_VERSION} -# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. -# This should match the base package used for the mod sources. -# See https://maven.apache.org/guides/mini/guide-naming-conventions.html -mod_group_id=${GROUP_ID} -# The authors of the mod. This is a simple text string that is used for display purposes in the mod list. -mod_authors=${AUTHOR_LIST} -# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list. -mod_description=${DESCRIPTION} Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) gradle.properties.html =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) gradle.properties.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) gradle.properties.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new gradle.properties file for Forge projects 1.13 and above.

- - Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) settings.gradle.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) settings.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) settings.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,15 +0,0 @@ -pluginManagement { - repositories { - gradlePluginPortal() - maven { - name = 'MinecraftForge' - url = 'https://maven.minecraftforge.net/' - } - } -} - -plugins { - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' -} - -rootProject.name = '${ARTIFACT_ID}' Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) settings.gradle.html =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) settings.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) settings.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new settings.gradle for Forge projects 1.13 and above.

- - Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.16+) Main Class.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.16+) Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.16+) Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,82 +0,0 @@ -package ${PACKAGE_NAME}; - -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.InterModComms; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; -import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; -import net.minecraftforge.fml.event.server.FMLServerStartingEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.util.stream.Collectors; - -// The value here should match an entry in the META-INF/mods.toml file -@Mod("${MOD_ID}") -public class ${CLASS_NAME} { - - // Directly reference a log4j logger. - private static final Logger LOGGER = LogManager.getLogger(); - - public ${CLASS_NAME}() { - // Register the setup method for modloading - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); - // Register the enqueueIMC method for modloading - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); - // Register the processIMC method for modloading - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); - // Register the doClientStuff method for modloading - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); - - // Register ourselves for server and other game events we are interested in - MinecraftForge.EVENT_BUS.register(this); - } - - private void setup(final FMLCommonSetupEvent event) { - // some preinit code - LOGGER.info("HELLO FROM PREINIT"); - LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); - } - - private void doClientStuff(final FMLClientSetupEvent event) { - // do something that can only be done on the client - LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().options); - } - - private void enqueueIMC(final InterModEnqueueEvent event) { - // some example code to dispatch IMC to another mod - InterModComms.sendTo("${MOD_ID}", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); - } - - private void processIMC(final InterModProcessEvent event) { - // some example code to receive and process InterModComms from other mods - LOGGER.info("Got IMC {}", event.getIMCStream(). - map(m->m.getMessageSupplier().get()). - collect(Collectors.toList())); - } - - // You can use SubscribeEvent and let the Event Bus discover methods to call - @SubscribeEvent - public void onServerStarting(FMLServerStartingEvent event) { - // do something when the server starts - LOGGER.info("HELLO from server starting"); - } - - // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD - // Event bus for receiving Registry Events) - @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) - public static class RegistryEvents { - @SubscribeEvent - public static void onBlocksRegistry(final RegistryEvent.Register blockRegistryEvent) { - // register a new block here - LOGGER.info("HELLO from Register Block"); - } - } -} Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.16+) Main Class.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.16+) Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.16+) Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new main class for Forge projects 1.16 and above

- - Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.17+) Main Class.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.17+) Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.17+) Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,74 +0,0 @@ -package ${PACKAGE_NAME}; - -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.InterModComms; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; -import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; -import net.minecraftforge.fmlserverevents.FMLServerStartingEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.util.stream.Collectors; - -// The value here should match an entry in the META-INF/mods.toml file -@Mod("${MOD_ID}") -public class ${CLASS_NAME} { - - // Directly reference a log4j logger. - private static final Logger LOGGER = LogManager.getLogger(); - - public ${CLASS_NAME}() { - // Register the setup method for modloading - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); - // Register the enqueueIMC method for modloading - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); - // Register the processIMC method for modloading - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); - - // Register ourselves for server and other game events we are interested in - MinecraftForge.EVENT_BUS.register(this); - } - - private void setup(final FMLCommonSetupEvent event) { - // some preinit code - LOGGER.info("HELLO FROM PREINIT"); - LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); - } - - private void enqueueIMC(final InterModEnqueueEvent event) { - // some example code to dispatch IMC to another mod - InterModComms.sendTo("${MOD_ID}", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); - } - - private void processIMC(final InterModProcessEvent event) { - // some example code to receive and process InterModComms from other mods - LOGGER.info("Got IMC {}", event.getIMCStream(). - map(m->m.messageSupplier().get()). - collect(Collectors.toList())); - } - - // You can use SubscribeEvent and let the Event Bus discover methods to call - @SubscribeEvent - public void onServerStarting(FMLServerStartingEvent event) { - // do something when the server starts - LOGGER.info("HELLO from server starting"); - } - - // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD - // Event bus for receiving Registry Events) - @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) - public static class RegistryEvents { - @SubscribeEvent - public static void onBlocksRegistry(final RegistryEvent.Register blockRegistryEvent) { - // register a new block here - LOGGER.info("HELLO from Register Block"); - } - } -} Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.17+) Main Class.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.17+) Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.17+) Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new main class for Forge projects 1.17 and above

- - Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.18+) Main Class.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.18+) Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.18+) Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,74 +0,0 @@ -package ${PACKAGE_NAME}; - -import com.mojang.logging.LogUtils; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.InterModComms; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; -import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; -import net.minecraftforge.event.server.ServerStartingEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import org.slf4j.Logger; - -import java.util.stream.Collectors; - -// The value here should match an entry in the META-INF/mods.toml file -@Mod("${MOD_ID}") -public class ${CLASS_NAME} { - - // Directly reference a slf4j logger - private static final Logger LOGGER = LogUtils.getLogger(); - - public ${CLASS_NAME}() { - // Register the setup method for modloading - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); - // Register the enqueueIMC method for modloading - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); - // Register the processIMC method for modloading - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); - - // Register ourselves for server and other game events we are interested in - MinecraftForge.EVENT_BUS.register(this); - } - - private void setup(final FMLCommonSetupEvent event) { - // Some preinit code - LOGGER.info("HELLO FROM PREINIT"); - LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); - } - - private void enqueueIMC(final InterModEnqueueEvent event) { - // Some example code to dispatch IMC to another mod - InterModComms.sendTo("${MOD_ID}", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); - } - - private void processIMC(final InterModProcessEvent event) { - // Some example code to receive and process InterModComms from other mods - LOGGER.info("Got IMC {}", event.getIMCStream(). - map(m->m.messageSupplier().get()). - collect(Collectors.toList())); - } - - // You can use SubscribeEvent and let the Event Bus discover methods to call - @SubscribeEvent - public void onServerStarting(ServerStartingEvent event) { - // Do something when the server starts - LOGGER.info("HELLO from server starting"); - } - - // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD - // Event bus for receiving Registry Events) - @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) - public static class RegistryEvents { - @SubscribeEvent - public static void onBlocksRegistry(final RegistryEvent.Register blockRegistryEvent) { - // Register a new block here - LOGGER.info("HELLO from Register Block"); - } - } -} Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.18+) Main Class.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.18+) Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.18+) Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new main class for Forge projects 1.18 and above

- - Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.19+) Main Class.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.19+) Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.19+) Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,87 +0,0 @@ -package ${PACKAGE_NAME}; - -import com.mojang.logging.LogUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.CreativeModeTab; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.state.BlockBehaviour; -import net.minecraft.world.level.material.Material; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.InterModComms; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; -import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; -import net.minecraftforge.event.server.ServerStartingEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; -import org.slf4j.Logger; - -// The value here should match an entry in the META-INF/mods.toml file -@Mod(${CLASS_NAME}.MODID) -public class ${CLASS_NAME} { - - // Define mod id in a common place for everything to reference - public static final String MODID = "${MOD_ID}"; - // Directly reference a slf4j logger - private static final Logger LOGGER = LogUtils.getLogger(); - // Create a Deferred Register to hold Blocks which will all be registered under the "${MOD_ID}" namespace - public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); - // Create a Deferred Register to hold Items which will all be registered under the "${MOD_ID}" namespace - public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); - - // Creates a new Block with the id "${MOD_ID}:example_block", combining the namespace and path - public static final RegistryObject EXAMPLE_BLOCK = BLOCKS.register("example_block", () -> new Block(BlockBehaviour.Properties.of(Material.STONE))); - // Creates a new BlockItem with the id "${MOD_ID}:example_block", combining the namespace and path - public static final RegistryObject EXAMPLE_BLOCK_ITEM = ITEMS.register("example_block", () -> new BlockItem(EXAMPLE_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_BUILDING_BLOCKS))); - - public ${CLASS_NAME}() { - IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); - - // Register the commonSetup method for modloading - modEventBus.addListener(this::commonSetup); - - // Register the Deferred Register to the mod event bus so blocks get registered - BLOCKS.register(modEventBus); - // Register the Deferred Register to the mod event bus so items get registered - ITEMS.register(modEventBus); - - // Register ourselves for server and other game events we are interested in - MinecraftForge.EVENT_BUS.register(this); - } - - private void commonSetup(final FMLCommonSetupEvent event) { - // Some common setup code - LOGGER.info("HELLO FROM COMMON SETUP"); - LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT)); - } - - // You can use SubscribeEvent and let the Event Bus discover methods to call - @SubscribeEvent - public void onServerStarting(ServerStartingEvent event) { - // Do something when the server starts - LOGGER.info("HELLO from server starting"); - } - - // You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent - @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) - public static class ClientModEvents { - - @SubscribeEvent - public static void onClientSetup(FMLClientSetupEvent event) - { - // Some client setup code - LOGGER.info("HELLO FROM CLIENT SETUP"); - LOGGER.info("MINECRAFT NAME >> {}", Minecraft.getInstance().getUser().getName()); - } - } -} Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.19+) Main Class.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.19+) Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.19+) Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new main class for Forge projects 1.19 and above

- - Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.19.3+) Main Class.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.19.3+) Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.19.3+) Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,94 +0,0 @@ -package ${PACKAGE_NAME}; - -import com.mojang.logging.LogUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.CreativeModeTabs; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.state.BlockBehaviour; -import net.minecraft.world.level.material.Material; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.CreativeModeTabEvent; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.event.server.ServerStartingEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; -import org.slf4j.Logger; - -// The value here should match an entry in the META-INF/mods.toml file -@Mod(${CLASS_NAME}.MODID) -public class ${CLASS_NAME} { - - // Define mod id in a common place for everything to reference - public static final String MODID = "${MOD_ID}"; - // Directly reference a slf4j logger - private static final Logger LOGGER = LogUtils.getLogger(); - // Create a Deferred Register to hold Blocks which will all be registered under the "${MOD_ID}" namespace - public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); - // Create a Deferred Register to hold Items which will all be registered under the "${MOD_ID}" namespace - public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); - - // Creates a new Block with the id "${MOD_ID}:example_block", combining the namespace and path - public static final RegistryObject EXAMPLE_BLOCK = BLOCKS.register("example_block", () -> new Block(BlockBehaviour.Properties.of(Material.STONE))); - // Creates a new BlockItem with the id "${MOD_ID}:example_block", combining the namespace and path - public static final RegistryObject EXAMPLE_BLOCK_ITEM = ITEMS.register("example_block", () -> new BlockItem(EXAMPLE_BLOCK.get(), new Item.Properties())); - - public ${CLASS_NAME}() { - IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); - - // Register the commonSetup method for modloading - modEventBus.addListener(this::commonSetup); - - // Register the Deferred Register to the mod event bus so blocks get registered - BLOCKS.register(modEventBus); - // Register the Deferred Register to the mod event bus so items get registered - ITEMS.register(modEventBus); - - // Register ourselves for server and other game events we are interested in - MinecraftForge.EVENT_BUS.register(this); - - // Register the item to a creative tab - modEventBus.addListener(this::addCreative); - } - - private void commonSetup(final FMLCommonSetupEvent event) { - // Some common setup code - LOGGER.info("HELLO FROM COMMON SETUP"); - LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT)); - } - - private void addCreative(CreativeModeTabEvent.BuildContents event) - { - if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS) - event.accept(EXAMPLE_BLOCK_ITEM); - } - - // You can use SubscribeEvent and let the Event Bus discover methods to call - @SubscribeEvent - public void onServerStarting(ServerStartingEvent event) { - // Do something when the server starts - LOGGER.info("HELLO from server starting"); - } - - // You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent - @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) - public static class ClientModEvents { - - @SubscribeEvent - public static void onClientSetup(FMLClientSetupEvent event) - { - // Some client setup code - LOGGER.info("HELLO FROM CLIENT SETUP"); - LOGGER.info("MINECRAFT NAME >> {}", Minecraft.getInstance().getUser().getName()); - } - } -} Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.19.3+) Main Class.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.19.3+) Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.19.3+) Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new main class for Forge projects 1.19.3 and above

- - Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.20+) Config.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.20+) Config.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.20+) Config.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,64 +0,0 @@ -package ${PACKAGE_NAME}; - -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.Item; -import net.minecraftforge.common.ForgeConfigSpec; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.config.ModConfigEvent; -import net.minecraftforge.registries.ForgeRegistries; - -import java.util.Collections; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -// An example config class. This is not required, but it's a good idea to have one to keep your config organized. -// Demonstrates how to use Forge's config APIs -@Mod.EventBusSubscriber(modid = ${CLASS_NAME}.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) -public class Config -{ - private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder(); - - private static final ForgeConfigSpec.BooleanValue LOG_DIRT_BLOCK = BUILDER - .comment("Whether to log the dirt block on common setup") - .define("logDirtBlock", true); - - private static final ForgeConfigSpec.IntValue MAGIC_NUMBER = BUILDER - .comment("A magic number") - .defineInRange("magicNumber", 42, 0, Integer.MAX_VALUE); - - public static final ForgeConfigSpec.ConfigValue MAGIC_NUMBER_INTRODUCTION = BUILDER - .comment("What you want the introduction message to be for the magic number") - .define("magicNumberIntroduction", "The magic number is... "); - - // a list of strings that are treated as resource locations for items - private static final ForgeConfigSpec.ConfigValue> ITEM_STRINGS = BUILDER - .comment("A list of items to log on common setup.") - .defineListAllowEmpty("items", List.of("minecraft:iron_ingot"), Config::validateItemName); - - static final ForgeConfigSpec SPEC = BUILDER.build(); - - public static boolean logDirtBlock; - public static int magicNumber; - public static String magicNumberIntroduction; - public static Set items; - - private static boolean validateItemName(final Object obj) - { - return obj instanceof final String itemName && ForgeRegistries.ITEMS.containsKey(new ResourceLocation(itemName)); - } - - @SubscribeEvent - static void onLoad(final ModConfigEvent event) - { - logDirtBlock = LOG_DIRT_BLOCK.get(); - magicNumber = MAGIC_NUMBER.get(); - magicNumberIntroduction = MAGIC_NUMBER_INTRODUCTION.get(); - - // convert the list of strings into a set of items - items = ITEM_STRINGS.get().stream() - .map(itemName -> ForgeRegistries.ITEMS.getValue(new ResourceLocation(itemName))) - .collect(Collectors.toSet()); - } -} Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.20+) Config.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.20+) Config.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.20+) Config.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new config class for Forge projects 1.20 and above

- - Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.20+) Main Class.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.20+) Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.20+) Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,125 +0,0 @@ -package ${PACKAGE_NAME}; - -import com.mojang.logging.LogUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.core.registries.Registries; -import net.minecraft.world.food.FoodProperties; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.CreativeModeTab; -import net.minecraft.world.item.CreativeModeTabs; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.state.BlockBehaviour; -import net.minecraft.world.level.material.MapColor; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; -import net.minecraftforge.event.server.ServerStartingEvent; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.ModLoadingContext; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.config.ModConfig; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; -import org.slf4j.Logger; - -// The value here should match an entry in the META-INF/mods.toml file -@Mod(${CLASS_NAME}.MODID) -public class ${CLASS_NAME} { - - // Define mod id in a common place for everything to reference - public static final String MODID = "${MOD_ID}"; - // Directly reference a slf4j logger - private static final Logger LOGGER = LogUtils.getLogger(); - // Create a Deferred Register to hold Blocks which will all be registered under the "${MOD_ID}" namespace - public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); - // Create a Deferred Register to hold Items which will all be registered under the "${MOD_ID}" namespace - public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); - // Create a Deferred Register to hold CreativeModeTabs which will all be registered under the "examplemod" namespace - public static final DeferredRegister CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MODID); - - // Creates a new Block with the id "${MOD_ID}:example_block", combining the namespace and path - public static final RegistryObject EXAMPLE_BLOCK = BLOCKS.register("example_block", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE))); - // Creates a new BlockItem with the id "${MOD_ID}:example_block", combining the namespace and path - public static final RegistryObject EXAMPLE_BLOCK_ITEM = ITEMS.register("example_block", () -> new BlockItem(EXAMPLE_BLOCK.get(), new Item.Properties())); - - // Creates a new food item with the id "examplemod:example_id", nutrition 1 and saturation 2 - public static final RegistryObject EXAMPLE_ITEM = ITEMS.register("example_item", () -> new Item(new Item.Properties().food(new FoodProperties.Builder() - .alwaysEat().nutrition(1).saturationMod(2f).build()))); - - // Creates a creative tab with the id "examplemod:example_tab" for the example item, that is placed after the combat tab - public static final RegistryObject EXAMPLE_TAB = CREATIVE_MODE_TABS.register("example_tab", () -> CreativeModeTab.builder() - .withTabsBefore(CreativeModeTabs.COMBAT) - .icon(() -> EXAMPLE_ITEM.get().getDefaultInstance()) - .displayItems((parameters, output) -> { - output.accept(EXAMPLE_ITEM.get()); // Add the example item to the tab. For your own tabs, this method is preferred over the event - }).build()); - - public ${CLASS_NAME}() { - IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); - - // Register the commonSetup method for modloading - modEventBus.addListener(this::commonSetup); - - // Register the Deferred Register to the mod event bus so blocks get registered - BLOCKS.register(modEventBus); - // Register the Deferred Register to the mod event bus so items get registered - ITEMS.register(modEventBus); - // Register the Deferred Register to the mod event bus so tabs get registered - CREATIVE_MODE_TABS.register(modEventBus); - - // Register ourselves for server and other game events we are interested in - MinecraftForge.EVENT_BUS.register(this); - - // Register the item to a creative tab - modEventBus.addListener(this::addCreative); - - // Register our mod's ForgeConfigSpec so that Forge can create and load the config file for us - ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.SPEC); - } - - private void commonSetup(final FMLCommonSetupEvent event) { - // Some common setup code - LOGGER.info("HELLO FROM COMMON SETUP"); - LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT)); - - if (Config.logDirtBlock) - LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT)); - - LOGGER.info(Config.magicNumberIntroduction + Config.magicNumber); - - Config.items.forEach((item) -> LOGGER.info("ITEM >> {}", item.toString())); - } - - // Add the example block item to the building blocks tab - private void addCreative(BuildCreativeModeTabContentsEvent event) - { - if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) - event.accept(EXAMPLE_BLOCK_ITEM); - } - // You can use SubscribeEvent and let the Event Bus discover methods to call - @SubscribeEvent - public void onServerStarting(ServerStartingEvent event) { - // Do something when the server starts - LOGGER.info("HELLO from server starting"); - } - - // You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent - @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) - public static class ClientModEvents { - - @SubscribeEvent - public static void onClientSetup(FMLClientSetupEvent event) - { - // Some client setup code - LOGGER.info("HELLO FROM CLIENT SETUP"); - LOGGER.info("MINECRAFT NAME >> {}", Minecraft.getInstance().getUser().getName()); - } - } -} Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.20+) Main Class.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.20+) Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.20+) Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new main class for Forge projects 1.20 and above

- - Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.20.6+) Main Class.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.20.6+) Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.20.6+) Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,125 +0,0 @@ -package ${PACKAGE_NAME}; - -import com.mojang.logging.LogUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.core.registries.Registries; -import net.minecraft.world.food.FoodProperties; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.CreativeModeTab; -import net.minecraft.world.item.CreativeModeTabs; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.state.BlockBehaviour; -import net.minecraft.world.level.material.MapColor; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; -import net.minecraftforge.event.server.ServerStartingEvent; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.ModLoadingContext; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.config.ModConfig; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; -import org.slf4j.Logger; - -// The value here should match an entry in the META-INF/mods.toml file -@Mod(${CLASS_NAME}.MODID) -public class ${CLASS_NAME} { - - // Define mod id in a common place for everything to reference - public static final String MODID = "${MOD_ID}"; - // Directly reference a slf4j logger - private static final Logger LOGGER = LogUtils.getLogger(); - // Create a Deferred Register to hold Blocks which will all be registered under the "${MOD_ID}" namespace - public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); - // Create a Deferred Register to hold Items which will all be registered under the "${MOD_ID}" namespace - public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); - // Create a Deferred Register to hold CreativeModeTabs which will all be registered under the "examplemod" namespace - public static final DeferredRegister CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MODID); - - // Creates a new Block with the id "${MOD_ID}:example_block", combining the namespace and path - public static final RegistryObject EXAMPLE_BLOCK = BLOCKS.register("example_block", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE))); - // Creates a new BlockItem with the id "${MOD_ID}:example_block", combining the namespace and path - public static final RegistryObject EXAMPLE_BLOCK_ITEM = ITEMS.register("example_block", () -> new BlockItem(EXAMPLE_BLOCK.get(), new Item.Properties())); - - // Creates a new food item with the id "examplemod:example_id", nutrition 1 and saturation 2 - public static final RegistryObject EXAMPLE_ITEM = ITEMS.register("example_item", () -> new Item(new Item.Properties().food(new FoodProperties.Builder() - .alwaysEdible().nutrition(1).saturationModifier(2f).build()))); - - // Creates a creative tab with the id "examplemod:example_tab" for the example item, that is placed after the combat tab - public static final RegistryObject EXAMPLE_TAB = CREATIVE_MODE_TABS.register("example_tab", () -> CreativeModeTab.builder() - .withTabsBefore(CreativeModeTabs.COMBAT) - .icon(() -> EXAMPLE_ITEM.get().getDefaultInstance()) - .displayItems((parameters, output) -> { - output.accept(EXAMPLE_ITEM.get()); // Add the example item to the tab. For your own tabs, this method is preferred over the event - }).build()); - - public ${CLASS_NAME}() { - IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); - - // Register the commonSetup method for modloading - modEventBus.addListener(this::commonSetup); - - // Register the Deferred Register to the mod event bus so blocks get registered - BLOCKS.register(modEventBus); - // Register the Deferred Register to the mod event bus so items get registered - ITEMS.register(modEventBus); - // Register the Deferred Register to the mod event bus so tabs get registered - CREATIVE_MODE_TABS.register(modEventBus); - - // Register ourselves for server and other game events we are interested in - MinecraftForge.EVENT_BUS.register(this); - - // Register the item to a creative tab - modEventBus.addListener(this::addCreative); - - // Register our mod's ForgeConfigSpec so that Forge can create and load the config file for us - ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.SPEC); - } - - private void commonSetup(final FMLCommonSetupEvent event) { - // Some common setup code - LOGGER.info("HELLO FROM COMMON SETUP"); - LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT)); - - if (Config.logDirtBlock) - LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT)); - - LOGGER.info(Config.magicNumberIntroduction + Config.magicNumber); - - Config.items.forEach((item) -> LOGGER.info("ITEM >> {}", item.toString())); - } - - // Add the example block item to the building blocks tab - private void addCreative(BuildCreativeModeTabContentsEvent event) - { - if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) - event.accept(EXAMPLE_BLOCK_ITEM); - } - // You can use SubscribeEvent and let the Event Bus discover methods to call - @SubscribeEvent - public void onServerStarting(ServerStartingEvent event) { - // Do something when the server starts - LOGGER.info("HELLO from server starting"); - } - - // You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent - @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) - public static class ClientModEvents { - - @SubscribeEvent - public static void onClientSetup(FMLClientSetupEvent event) - { - // Some client setup code - LOGGER.info("HELLO FROM CLIENT SETUP"); - LOGGER.info("MINECRAFT NAME >> {}", Minecraft.getInstance().getUser().getName()); - } - } -} Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.20.6+) Main Class.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.20.6+) Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.20.6+) Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new main class for Forge projects 1.20.6 and above

- - Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.21+) Config.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.21+) Config.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.21+) Config.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,64 +0,0 @@ -package ${PACKAGE_NAME}; - -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.Item; -import net.minecraftforge.common.ForgeConfigSpec; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.config.ModConfigEvent; -import net.minecraftforge.registries.ForgeRegistries; - -import java.util.Collections; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -// An example config class. This is not required, but it's a good idea to have one to keep your config organized. -// Demonstrates how to use Forge's config APIs -@Mod.EventBusSubscriber(modid = ${CLASS_NAME}.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) -public class Config -{ - private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder(); - - private static final ForgeConfigSpec.BooleanValue LOG_DIRT_BLOCK = BUILDER - .comment("Whether to log the dirt block on common setup") - .define("logDirtBlock", true); - - private static final ForgeConfigSpec.IntValue MAGIC_NUMBER = BUILDER - .comment("A magic number") - .defineInRange("magicNumber", 42, 0, Integer.MAX_VALUE); - - public static final ForgeConfigSpec.ConfigValue MAGIC_NUMBER_INTRODUCTION = BUILDER - .comment("What you want the introduction message to be for the magic number") - .define("magicNumberIntroduction", "The magic number is... "); - - // a list of strings that are treated as resource locations for items - private static final ForgeConfigSpec.ConfigValue> ITEM_STRINGS = BUILDER - .comment("A list of items to log on common setup.") - .defineListAllowEmpty("items", List.of("minecraft:iron_ingot"), Config::validateItemName); - - static final ForgeConfigSpec SPEC = BUILDER.build(); - - public static boolean logDirtBlock; - public static int magicNumber; - public static String magicNumberIntroduction; - public static Set items; - - private static boolean validateItemName(final Object obj) - { - return obj instanceof final String itemName && ForgeRegistries.ITEMS.containsKey(ResourceLocation.parse(itemName)); - } - - @SubscribeEvent - static void onLoad(final ModConfigEvent event) - { - logDirtBlock = LOG_DIRT_BLOCK.get(); - magicNumber = MAGIC_NUMBER.get(); - magicNumberIntroduction = MAGIC_NUMBER_INTRODUCTION.get(); - - // convert the list of strings into a set of items - items = ITEM_STRINGS.get().stream() - .map(itemName -> ForgeRegistries.ITEMS.getValue(ResourceLocation.parse(itemName))) - .collect(Collectors.toSet()); - } -} Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.21+) Config.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.21+) Config.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.21+) Config.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new config class for Forge projects 1.21 and above

- - Index: src/main/resources/fileTemplates/j2ee/forge/Forge Mixins Config.json.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge Mixins Config.json.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge Mixins Config.json.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,14 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "${PACKAGE_NAME}", - "compatibilityLevel": "JAVA_8", - "refmap": "${MOD_ID}.refmap.json", - "mixins": [ - ], - "client": [ - ], - "injectors": { - "defaultRequire": 1 - } -} Index: src/main/resources/fileTemplates/j2ee/forge/Forge Mixins Config.json.html =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge Mixins Config.json.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/Forge Mixins Config.json.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new modid.mixins.json file for Forge projects.

- - Index: src/main/resources/fileTemplates/j2ee/forge/mods.toml.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/mods.toml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/mods.toml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,82 +0,0 @@ -# This is an example mods.toml file. It contains the data relating to the loading mods. -# There are several mandatory fields (#mandatory), and many more that are optional (#optional). -# The overall format is standard TOML format, v0.5.0. -# Note that there are a couple of TOML lists in this file. -# Find more information on toml format here: https://github.com/toml-lang/toml -# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml -modLoader="javafml" #mandatory -# A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion="${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. -# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. -# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. -license="${mod_license}" -# A URL to refer people to when problems occur with this mod -#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional -#if (${SUPPORTS_CLIENT_SIDE_ONLY}) -# If your mod is purely client-side and has no multiplayer functionality (be it dedicated servers or Open to LAN), -# set this to true, and Forge will set the correct displayTest for you and skip loading your mod on dedicated servers. -#clientSideOnly=true #optional - defaults to false if absent -#end -# A list of mods - how many allowed here is determined by the individual mod loader -[[mods]] #mandatory -# The modid of the mod -modId="${mod_id}" #mandatory -# The version number of the mod -version="${mod_version}" #mandatory -# A display name for the mod -displayName="${mod_name}" #mandatory -# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/ -#if (${UPDATE_URL}) -updateJSONURL="${UPDATE_URL}" #optional -#else -#updateJSONURL="https://change.me.example.invalid/updates.json" #optional -#end -# A URL for the "homepage" for this mod, displayed in the mod UI -#if (${WEBSITE}) -displayURL="${WEBSITE}" #optional -#else -#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional -#end -# A file name (in the root of the mod JAR) containing a logo for display -#logoFile="${MOD_ID}.png" #optional -# A text field displayed in the mod UI -#credits="Thanks for this example mod goes to Java" #optional -# A text field displayed in the mod UI -authors="${mod_authors}" #optional -#if (${DISPLAY_TEST}) -# Display Test controls the display for your mod in the server connection screen -# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod. -# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod. -# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component. -# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value. -# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself. -#if (${SUPPORTS_CLIENT_SIDE_ONLY}) -#displayTest="MATCH_VERSION" # if nothing is specified, MATCH_VERSION is the default when clientSideOnly=false, otherwise IGNORE_ALL_VERSION when clientSideOnly=true (#optional) -#else -#displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional) -#end - -#end -# The description text for the mod (multi line!) (#mandatory) -description='''${mod_description}''' -# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. -[[dependencies."${mod_id}"]] #optional - # the modid of the dependency - modId="forge" #mandatory - # Does this dependency have to exist - if not, ordering below must be specified - mandatory=true #mandatory - # The version range of the dependency - versionRange="${forge_version_range}" #mandatory - # An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory - # BEFORE - This mod is loaded BEFORE the dependency - # AFTER - This mod is loaded AFTER the dependency - ordering="NONE" - # Side this dependency is applied on - BOTH, CLIENT, or SERVER - side="BOTH"# Here's another dependency -[[dependencies."${mod_id}"]] - modId="minecraft" - mandatory=true - # This version range declares a minimum of the current minecraft version up to but not including the next major version - versionRange="${minecraft_version_range}" - ordering="NONE" - side="BOTH" Index: src/main/resources/fileTemplates/j2ee/forge/mods.toml.html =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/mods.toml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/mods.toml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new mods.toml for Forge projects 1.13 and above.

- - Index: src/main/resources/fileTemplates/j2ee/forge/pack.mcmeta.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/pack.mcmeta.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/pack.mcmeta.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,22 +0,0 @@ -{ - "pack": { - "description": "${MOD_ID} resources", - #if (${PACK_COMMENT} != "") - "pack_format": ${PACK_FORMAT}, - "_comment": "${PACK_COMMENT}" - #else - "pack_format": ${PACK_FORMAT} - #end - #if (${FORGE_DATA}) - #if (${FORGE_DATA.resourcePackFormat}) - ,"forge:resource_pack_format": ${FORGE_DATA.resourcePackFormat} - #end - #if (${FORGE_DATA.dataPackFormat}) - ,"forge:data_pack_format": ${FORGE_DATA.dataPackFormat} - #end - #if (${FORGE_DATA.serverDataPackFormat}) - ,"forge:server_data_pack_format": ${FORGE_DATA.serverDataPackFormat} - #end - #end - } -} Index: src/main/resources/fileTemplates/j2ee/forge/pack.mcmeta.html =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/pack.mcmeta.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/forge/pack.mcmeta.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new pack.mcmeta for Forge projects 1.13 and above.

- - Index: src/main/resources/fileTemplates/j2ee/licenses/AGPL-3.0.txt.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/AGPL-3.0.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/AGPL-3.0.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,633 +0,0 @@ -#set ( $l = "<" ) -#set ( $g = ">" ) -Copyright (c) $YEAR $AUTHOR - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, version 3 of the License, or -(at your option) any later version. - -This program 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 Affero General Public License for more details. - - GNU AFFERO GENERAL PUBLIC LICENSE - Version 3, 19 November 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. ${l}http://fsf.org/${g} - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU Affero General Public License is a free, copyleft license for -software and other kinds of works, specifically designed to ensure -cooperation with the community in the case of network server software. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -our General Public Licenses are intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - Developers that use our General Public Licenses protect your rights -with two steps: (1) assert copyright on the software, and (2) offer -you this License which gives you legal permission to copy, distribute -and/or modify the software. - - A secondary benefit of defending all users' freedom is that -improvements made in alternate versions of the program, if they -receive widespread use, become available for other developers to -incorporate. Many developers of free software are heartened and -encouraged by the resulting cooperation. However, in the case of -software used on network servers, this result may fail to come about. -The GNU General Public License permits making a modified version and -letting the public access it on a server without ever releasing its -source code to the public. - - The GNU Affero General Public License is designed specifically to -ensure that, in such cases, the modified source code becomes available -to the community. It requires the operator of a network server to -provide the source code of the modified version running there to the -users of that server. Therefore, public use of a modified version, on -a publicly accessible server, gives the public access to the source -code of the modified version. - - An older license, called the Affero General Public License and -published by Affero, was designed to accomplish similar goals. This is -a different license, not a version of the Affero GPL, but Affero has -released a new version of the Affero GPL which permits relicensing under -this license. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU Affero General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Remote Network Interaction; Use with the GNU General Public License. - - Notwithstanding any other provision of this License, if you modify the -Program, your modified version must prominently offer all users -interacting with it remotely through a computer network (if your version -supports such interaction) an opportunity to receive the Corresponding -Source of your version by providing access to the Corresponding Source -from a network server at no charge, through some standard or customary -means of facilitating copying of software. This Corresponding Source -shall include the Corresponding Source for any work covered by version 3 -of the GNU General Public License that is incorporated pursuant to the -following paragraph. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the work with which it is combined will remain governed by version -3 of the GNU General Public License. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU Affero General Public License from time to time. Such new versions -will be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU Affero General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU Affero General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU Affero General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS Index: src/main/resources/fileTemplates/j2ee/licenses/AGPL-3.0.txt.html =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/AGPL-3.0.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/AGPL-3.0.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

GNU AGPL 3.0 license template

- - Index: src/main/resources/fileTemplates/j2ee/licenses/All-Rights-Reserved.txt.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/All-Rights-Reserved.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/All-Rights-Reserved.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,2 +0,0 @@ -Copyright (c) $YEAR $AUTHOR -All rights reserved. Index: src/main/resources/fileTemplates/j2ee/licenses/All-Rights-Reserved.txt.html =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/All-Rights-Reserved.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/All-Rights-Reserved.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

All Rights Reserved license template

- - Index: src/main/resources/fileTemplates/j2ee/licenses/Apache-2.0.txt.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/Apache-2.0.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/Apache-2.0.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,13 +0,0 @@ -Copyright $YEAR $AUTHOR - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. Index: src/main/resources/fileTemplates/j2ee/licenses/Apache-2.0.txt.html =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/Apache-2.0.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/Apache-2.0.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

Apache 2.0 license template

- - Index: src/main/resources/fileTemplates/j2ee/licenses/BSD-2-Clause-FreeBSD.txt.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/BSD-2-Clause-FreeBSD.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/BSD-2-Clause-FreeBSD.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,26 +0,0 @@ -Copyright (c) $YEAR $AUTHOR -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The views and conclusions contained in the software and documentation are those -of the authors and should not be interpreted as representing official policies, -either expressed or implied, of the FreeBSD Project. Index: src/main/resources/fileTemplates/j2ee/licenses/BSD-2-Clause-FreeBSD.txt.html =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/BSD-2-Clause-FreeBSD.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/BSD-2-Clause-FreeBSD.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

BSD 2-Clause (FreeBSD) License template

- - Index: src/main/resources/fileTemplates/j2ee/licenses/BSD-3-Clause.txt.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/BSD-3-Clause.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/BSD-3-Clause.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,26 +0,0 @@ -#set ( $l = "<" ) -#set ( $g = ">" ) -Copyright (c) $YEAR $AUTHOR -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the $ORGANIZATION nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL $COPYRIGHT_HOLDER BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Index: src/main/resources/fileTemplates/j2ee/licenses/BSD-3-Clause.txt.html =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/BSD-3-Clause.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/BSD-3-Clause.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

BSD 3-Clause (NewBSD) License template

- - Index: src/main/resources/fileTemplates/j2ee/licenses/GPL-3.0.txt.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/GPL-3.0.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/GPL-3.0.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,694 +0,0 @@ -#set ( $l = "<" ) -#set ( $g = ">" ) -Copyright (c) $YEAR $AUTHOR - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program 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 General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see ${l}http://www.gnu.org/licenses/${g} - - - - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. ${l}http://fsf.org/${g} - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - {one line to give the program's name and a brief idea of what it does.} - Copyright (C) {year} {name of author} - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see ${l}http://www.gnu.org/licenses/${g}. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - {project} Copyright (C) {year} {fullname} - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -${l}http://www.gnu.org/licenses/${g}. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -${l}http://www.gnu.org/philosophy/why-not-lgpl.html${g}. - Index: src/main/resources/fileTemplates/j2ee/licenses/GPL-3.0.txt.html =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/GPL-3.0.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/GPL-3.0.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

GNU GPL 3.0 license template

- - Index: src/main/resources/fileTemplates/j2ee/licenses/ISC.txt.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/ISC.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/ISC.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,15 +0,0 @@ -Copyright (c) $YEAR $AUTHOR - -Permission to use, copy, modify, and/or distribute this software for -any purpose with or without fee is hereby granted, provided that the -above copyright notice and this permission notice appear in all -copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL -WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE -AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL -DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR -PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. Index: src/main/resources/fileTemplates/j2ee/licenses/ISC.txt.html =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/ISC.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/ISC.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

Internet Systems Consortium (ISC) License template

- - Index: src/main/resources/fileTemplates/j2ee/licenses/LGPL-3.0.txt.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/LGPL-3.0.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/LGPL-3.0.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,859 +0,0 @@ -#set ( $l = "<" ) -#set ( $g = ">" ) -Copyright (c) $YEAR $AUTHOR - -This program 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, either version 3 of the License, or -(at your option) any later version. - -This program 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 General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License -and a copy of GNU General Public License along with this program. If not, see -${l}http://www.gnu.org/licenses/${g} - - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. ${l}http://fsf.org/${g} - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. - - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. ${l}http://fsf.org/${g} - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - {one line to give the program's name and a brief idea of what it does.} - Copyright (C) {year} {name of author} - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see ${l}http://www.gnu.org/licenses/${g}. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - {project} Copyright (C) {year} {fullname} - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -${l}http://www.gnu.org/licenses/${g}. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -${l}http://www.gnu.org/philosophy/why-not-lgpl.html${g}. - Index: src/main/resources/fileTemplates/j2ee/licenses/LGPL-3.0.txt.html =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/LGPL-3.0.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/LGPL-3.0.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

GNU LGPL 3.0 license template

- - Index: src/main/resources/fileTemplates/j2ee/licenses/MIT.txt.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/MIT.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/MIT.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) $YEAR $AUTHOR - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. Index: src/main/resources/fileTemplates/j2ee/licenses/MIT.txt.html =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/MIT.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/MIT.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

MIT license template

- - Index: src/main/resources/fileTemplates/j2ee/licenses/MPL-2.0.txt.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/MPL-2.0.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/MPL-2.0.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,380 +0,0 @@ -Copyright (c) $YEAR $AUTHOR - -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at http://mozilla.org/MPL/2.0/. - -Mozilla Public License Version 2.0 -================================== - -1. Definitions --------------- - -1.1. "Contributor" - means each individual or legal entity that creates, contributes to - the creation of, or owns Covered Software. - -1.2. "Contributor Version" - means the combination of the Contributions of others (if any) used - by a Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - means Source Code Form to which the initial Contributor has attached - the notice in Exhibit A, the Executable Form of such Source Code - Form, and Modifications of such Source Code Form, in each case - including portions thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - (a) that the initial Contributor has attached the notice described - in Exhibit B to the Covered Software; or - - (b) that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the - terms of a Secondary License. - -1.6. "Executable Form" - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - means a work that combines Covered Software with other material, in - a separate file or files, that is not Covered Software. - -1.8. "License" - means this document. - -1.9. "Licensable" - means having the right to grant, to the maximum extent possible, - whether at the time of the initial grant or subsequently, any and - all of the rights conveyed by this License. - -1.10. "Modifications" - means any of the following: - - (a) any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered - Software; or - - (b) any new file in Source Code Form that contains any Covered - Software. - -1.11. "Patent Claims" of a Contributor - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the - License, by the making, using, selling, offering for sale, having - made, import, or transfer of either its Contributions or its - Contributor Version. - -1.12. "Secondary License" - means either the GNU General Public License, Version 2.0, the GNU - Lesser General Public License, Version 2.1, the GNU Affero General - Public License, Version 3.0, or any later versions of those - licenses. - -1.13. "Source Code Form" - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants and Conditions --------------------------------- - -2.1. Grants - -Each Contributor hereby grants You a world-wide, royalty-free, -non-exclusive license: - -(a) under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - -(b) under Patent Claims of such Contributor to make, use, sell, offer - for sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - -The licenses granted in Section 2.1 with respect to any Contribution -become effective for each Contribution on the date the Contributor first -distributes such Contribution. - -2.3. Limitations on Grant Scope - -The licenses granted in this Section 2 are the only rights granted under -this License. No additional rights or licenses will be implied from the -distribution or licensing of Covered Software under this License. -Notwithstanding Section 2.1(b) above, no patent license is granted by a -Contributor: - -(a) for any code that a Contributor has removed from Covered Software; - or - -(b) for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - -(c) under Patent Claims infringed by Covered Software in the absence of - its Contributions. - -This License does not grant any rights in the trademarks, service marks, -or logos of any Contributor (except as may be necessary to comply with -the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - -No Contributor makes additional grants as a result of Your choice to -distribute the Covered Software under a subsequent version of this -License (see Section 10.2) or under the terms of a Secondary License (if -permitted under the terms of Section 3.3). - -2.5. Representation - -Each Contributor represents that the Contributor believes its -Contributions are its original creation(s) or it has sufficient rights -to grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - -This License is not intended to limit any rights You have under -applicable copyright doctrines of fair use, fair dealing, or other -equivalents. - -2.7. Conditions - -Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted -in Section 2.1. - -3. Responsibilities -------------------- - -3.1. Distribution of Source Form - -All distribution of Covered Software in Source Code Form, including any -Modifications that You create or to which You contribute, must be under -the terms of this License. You must inform recipients that the Source -Code Form of the Covered Software is governed by the terms of this -License, and how they can obtain a copy of this License. You may not -attempt to alter or restrict the recipients' rights in the Source Code -Form. - -3.2. Distribution of Executable Form - -If You distribute Covered Software in Executable Form then: - -(a) such Covered Software must also be made available in Source Code - Form, as described in Section 3.1, and You must inform recipients of - the Executable Form how they can obtain a copy of such Source Code - Form by reasonable means in a timely manner, at a charge no more - than the cost of distribution to the recipient; and - -(b) You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter - the recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - -You may create and distribute a Larger Work under terms of Your choice, -provided that You also comply with the requirements of this License for -the Covered Software. If the Larger Work is a combination of Covered -Software with a work governed by one or more Secondary Licenses, and the -Covered Software is not Incompatible With Secondary Licenses, this -License permits You to additionally distribute such Covered Software -under the terms of such Secondary License(s), so that the recipient of -the Larger Work may, at their option, further distribute the Covered -Software under the terms of either this License or such Secondary -License(s). - -3.4. Notices - -You may not remove or alter the substance of any license notices -(including copyright notices, patent notices, disclaimers of warranty, -or limitations of liability) contained within the Source Code Form of -the Covered Software, except that You may alter any license notices to -the extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - -You may choose to offer, and to charge a fee for, warranty, support, -indemnity or liability obligations to one or more recipients of Covered -Software. However, You may do so only on Your own behalf, and not on -behalf of any Contributor. You must make it absolutely clear that any -such warranty, support, indemnity, or liability obligation is offered by -You alone, and You hereby agree to indemnify every Contributor for any -liability incurred by such Contributor as a result of warranty, support, -indemnity or liability terms You offer. You may include additional -disclaimers of warranty and limitations of liability specific to any -jurisdiction. - -4. Inability to Comply Due to Statute or Regulation ---------------------------------------------------- - -If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Software due to -statute, judicial order, or regulation then You must: (a) comply with -the terms of this License to the maximum extent possible; and (b) -describe the limitations and the code they affect. Such description must -be placed in a text file included with all distributions of the Covered -Software under this License. Except to the extent prohibited by statute -or regulation, such description must be sufficiently detailed for a -recipient of ordinary skill to be able to understand it. - -5. Termination --------------- - -5.1. The rights granted under this License will terminate automatically -if You fail to comply with any of its terms. However, if You become -compliant, then the rights granted under this License from a particular -Contributor are reinstated (a) provisionally, unless and until such -Contributor explicitly and finally terminates Your grants, and (b) on an -ongoing basis, if such Contributor fails to notify You of the -non-compliance by some reasonable means prior to 60 days after You have -come back into compliance. Moreover, Your grants from a particular -Contributor are reinstated on an ongoing basis if such Contributor -notifies You of the non-compliance by some reasonable means, this is the -first time You have received notice of non-compliance with this License -from such Contributor, and You become compliant prior to 30 days after -Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent -infringement claim (excluding declaratory judgment actions, -counter-claims, and cross-claims) alleging that a Contributor Version -directly or indirectly infringes any patent, then the rights granted to -You by any and all Contributors for the Covered Software under Section -2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all -end user license agreements (excluding distributors and resellers) which -have been validly granted by You or Your distributors under this License -prior to termination shall survive termination. - -************************************************************************ -* * -* 6. Disclaimer of Warranty * -* ------------------------- * -* * -* Covered Software is provided under this License on an "as is" * -* basis, without warranty of any kind, either expressed, implied, or * -* statutory, including, without limitation, warranties that the * -* Covered Software is free of defects, merchantable, fit for a * -* particular purpose or non-infringing. The entire risk as to the * -* quality and performance of the Covered Software is with You. * -* Should any Covered Software prove defective in any respect, You * -* (not any Contributor) assume the cost of any necessary servicing, * -* repair, or correction. This disclaimer of warranty constitutes an * -* essential part of this License. No use of any Covered Software is * -* authorized under this License except under this disclaimer. * -* * -************************************************************************ - -************************************************************************ -* * -* 7. Limitation of Liability * -* -------------------------- * -* * -* Under no circumstances and under no legal theory, whether tort * -* (including negligence), contract, or otherwise, shall any * -* Contributor, or anyone who distributes Covered Software as * -* permitted above, be liable to You for any direct, indirect, * -* special, incidental, or consequential damages of any character * -* including, without limitation, damages for lost profits, loss of * -* goodwill, work stoppage, computer failure or malfunction, or any * -* and all other commercial damages or losses, even if such party * -* shall have been informed of the possibility of such damages. This * -* limitation of liability shall not apply to liability for death or * -* personal injury resulting from such party's negligence to the * -* extent applicable law prohibits such limitation. Some * -* jurisdictions do not allow the exclusion or limitation of * -* incidental or consequential damages, so this exclusion and * -* limitation may not apply to You. * -* * -************************************************************************ - -8. Litigation -------------- - -Any litigation relating to this License may be brought only in the -courts of a jurisdiction where the defendant maintains its principal -place of business and such litigation shall be governed by laws of that -jurisdiction, without reference to its conflict-of-law provisions. -Nothing in this Section shall prevent a party's ability to bring -cross-claims or counter-claims. - -9. Miscellaneous ----------------- - -This License represents the complete agreement concerning the subject -matter hereof. If any provision of this License is held to be -unenforceable, such provision shall be reformed only to the extent -necessary to make it enforceable. Any law or regulation which provides -that the language of a contract shall be construed against the drafter -shall not be used to construe this License against a Contributor. - -10. Versions of the License ---------------------------- - -10.1. New Versions - -Mozilla Foundation is the license steward. Except as provided in Section -10.3, no one other than the license steward has the right to modify or -publish new versions of this License. Each version will be given a -distinguishing version number. - -10.2. Effect of New Versions - -You may distribute the Covered Software under the terms of the version -of the License under which You originally received the Covered Software, -or under the terms of any subsequent version published by the license -steward. - -10.3. Modified Versions - -If you create software not governed by this License, and you want to -create a new license for such software, you may create and use a -modified version of this License if you rename the license and remove -any references to the name of the license steward (except to note that -such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary -Licenses - -If You choose to distribute Source Code Form that is Incompatible With -Secondary Licenses under the terms of this version of the License, the -notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice -------------------------------------------- - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular -file, then You may include the notice in a location (such as a LICENSE -file in a relevant directory) where a recipient would be likely to look -for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice ---------------------------------------------------------- - - This Source Code Form is "Incompatible With Secondary Licenses", as - defined by the Mozilla Public License, v. 2.0. - Index: src/main/resources/fileTemplates/j2ee/licenses/MPL-2.0.txt.html =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/MPL-2.0.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/MPL-2.0.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

Mozilla Public License 2.0 license template

- - Index: src/main/resources/fileTemplates/j2ee/licenses/unlicense.txt.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/unlicense.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/unlicense.txt.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,26 +0,0 @@ -#set ( $l = "<" ) -#set ( $g = ">" ) -This is free and unencumbered software released into the public domain. - -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. - -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -For more information, please refer to ${l}http://unlicense.org/${g} Index: src/main/resources/fileTemplates/j2ee/licenses/unlicense.txt.html =================================================================== --- src/main/resources/fileTemplates/j2ee/licenses/unlicense.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/licenses/unlicense.txt.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

Unlicense license template

- - Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.20.5) Config.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.20.5) Config.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.20.5) Config.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,63 +0,0 @@ -package ${PACKAGE_NAME}; - -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.Item; -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.EventBusSubscriber; -import net.neoforged.fml.event.config.ModConfigEvent; -import net.neoforged.neoforge.common.ModConfigSpec; - -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -// An example config class. This is not required, but it's a good idea to have one to keep your config organized. -// Demonstrates how to use Neo's config APIs -@EventBusSubscriber(modid = ${CLASS_NAME}.MODID, bus = EventBusSubscriber.Bus.MOD) -public class Config -{ - private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder(); - - private static final ModConfigSpec.BooleanValue LOG_DIRT_BLOCK = BUILDER - .comment("Whether to log the dirt block on common setup") - .define("logDirtBlock", true); - - private static final ModConfigSpec.IntValue MAGIC_NUMBER = BUILDER - .comment("A magic number") - .defineInRange("magicNumber", 42, 0, Integer.MAX_VALUE); - - public static final ModConfigSpec.ConfigValue MAGIC_NUMBER_INTRODUCTION = BUILDER - .comment("What you want the introduction message to be for the magic number") - .define("magicNumberIntroduction", "The magic number is... "); - - // a list of strings that are treated as resource locations for items - private static final ModConfigSpec.ConfigValue> ITEM_STRINGS = BUILDER - .comment("A list of items to log on common setup.") - .defineListAllowEmpty("items", List.of("minecraft:iron_ingot"), Config::validateItemName); - - static final ModConfigSpec SPEC = BUILDER.build(); - - public static boolean logDirtBlock; - public static int magicNumber; - public static String magicNumberIntroduction; - public static Set items; - - private static boolean validateItemName(final Object obj) - { - return obj instanceof String itemName && BuiltInRegistries.ITEM.containsKey(new ResourceLocation(itemName)); - } - - @SubscribeEvent - static void onLoad(final ModConfigEvent event) - { - logDirtBlock = LOG_DIRT_BLOCK.get(); - magicNumber = MAGIC_NUMBER.get(); - magicNumberIntroduction = MAGIC_NUMBER_INTRODUCTION.get(); - - // convert the list of strings into a set of items - items = ITEM_STRINGS.get().stream() - .map(itemName -> BuiltInRegistries.ITEM.get(new ResourceLocation(itemName))) - .collect(Collectors.toSet()); - } -} Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.20.5) Config.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.20.5) Config.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.20.5) Config.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new config class for NeoForge 1.20.5 projects.

- - Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.20.5) Main Class.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.20.5) Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.20.5) Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,134 +0,0 @@ -package ${PACKAGE_NAME}; - -import com.mojang.logging.LogUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.core.registries.Registries; -import net.minecraft.network.chat.Component; -import net.minecraft.world.food.FoodProperties; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.CreativeModeTab; -import net.minecraft.world.item.CreativeModeTabs; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.state.BlockBehaviour; -import net.minecraft.world.level.material.MapColor; -import net.neoforged.api.distmarker.Dist; -import net.neoforged.bus.api.IEventBus; -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.ModContainer; -import net.neoforged.fml.common.EventBusSubscriber; -import net.neoforged.fml.common.Mod; -import net.neoforged.fml.config.ModConfig; -import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; -import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; -import net.neoforged.neoforge.common.NeoForge; -import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent; -import net.neoforged.neoforge.event.server.ServerStartingEvent; -import net.neoforged.neoforge.registries.DeferredBlock; -import net.neoforged.neoforge.registries.DeferredHolder; -import net.neoforged.neoforge.registries.DeferredItem; -import net.neoforged.neoforge.registries.DeferredRegister; -import org.slf4j.Logger; - -// The value here should match an entry in the META-INF/neoforge.mods.toml file -@Mod(${CLASS_NAME}.MODID) -public class ${CLASS_NAME} -{ - // Define mod id in a common place for everything to reference - public static final String MODID = "${MOD_ID}"; - // Directly reference a slf4j logger - private static final Logger LOGGER = LogUtils.getLogger(); - // Create a Deferred Register to hold Blocks which will all be registered under the "${MOD_ID}" namespace - public static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks(MODID); - // Create a Deferred Register to hold Items which will all be registered under the "${MOD_ID}" namespace - public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(MODID); - // Create a Deferred Register to hold CreativeModeTabs which will all be registered under the "${MOD_ID}" namespace - public static final DeferredRegister CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MODID); - - // Creates a new Block with the id "${MOD_ID}:example_block", combining the namespace and path - public static final DeferredBlock EXAMPLE_BLOCK = BLOCKS.registerSimpleBlock("example_block", BlockBehaviour.Properties.of().mapColor(MapColor.STONE)); - // Creates a new BlockItem with the id "${MOD_ID}:example_block", combining the namespace and path - public static final DeferredItem EXAMPLE_BLOCK_ITEM = ITEMS.registerSimpleBlockItem("example_block", EXAMPLE_BLOCK); - - // Creates a new food item with the id "${MOD_ID}:example_id", nutrition 1 and saturation 2 - public static final DeferredItem EXAMPLE_ITEM = ITEMS.registerSimpleItem("example_item", new Item.Properties().food(new FoodProperties.Builder() - .alwaysEdible().nutrition(1).saturationModifier(2f).build())); - - // Creates a creative tab with the id "${MOD_ID}:example_tab" for the example item, that is placed after the combat tab - public static final DeferredHolder EXAMPLE_TAB = CREATIVE_MODE_TABS.register("example_tab", () -> CreativeModeTab.builder() - .title(Component.translatable("itemGroup.${MOD_ID}")) - .withTabsBefore(CreativeModeTabs.COMBAT) - .icon(() -> EXAMPLE_ITEM.get().getDefaultInstance()) - .displayItems((parameters, output) -> { - output.accept(EXAMPLE_ITEM.get()); // Add the example item to the tab. For your own tabs, this method is preferred over the event - }).build()); - - // The constructor for the mod class is the first code that is run when your mod is loaded. - // FML will recognize some parameter types like IEventBus or ModContainer and pass them in automatically. - public ${CLASS_NAME}(IEventBus modEventBus, ModContainer modContainer) - { - // Register the commonSetup method for modloading - modEventBus.addListener(this::commonSetup); - - // Register the Deferred Register to the mod event bus so blocks get registered - BLOCKS.register(modEventBus); - // Register the Deferred Register to the mod event bus so items get registered - ITEMS.register(modEventBus); - // Register the Deferred Register to the mod event bus so tabs get registered - CREATIVE_MODE_TABS.register(modEventBus); - - // Register ourselves for server and other game events we are interested in. - // Note that this is necessary if and only if we want *this* class (ExampleMod) to respond directly to events. - // Do not add this line if there are no @SubscribeEvent-annotated functions in this class, like onServerStarting() below. - NeoForge.EVENT_BUS.register(this); - - // Register the item to a creative tab - modEventBus.addListener(this::addCreative); - - // Register our mod's ModConfigSpec so that FML can create and load the config file for us - modContainer.registerConfig(ModConfig.Type.COMMON, Config.SPEC); - } - - private void commonSetup(final FMLCommonSetupEvent event) - { - // Some common setup code - LOGGER.info("HELLO FROM COMMON SETUP"); - - if (Config.logDirtBlock) - LOGGER.info("DIRT BLOCK >> {}", BuiltInRegistries.BLOCK.getKey(Blocks.DIRT)); - - LOGGER.info(Config.magicNumberIntroduction + Config.magicNumber); - - Config.items.forEach((item) -> LOGGER.info("ITEM >> {}", item.toString())); - } - - // Add the example block item to the building blocks tab - private void addCreative(BuildCreativeModeTabContentsEvent event) - { - if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) - event.accept(EXAMPLE_BLOCK_ITEM); - } - - // You can use SubscribeEvent and let the Event Bus discover methods to call - @SubscribeEvent - public void onServerStarting(ServerStartingEvent event) - { - // Do something when the server starts - LOGGER.info("HELLO from server starting"); - } - - // You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent - @EventBusSubscriber(modid = MODID, bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) - public static class ClientModEvents - { - @SubscribeEvent - public static void onClientSetup(FMLClientSetupEvent event) - { - // Some client setup code - LOGGER.info("HELLO FROM CLIENT SETUP"); - LOGGER.info("MINECRAFT NAME >> {}", Minecraft.getInstance().getUser().getName()); - } - } -} Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.20.5) Main Class.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.20.5) Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.20.5) Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new main class for NeoForge 1.20.5 projects.

- - Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.20.5) build.gradle.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.20.5) build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.20.5) build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,151 +0,0 @@ -plugins { - id 'java-library' - id 'eclipse' - id 'idea' - id 'maven-publish' - id 'net.neoforged.gradle.userdev' version '${NEOGRADLE_VERSION}' -} - -version = mod_version -group = mod_group_id - -repositories { - mavenLocal() -} - -base { - archivesName = mod_id -} - -java.toolchain.languageVersion = JavaLanguageVersion.of(${JAVA_VERSION}) - -//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg') -//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager - -// Default run configurations. -// These can be tweaked, removed, or duplicated as needed. -runs { - // applies to all the run configs below - configureEach { - // Recommended logging data for a userdev environment - // The markers can be added/remove as needed separated by commas. - // "SCAN": For mods scan. - // "REGISTRIES": For firing of registry events. - // "REGISTRYDUMP": For getting the contents of all registries. - systemProperty 'forge.logging.markers', 'REGISTRIES' - - // Recommended logging level for the console - // You can set various levels here. - // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels - systemProperty 'forge.logging.console.level', 'debug' - - modSource project.sourceSets.main - } - - client { - // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. - systemProperty 'forge.enabledGameTestNamespaces', project.mod_id - } - - server { - systemProperty 'forge.enabledGameTestNamespaces', project.mod_id - programArgument '--nogui' - } - - // This run config launches GameTestServer and runs all registered gametests, then exits. - // By default, the server will crash when no gametests are provided. - // The gametest system is also enabled by default for other run configs under the /test command. - gameTestServer { - systemProperty 'forge.enabledGameTestNamespaces', project.mod_id - } - - data { - // example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it - // workingDirectory project.file('run-data') - - // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. - programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() - } -} - -// Include resources generated by data generators. -sourceSets.main.resources { srcDir 'src/generated/resources' } - - -dependencies { - // Specify the version of Minecraft to use. - // Depending on the plugin applied there are several options. We will assume you applied the userdev plugin as shown above. - // The group for userdev is net.neoforge, the module name is neoforge, and the version is the same as the neoforge version. - // You can however also use the vanilla plugin (net.neoforged.gradle.vanilla) to use a version of Minecraft without the neoforge loader. - // And its provides the option to then use net.minecraft as the group, and one of; client, server or joined as the module name, plus the game version as version. - // For all intends and purposes: You can treat this dependency as if it is a normal library you would use. - implementation "net.neoforged:neoforge:${neo_version}" - - // Example mod dependency with JEI - // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime - // compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}" - // compileOnly "mezz.jei:jei-${mc_version}-forge-api:${jei_version}" - // runtimeOnly "mezz.jei:jei-${mc_version}-forge:${jei_version}" - - // Example mod dependency using a mod jar from ./libs with a flat dir repository - // This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar - // The group id is ignored when searching -- in this case, it is "blank" - // implementation "blank:coolmod-${mc_version}:${coolmod_version}" - - // Example mod dependency using a file as dependency - // implementation files("libs/coolmod-${mc_version}-${coolmod_version}.jar") - - // Example project dependency using a sister or child project: - // implementation project(":myproject") - - // For more info: - // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html - // http://www.gradle.org/docs/current/userguide/dependency_management.html -} - -// This block of code expands all declared replace properties in the specified resource targets. -// A missing property will result in an error. Properties are expanded using ${} Groovy notation. -// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments. -// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html -tasks.withType(ProcessResources).configureEach { - var replaceProperties = [ - minecraft_version : minecraft_version, - minecraft_version_range: minecraft_version_range, - neo_version : neo_version, - neo_version_range : neo_version_range, - loader_version_range : loader_version_range, - mod_id : mod_id, - mod_name : mod_name, - mod_license : mod_license, - mod_version : mod_version, - mod_authors : mod_authors, - mod_description : mod_description - ] - inputs.properties replaceProperties - - filesMatching(['META-INF/neoforge.mods.toml']) { - expand replaceProperties - } -} - -// Example configuration to allow publishing using the maven-publish plugin -publishing { - publications { - register('mavenJava', MavenPublication) { - from components.java - } - } - repositories { - maven { - url "file://${project.projectDir}/repo" - } - } -} - -// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior. -idea { - module { - downloadSources = true - downloadJavadoc = true - } -} Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.20.5) build.gradle.html =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.20.5) build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.20.5) build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new build.gradle for NeoForge (1.20.5) projects.

- - Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.21) Config.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.21) Config.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.21) Config.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,63 +0,0 @@ -package ${PACKAGE_NAME}; - -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.Item; -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.EventBusSubscriber; -import net.neoforged.fml.event.config.ModConfigEvent; -import net.neoforged.neoforge.common.ModConfigSpec; - -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -// An example config class. This is not required, but it's a good idea to have one to keep your config organized. -// Demonstrates how to use Neo's config APIs -@EventBusSubscriber(modid = ${CLASS_NAME}.MODID, bus = EventBusSubscriber.Bus.MOD) -public class Config -{ - private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder(); - - private static final ModConfigSpec.BooleanValue LOG_DIRT_BLOCK = BUILDER - .comment("Whether to log the dirt block on common setup") - .define("logDirtBlock", true); - - private static final ModConfigSpec.IntValue MAGIC_NUMBER = BUILDER - .comment("A magic number") - .defineInRange("magicNumber", 42, 0, Integer.MAX_VALUE); - - public static final ModConfigSpec.ConfigValue MAGIC_NUMBER_INTRODUCTION = BUILDER - .comment("What you want the introduction message to be for the magic number") - .define("magicNumberIntroduction", "The magic number is... "); - - // a list of strings that are treated as resource locations for items - private static final ModConfigSpec.ConfigValue> ITEM_STRINGS = BUILDER - .comment("A list of items to log on common setup.") - .defineListAllowEmpty("items", List.of("minecraft:iron_ingot"), Config::validateItemName); - - static final ModConfigSpec SPEC = BUILDER.build(); - - public static boolean logDirtBlock; - public static int magicNumber; - public static String magicNumberIntroduction; - public static Set items; - - private static boolean validateItemName(final Object obj) - { - return obj instanceof String itemName && BuiltInRegistries.ITEM.containsKey(ResourceLocation.parse(itemName)); - } - - @SubscribeEvent - static void onLoad(final ModConfigEvent event) - { - logDirtBlock = LOG_DIRT_BLOCK.get(); - magicNumber = MAGIC_NUMBER.get(); - magicNumberIntroduction = MAGIC_NUMBER_INTRODUCTION.get(); - - // convert the list of strings into a set of items - items = ITEM_STRINGS.get().stream() - .map(itemName -> BuiltInRegistries.ITEM.get(ResourceLocation.parse(itemName))) - .collect(Collectors.toSet()); - } -} Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.21) Config.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.21) Config.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge (1.21) Config.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new config class for NeoForge 1.21 projects.

- - Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge Config.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge Config.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge Config.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,63 +0,0 @@ -package ${PACKAGE_NAME}; - -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.Item; -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.Mod; -import net.neoforged.fml.event.config.ModConfigEvent; -import net.neoforged.neoforge.common.ModConfigSpec; - -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -// An example config class. This is not required, but it's a good idea to have one to keep your config organized. -// Demonstrates how to use Forge's config APIs -@Mod.EventBusSubscriber(modid = ${CLASS_NAME}.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) -public class Config -{ - private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder(); - - private static final ModConfigSpec.BooleanValue LOG_DIRT_BLOCK = BUILDER - .comment("Whether to log the dirt block on common setup") - .define("logDirtBlock", true); - - private static final ModConfigSpec.IntValue MAGIC_NUMBER = BUILDER - .comment("A magic number") - .defineInRange("magicNumber", 42, 0, Integer.MAX_VALUE); - - public static final ModConfigSpec.ConfigValue MAGIC_NUMBER_INTRODUCTION = BUILDER - .comment("What you want the introduction message to be for the magic number") - .define("magicNumberIntroduction", "The magic number is... "); - - // a list of strings that are treated as resource locations for items - private static final ModConfigSpec.ConfigValue> ITEM_STRINGS = BUILDER - .comment("A list of items to log on common setup.") - .defineListAllowEmpty("items", List.of("minecraft:iron_ingot"), Config::validateItemName); - - static final ModConfigSpec SPEC = BUILDER.build(); - - public static boolean logDirtBlock; - public static int magicNumber; - public static String magicNumberIntroduction; - public static Set items; - - private static boolean validateItemName(final Object obj) - { - return obj instanceof String itemName && BuiltInRegistries.ITEM.containsKey(new ResourceLocation(itemName)); - } - - @SubscribeEvent - static void onLoad(final ModConfigEvent event) - { - logDirtBlock = LOG_DIRT_BLOCK.get(); - magicNumber = MAGIC_NUMBER.get(); - magicNumberIntroduction = MAGIC_NUMBER_INTRODUCTION.get(); - - // convert the list of strings into a set of items - items = ITEM_STRINGS.get().stream() - .map(itemName -> BuiltInRegistries.ITEM.get(new ResourceLocation(itemName))) - .collect(Collectors.toSet()); - } -} Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge Config.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge Config.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge Config.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new config class for NeoForge projects.

- - Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge Main Class.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,133 +0,0 @@ -package ${PACKAGE_NAME}; - -import com.mojang.logging.LogUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.core.registries.Registries; -import net.minecraft.network.chat.Component; -import net.minecraft.world.food.FoodProperties; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.CreativeModeTab; -import net.minecraft.world.item.CreativeModeTabs; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.state.BlockBehaviour; -import net.minecraft.world.level.material.MapColor; -import net.neoforged.api.distmarker.Dist; -import net.neoforged.bus.api.IEventBus; -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.ModLoadingContext; -import net.neoforged.fml.common.Mod; -import net.neoforged.fml.config.ModConfig; -import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; -import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; -import net.neoforged.neoforge.common.NeoForge; -import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent; -import net.neoforged.neoforge.event.server.ServerStartingEvent; -import net.neoforged.neoforge.registries.DeferredBlock; -import net.neoforged.neoforge.registries.DeferredHolder; -import net.neoforged.neoforge.registries.DeferredItem; -import net.neoforged.neoforge.registries.DeferredRegister; -import org.slf4j.Logger; - -// The value here should match an entry in the META-INF/mods.toml file -@Mod(${CLASS_NAME}.MODID) -public class ${CLASS_NAME} -{ - // Define mod id in a common place for everything to reference - public static final String MODID = "${MOD_ID}"; - // Directly reference a slf4j logger - private static final Logger LOGGER = LogUtils.getLogger(); - // Create a Deferred Register to hold Blocks which will all be registered under the "${MOD_ID}" namespace - public static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks(MODID); - // Create a Deferred Register to hold Items which will all be registered under the "${MOD_ID}" namespace - public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(MODID); - // Create a Deferred Register to hold CreativeModeTabs which will all be registered under the "${MOD_ID}" namespace - public static final DeferredRegister CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MODID); - - // Creates a new Block with the id "${MOD_ID}:example_block", combining the namespace and path - public static final DeferredBlock EXAMPLE_BLOCK = BLOCKS.registerSimpleBlock("example_block", BlockBehaviour.Properties.of().mapColor(MapColor.STONE)); - // Creates a new BlockItem with the id "${MOD_ID}:example_block", combining the namespace and path - public static final DeferredItem EXAMPLE_BLOCK_ITEM = ITEMS.registerSimpleBlockItem("example_block", EXAMPLE_BLOCK); - - // Creates a new food item with the id "${MOD_ID}:example_id", nutrition 1 and saturation 2 - public static final DeferredItem EXAMPLE_ITEM = ITEMS.registerSimpleItem("example_item", new Item.Properties().food(new FoodProperties.Builder() - .alwaysEat().nutrition(1).saturationMod(2f).build())); - - // Creates a creative tab with the id "${MOD_ID}:example_tab" for the example item, that is placed after the combat tab - public static final DeferredHolder EXAMPLE_TAB = CREATIVE_MODE_TABS.register("example_tab", () -> CreativeModeTab.builder() - .title(Component.translatable("itemGroup.${MOD_ID}")) - .withTabsBefore(CreativeModeTabs.COMBAT) - .icon(() -> EXAMPLE_ITEM.get().getDefaultInstance()) - .displayItems((parameters, output) -> { - output.accept(EXAMPLE_ITEM.get()); // Add the example item to the tab. For your own tabs, this method is preferred over the event - }).build()); - - // The constructor for the mod class is the first code that is run when your mod is loaded. - // FML will recognize some parameter types like IEventBus or ModContainer and pass them in automatically. - public ${CLASS_NAME}(IEventBus modEventBus) - { - // Register the commonSetup method for modloading - modEventBus.addListener(this::commonSetup); - - // Register the Deferred Register to the mod event bus so blocks get registered - BLOCKS.register(modEventBus); - // Register the Deferred Register to the mod event bus so items get registered - ITEMS.register(modEventBus); - // Register the Deferred Register to the mod event bus so tabs get registered - CREATIVE_MODE_TABS.register(modEventBus); - - // Register ourselves for server and other game events we are interested in. - // Note that this is necessary if and only if we want *this* class (ExampleMod) to respond directly to events. - // Do not add this line if there are no @SubscribeEvent-annotated functions in this class, like onServerStarting() below. - NeoForge.EVENT_BUS.register(this); - - // Register the item to a creative tab - modEventBus.addListener(this::addCreative); - - // Register our mod's ModConfigSpec so that FML can create and load the config file for us - ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.SPEC); - } - - private void commonSetup(final FMLCommonSetupEvent event) - { - // Some common setup code - LOGGER.info("HELLO FROM COMMON SETUP"); - - if (Config.logDirtBlock) - LOGGER.info("DIRT BLOCK >> {}", BuiltInRegistries.BLOCK.getKey(Blocks.DIRT)); - - LOGGER.info(Config.magicNumberIntroduction + Config.magicNumber); - - Config.items.forEach((item) -> LOGGER.info("ITEM >> {}", item.toString())); - } - - // Add the example block item to the building blocks tab - private void addCreative(BuildCreativeModeTabContentsEvent event) - { - if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) - event.accept(EXAMPLE_BLOCK_ITEM); - } - - // You can use SubscribeEvent and let the Event Bus discover methods to call - @SubscribeEvent - public void onServerStarting(ServerStartingEvent event) - { - // Do something when the server starts - LOGGER.info("HELLO from server starting"); - } - - // You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent - @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) - public static class ClientModEvents - { - @SubscribeEvent - public static void onClientSetup(FMLClientSetupEvent event) - { - // Some client setup code - LOGGER.info("HELLO FROM CLIENT SETUP"); - LOGGER.info("MINECRAFT NAME >> {}", Minecraft.getInstance().getUser().getName()); - } - } -} Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge Main Class.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new main class for NeoForge projects.

- - Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge Mixins Config.json.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge Mixins Config.json.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge Mixins Config.json.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,14 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "${PACKAGE_NAME}", - "compatibilityLevel": "JAVA_8", - "refmap": "${MOD_ID}.refmap.json", - "mixins": [ - ], - "client": [ - ], - "injectors": { - "defaultRequire": 1 - } -} Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge Mixins Config.json.html =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge Mixins Config.json.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge Mixins Config.json.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new modid.mixins.json file for NeoForge projects.

- - Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge build.gradle.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,155 +0,0 @@ -plugins { - id 'java-library' - id 'eclipse' - id 'idea' - id 'maven-publish' - id 'net.neoforged.gradle.userdev' version '${NEOGRADLE_VERSION}' -} - -version = mod_version -group = mod_group_id - -repositories { - mavenLocal() -} - -base { - archivesName = mod_id -} - -java.toolchain.languageVersion = JavaLanguageVersion.of(${JAVA_VERSION}) - -//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg') -//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager - -// Default run configurations. -// These can be tweaked, removed, or duplicated as needed. -runs { - // applies to all the run configs below - configureEach { - // Recommended logging data for a userdev environment - // The markers can be added/remove as needed separated by commas. - // "SCAN": For mods scan. - // "REGISTRIES": For firing of registry events. - // "REGISTRYDUMP": For getting the contents of all registries. - systemProperty 'forge.logging.markers', 'REGISTRIES' - - // Recommended logging level for the console - // You can set various levels here. - // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels - systemProperty 'forge.logging.console.level', 'debug' - - modSource project.sourceSets.main - } - - client { - // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. - systemProperty 'forge.enabledGameTestNamespaces', project.mod_id - } - - server { - systemProperty 'forge.enabledGameTestNamespaces', project.mod_id - programArgument '--nogui' - } - - // This run config launches GameTestServer and runs all registered gametests, then exits. - // By default, the server will crash when no gametests are provided. - // The gametest system is also enabled by default for other run configs under the /test command. - gameTestServer { - systemProperty 'forge.enabledGameTestNamespaces', project.mod_id - } - - data { - // example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it - // workingDirectory project.file('run-data') - - // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. - programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() - } -} - -// Include resources generated by data generators. -sourceSets.main.resources { srcDir 'src/generated/resources' } - - -dependencies { - // Specify the version of Minecraft to use. - // Depending on the plugin applied there are several options. We will assume you applied the userdev plugin as shown above. - // The group for userdev is net.neoforge, the module name is neoforge, and the version is the same as the neoforge version. - // You can however also use the vanilla plugin (net.neoforged.gradle.vanilla) to use a version of Minecraft without the neoforge loader. - // And its provides the option to then use net.minecraft as the group, and one of; client, server or joined as the module name, plus the game version as version. - // For all intends and purposes: You can treat this dependency as if it is a normal library you would use. - implementation "net.neoforged:neoforge:${neo_version}" - - // Example mod dependency with JEI - // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime - // compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}" - // compileOnly "mezz.jei:jei-${mc_version}-forge-api:${jei_version}" - // runtimeOnly "mezz.jei:jei-${mc_version}-forge:${jei_version}" - - // Example mod dependency using a mod jar from ./libs with a flat dir repository - // This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar - // The group id is ignored when searching -- in this case, it is "blank" - // implementation "blank:coolmod-${mc_version}:${coolmod_version}" - - // Example mod dependency using a file as dependency - // implementation files("libs/coolmod-${mc_version}-${coolmod_version}.jar") - - // Example project dependency using a sister or child project: - // implementation project(":myproject") - - // For more info: - // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html - // http://www.gradle.org/docs/current/userguide/dependency_management.html -} - -// This block of code expands all declared replace properties in the specified resource targets. -// A missing property will result in an error. Properties are expanded using ${} Groovy notation. -// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments. -// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html -tasks.withType(ProcessResources).configureEach { - var replaceProperties = [ - minecraft_version : minecraft_version, - minecraft_version_range: minecraft_version_range, - neo_version : neo_version, - neo_version_range : neo_version_range, - loader_version_range : loader_version_range, - mod_id : mod_id, - mod_name : mod_name, - mod_license : mod_license, - mod_version : mod_version, - mod_authors : mod_authors, - mod_description : mod_description - ] - inputs.properties replaceProperties - - filesMatching(['META-INF/mods.toml']) { - expand replaceProperties - } -} - -// Example configuration to allow publishing using the maven-publish plugin -publishing { - publications { - register('mavenJava', MavenPublication) { - from components.java - } - } - repositories { - maven { - url "file://${project.projectDir}/repo" - } - } -} - -tasks.withType(JavaCompile).configureEach { - options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation -} - -// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior. -idea { - module { - downloadSources = true - downloadJavadoc = true - } -} Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge build.gradle.html =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new build.gradle for NeoForge projects.

- - Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge gradle.properties.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge gradle.properties.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge gradle.properties.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,48 +0,0 @@ -# Sets default memory used for gradle commands. Can be overridden by user or command line properties. -org.gradle.jvmargs=-Xmx2G -org.gradle.daemon=false -org.gradle.debug=false - -#[[##]]# Environment Properties -# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge -# The Minecraft version must agree with the Neo version to get a valid artifact -minecraft_version=${MC_VERSION} -# The Minecraft version range can use any release version of Minecraft as bounds. -# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly -# as they do not follow standard versioning conventions. -minecraft_version_range=[${MC_VERSION},${MC_NEXT_VERSION}) -# The Neo version must agree with the Minecraft version to get a valid artifact -neo_version=${NEOFORGE_VERSION} -# The Neo version range can use any version of Neo as bounds -neo_version_range=[${NEOFORGE_SPEC_VERSION},) -# The loader version range can only use the major version of FML as bounds -loader_version_range=[${LOADER_VERSION},) - -#if (${PARCHMENT_VERSION}) -neogradle.subsystems.parchment.minecraftVersion=${PARCHMENT_MC_VERSION} -neogradle.subsystems.parchment.mappingsVersion=${PARCHMENT_VERSION} -#else -# Uncomment this to activate parchment -#neogradle.subsystems.parchment.minecraftVersion=${MC_VERSION} -#neogradle.subsystems.parchment.mappingsVersion=SET_ME -#end - -#[[##]]# Mod Properties - -# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63} -# Must match the String constant located in the main mod class annotated with @Mod. -mod_id=${MOD_ID} -# The human-readable display name for the mod. -mod_name=${MOD_NAME} -# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. -mod_license=${LICENSE} -# The mod version. See https://semver.org/ -mod_version=${MOD_VERSION} -# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. -# This should match the base package used for the mod sources. -# See https://maven.apache.org/guides/mini/guide-naming-conventions.html -mod_group_id=${GROUP_ID} -# The authors of the mod. This is a simple text string that is used for display purposes in the mod list. -mod_authors=${AUTHOR_LIST} -# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list. -mod_description=${DESCRIPTION} Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge gradle.properties.html =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge gradle.properties.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge gradle.properties.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new gradle.properties file for NeoForge projects.

- - Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge mods.toml.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge mods.toml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge mods.toml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,100 +0,0 @@ -# This is an example mods.toml file. It contains the data relating to the loading mods. -# There are several mandatory fields (#mandatory), and many more that are optional (#optional). -# The overall format is standard TOML format, v0.5.0. -# Note that there are a couple of TOML lists in this file. -# Find more information on toml format here: https://github.com/toml-lang/toml -# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml -modLoader="javafml" #mandatory -# A version range to match for said mod loader - for regular FML @Mod it will be the the FML version. This is currently 47. -loaderVersion="${loader_version_range}" #mandatory -# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. -# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. -license="${mod_license}" -# A URL to refer people to when problems occur with this mod -#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional -# A list of mods - how many allowed here is determined by the individual mod loader -[[mods]] #mandatory -# The modid of the mod -modId="${mod_id}" #mandatory -# The version number of the mod -version="${mod_version}" #mandatory -# A display name for the mod -displayName="${mod_name}" #mandatory -# A URL to query for updates for this mod. See the JSON update specification https://docs.neoforge.net/docs/misc/updatechecker/ -#if (${UPDATE_URL}) -updateJSONURL="${UPDATE_URL}" #optional -#else -#updateJSONURL="https://change.me.example.invalid/updates.json" #optional -#end -# A URL for the "homepage" for this mod, displayed in the mod UI -#if (${WEBSITE}) -displayURL="${WEBSITE}" #optional -#else -#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional -#end -# A file name (in the root of the mod JAR) containing a logo for display -#logoFile="${MOD_ID}.png" #optional -# A text field displayed in the mod UI -#credits="" #optional -# A text field displayed in the mod UI -authors="${mod_authors}" #optional -# Display Test controls the display for your mod in the server connection screen -# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod. -# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod. -# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component. -# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value. -# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself. -#displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional) - -# The description text for the mod (multi line!) (#mandatory) -description='''${mod_description}''' - -#set ( $h = "#" ) -# The [[mixins]] block allows you to declare your mixin config to FML so that it gets loaded. -#if (${MIXIN_CONFIG}) -[[mixins]] -config="${MIXIN_CONFIG}" -#else -${h}[[mixins]] -#config="${mod_id}.mixins.json" -#end - -# The [[accessTransformers]] block allows you to declare where your AT file is. -# If this block is omitted, a fallback attempt will be made to load an AT from META-INF/accesstransformer.cfg -${h}[[accessTransformers]] -#file="META-INF/accesstransformer.cfg" - -# The coremods config file path is not configurable and is always loaded from META-INF/coremods.json - -# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. -[[dependencies."${mod_id}"]] #optional -# the modid of the dependency -modId="neoforge" #mandatory -# The type of the dependency. Can be one of "required", "optional", "incompatible" or "discouraged" (case insensitive). -# 'required' requires the mod to exist, 'optional' does not -# 'incompatible' will prevent the game from loading when the mod exists, and 'discouraged' will show a warning -type="required" #mandatory -# Optional field describing why the dependency is required or why it is incompatible -# reason="..." -# The version range of the dependency -versionRange="${neo_version_range}" #mandatory -# An ordering relationship for the dependency. -# BEFORE - This mod is loaded BEFORE the dependency -# AFTER - This mod is loaded AFTER the dependency -ordering="NONE" -# Side this dependency is applied on - BOTH, CLIENT, or SERVER -side="BOTH" -# Here's another dependency -[[dependencies."${mod_id}"]] -modId="minecraft" -type="required" -# This version range declares a minimum of the current minecraft version up to but not including the next major version -versionRange="${minecraft_version_range}" -ordering="NONE" -side="BOTH" - -# Features are specific properties of the game environment, that you may want to declare you require. This example declares -# that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't -# stop your mod loading on the server for example. -#[features."${mod_id}"] -#openGLVersion="[3.2,)" Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge mods.toml.html =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge mods.toml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge mods.toml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new mods.toml for NeoForge projects.

- - Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge neoforge.mods.toml.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge neoforge.mods.toml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge neoforge.mods.toml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,100 +0,0 @@ -# This is an example neoforge.mods.toml file. It contains the data relating to the loading mods. -# There are several mandatory fields (#mandatory), and many more that are optional (#optional). -# The overall format is standard TOML format, v0.5.0. -# Note that there are a couple of TOML lists in this file. -# Find more information on toml format here: https://github.com/toml-lang/toml -# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml -modLoader="javafml" #mandatory -# A version range to match for said mod loader - for regular FML @Mod it will be the the FML version. This is currently 47. -loaderVersion="${loader_version_range}" #mandatory -# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. -# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. -license="${mod_license}" -# A URL to refer people to when problems occur with this mod -#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional -# A list of mods - how many allowed here is determined by the individual mod loader -[[mods]] #mandatory -# The modid of the mod -modId="${mod_id}" #mandatory -# The version number of the mod -version="${mod_version}" #mandatory -# A display name for the mod -displayName="${mod_name}" #mandatory -# A URL to query for updates for this mod. See the JSON update specification https://docs.neoforge.net/docs/misc/updatechecker/ -#if (${UPDATE_URL}) -updateJSONURL="${UPDATE_URL}" #optional -#else -#updateJSONURL="https://change.me.example.invalid/updates.json" #optional -#end -# A URL for the "homepage" for this mod, displayed in the mod UI -#if (${WEBSITE}) -displayURL="${WEBSITE}" #optional -#else -#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional -#end -# A file name (in the root of the mod JAR) containing a logo for display -#logoFile="${MOD_ID}.png" #optional -# A text field displayed in the mod UI -#credits="" #optional -# A text field displayed in the mod UI -authors="${mod_authors}" #optional -# Display Test controls the display for your mod in the server connection screen -# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod. -# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod. -# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component. -# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value. -# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself. -#displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional) - -# The description text for the mod (multi line!) (#mandatory) -description='''${mod_description}''' - -#set ( $h = "#" ) -# The [[mixins]] block allows you to declare your mixin config to FML so that it gets loaded. -#if (${MIXIN_CONFIG}) -[[mixins]] -config="${MIXIN_CONFIG}" -#else -${h}[[mixins]] -#config="${mod_id}.mixins.json" -#end - -# The [[accessTransformers]] block allows you to declare where your AT file is. -# If this block is omitted, a fallback attempt will be made to load an AT from META-INF/accesstransformer.cfg -${h}[[accessTransformers]] -#file="META-INF/accesstransformer.cfg" - -# The coremods config file path is not configurable and is always loaded from META-INF/coremods.json - -# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. -[[dependencies."${mod_id}"]] #optional -# the modid of the dependency -modId="neoforge" #mandatory -# The type of the dependency. Can be one of "required", "optional", "incompatible" or "discouraged" (case insensitive). -# 'required' requires the mod to exist, 'optional' does not -# 'incompatible' will prevent the game from loading when the mod exists, and 'discouraged' will show a warning -type="required" #mandatory -# Optional field describing why the dependency is required or why it is incompatible -# reason="..." -# The version range of the dependency -versionRange="${neo_version_range}" #mandatory -# An ordering relationship for the dependency. -# BEFORE - This mod is loaded BEFORE the dependency -# AFTER - This mod is loaded AFTER the dependency -ordering="NONE" -# Side this dependency is applied on - BOTH, CLIENT, or SERVER -side="BOTH" -# Here's another dependency -[[dependencies."${mod_id}"]] -modId="minecraft" -type="required" -# This version range declares a minimum of the current minecraft version up to but not including the next major version -versionRange="${minecraft_version_range}" -ordering="NONE" -side="BOTH" - -# Features are specific properties of the game environment, that you may want to declare you require. This example declares -# that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't -# stop your mod loading on the server for example. -#[features."${mod_id}"] -#openGLVersion="[3.2,)" Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge neoforge.mods.toml.html =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge neoforge.mods.toml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge neoforge.mods.toml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new mods.toml for NeoForge 1.20.5 projects.

- - Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge pack.mcmeta.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge pack.mcmeta.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge pack.mcmeta.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,11 +0,0 @@ -{ - "pack": { - "description": "${MOD_ID} resources", - #if (${PACK_COMMENT} != "") - "pack_format": ${PACK_FORMAT}, - "_comment": "${PACK_COMMENT}" - #else - "pack_format": ${PACK_FORMAT} - #end - } -} Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge pack.mcmeta.html =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge pack.mcmeta.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge pack.mcmeta.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new pack.mcmeta for NeoForge projects.

- - Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge settings.gradle.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge settings.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge settings.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,11 +0,0 @@ -pluginManagement { - repositories { - mavenLocal() - gradlePluginPortal() - maven { url = 'https://maven.neoforged.net/releases' } - } -} - -plugins { - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' -} Index: src/main/resources/fileTemplates/j2ee/neoforge/NeoForge settings.gradle.html =================================================================== --- src/main/resources/fileTemplates/j2ee/neoforge/NeoForge settings.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/neoforge/NeoForge settings.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new settings.gradle for NeoForge projects.

- - Index: src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ Main Class.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,79 +0,0 @@ -package ${PACKAGE}; - -import com.google.inject.Inject; -import net.kyori.adventure.identity.Identity; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.LinearComponents; -import net.kyori.adventure.text.format.NamedTextColor; -import net.kyori.adventure.text.format.Style; -import net.kyori.adventure.text.format.TextDecoration; -import org.apache.logging.log4j.Logger; -import org.spongepowered.api.Server; -import org.spongepowered.api.command.Command; -import org.spongepowered.api.command.CommandResult; -import org.spongepowered.api.command.parameter.Parameter; -import org.spongepowered.api.event.Listener; -import org.spongepowered.api.event.lifecycle.ConstructPluginEvent; -import org.spongepowered.api.event.lifecycle.RegisterCommandEvent; -import org.spongepowered.api.event.lifecycle.StartingEngineEvent; -import org.spongepowered.api.event.lifecycle.StoppingEngineEvent; -import org.spongepowered.plugin.PluginContainer; -import org.spongepowered.plugin.builtin.jvm.Plugin; - -/** - * The main class of your Sponge plugin. - * - *

All methods are optional -- some common event registrations are included as a jumping-off point.

- */ -@Plugin("${PLUGIN_ID}") -public class ${CLASS_NAME} { - - private final PluginContainer container; - private final Logger logger; - - @Inject - ${CLASS_NAME}(final PluginContainer container, final Logger logger) { - this.container = container; - this.logger = logger; - } - - @Listener - public void onConstructPlugin(final ConstructPluginEvent event) { - // Perform any one-time setup - this.logger.info("Constructing ${PLUGIN_ID}"); - } - - @Listener - public void onServerStarting(final StartingEngineEvent event) { - // Any setup per-game instance. This can run multiple times when - // using the integrated (singleplayer) server. - } - - @Listener - public void onServerStopping(final StoppingEngineEvent event) { - // Any tear down per-game instance. This can run multiple times when - // using the integrated (singleplayer) server. - } - - @Listener - public void onRegisterCommands(final RegisterCommandEvent event) { - // Register a simple command - // When possible, all commands should be registered within a command register event - final Parameter.Value nameParam = Parameter.string().key("name").build(); - event.register(this.container, Command.builder() - .addParameter(nameParam) - .permission("${PLUGIN_ID}.command.greet") - .executor(ctx -> { - final String name = ctx.requireOne(nameParam); - ctx.sendMessage(Identity.nil(), LinearComponents.linear( - NamedTextColor.AQUA, - Component.text("Hello "), - Component.text(name, Style.style(TextDecoration.BOLD)), - Component.text("!") - )); - - return CommandResult.success(); - }) - .build(), "greet", "wave"); - } -} Index: src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ Main Class.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new main class for SpongeAPI 8.

- - Index: src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ build.gradle.kts.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ build.gradle.kts.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ build.gradle.kts.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,80 +0,0 @@ -import org.spongepowered.gradle.plugin.config.PluginLoaders -import org.spongepowered.plugin.metadata.model.PluginDependency - -plugins { - `java-library` - id("org.spongepowered.gradle.plugin") version "2.2.0" -} - -group = "${GROUP_ID}" -version = "${PLUGIN_VERSION}" - -repositories { - mavenCentral() -} - -sponge { - apiVersion("${SPONGEAPI_VERSION}") - license("${LICENSE}") - loader { - name(PluginLoaders.JAVA_PLAIN) - version("1.0") - } - plugin("${PLUGIN_ID}") { - displayName("${PLUGIN_NAME}") - entrypoint("${MAIN_CLASS}") - #if (${DESCRIPTION}) - description("${DESCRIPTION}") - #else - description("My plugin description") - #end - links { - #if (${WEBSITE}) - homepageLink("${WEBSITE}") - #else - // homepageLink("https://spongepowered.org") - #end - // sourceLink("https://spongepowered.org/source") - // issuesLink("https://spongepowered.org/issues") - } - #foreach (${AUTHOR} in ${AUTHORS}) - contributor("${AUTHOR}") { - description("Author") - } - #end - dependency("spongeapi") { - loadOrder(PluginDependency.LoadOrder.AFTER) - optional(false) - } - #foreach (${DEPENDENCY} in ${DEPENDENCIES}) - dependency("${DEPEDENCY}") { - loadOrder(PluginDependency.LoadOrder.AFTER) - optional(false) - } - #end - } -} - -val javaTarget = ${JAVA_VERSION} // Sponge targets a minimum of Java ${JAVA_VERSION} -java { - sourceCompatibility = JavaVersion.toVersion(javaTarget) - targetCompatibility = JavaVersion.toVersion(javaTarget) - if (JavaVersion.current() < JavaVersion.toVersion(javaTarget)) { - toolchain.languageVersion.set(JavaLanguageVersion.of(javaTarget)) - } -} - -tasks.withType(JavaCompile::class).configureEach { - options.apply { - encoding = "utf-8" // Consistent source file encoding - if (JavaVersion.current().isJava10Compatible) { - release.set(javaTarget) - } - } -} - -// Make sure all tasks which produce archives (jar, sources jar, javadoc jar, etc) produce more consistent output -tasks.withType(AbstractArchiveTask::class).configureEach { - isReproducibleFileOrder = true - isPreserveFileTimestamps = false -} Index: src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ build.gradle.kts.html =================================================================== --- src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ build.gradle.kts.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ build.gradle.kts.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new build.gradle for SpongeAPI 8 projects.

- - Index: src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ gradle.properties.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ gradle.properties.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ gradle.properties.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,0 +0,0 @@ Index: src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ gradle.properties.html =================================================================== --- src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ gradle.properties.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ gradle.properties.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new gradle.properties file for SpongeAPI 8 projects.

- - Index: src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ settings.gradle.kts.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ settings.gradle.kts.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ settings.gradle.kts.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,1 +0,0 @@ -rootProject.name = "${PROJECT_NAME}" Index: src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ settings.gradle.kts.html =================================================================== --- src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ settings.gradle.kts.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ settings.gradle.kts.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new settings.gradle for SpongeAPI 8 projects.

- - Index: src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ sponge_plugins.json.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ sponge_plugins.json.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ sponge_plugins.json.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,49 +0,0 @@ -{ - "loader": { - "name": "java_plain", - "version": "1.0" - }, - "license": "${LICENSE}", - "plugins": [ - { - "id": "${PLUGIN_ID}", - "name": "${PLUGIN_NAME}", - "version": "${VERSION_PLACEHOLDER}", - "entrypoint": "${MAIN_CLASS}", - #if (${DESCRIPTION}) - "description": "${DESCRIPTION}", - #else - "description": "My plugin description", - #end - "branding": {}, - "links": { - #if (${WEBSITE}) - "homepage": "https://spongepowered.org" - #end - }, - "contributors": [ - #foreach (${AUTHOR} in ${AUTHORS}) - { - "name": "${AUTHOR}", - "description": "Author" - } - #end - ], - "dependencies": [ - { - "id": "spongeapi", - "version": "${SPONGEAPI_VERSION}", - "load-order": "after", - "optional": false - #foreach (${DEPENDENCY} in ${DEPENDENCIES}) - }, - { - "id": "${DEPENDENCY}", - "load-order": "after", - "optional": false - #end - } - ] - } - ] -} Index: src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ sponge_plugins.json.html =================================================================== --- src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ sponge_plugins.json.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ sponge_plugins.json.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new sponge_plugins.json for SpongeAPI 8 Maven projects.

- - Index: src/main/resources/fileTemplates/j2ee/sponge/Sponge pom.xml.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/sponge/Sponge pom.xml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/sponge/Sponge pom.xml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,150 +0,0 @@ - - - 4.0.0 - - - - - jar - - - - - ${JAVA_VERSION} - UTF-8 - - - - - release - - - - org.apache.maven.plugins - maven-source-plugin - ${maven_source_plugin_version} - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - ${maven_javadoc_plugin_version} - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-gpg-plugin - ${maven_gpg_plugin_version} - - - sign-artifacts - verify - - sign - - - - - - - - src/main/resources - true - - - - - - - - - - ${project.basedir}/src/main/resources - true - - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven_compiler_plugin_version} - - ${java.version} - ${java.version} - - - - org.codehaus.mojo - templating-maven-plugin - ${templating_maven_plugin_version} - - - filter-src - - filter-sources - - - - - - org.apache.maven.plugins - maven-site-plugin - ${maven_site_plugin_version} - - - net.trajano.wagon - wagon-git - ${wagon_git_version} - - - org.apache.maven.doxia - doxia-module-markdown - ${doxia_module_markdown_version} - - - - - org.apache.maven.plugins - maven-release-plugin - ${maven_release_plugin_version} - - true - @{project.version} - [RELEASE] - install deploy site-deploy - release - - - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - ${maven_javadoc_plugin_version} - - - - - - - - Index: src/main/resources/fileTemplates/j2ee/sponge/Sponge pom.xml.html =================================================================== --- src/main/resources/fileTemplates/j2ee/sponge/Sponge pom.xml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/sponge/Sponge pom.xml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new pom.xml for Sponge.

- - Index: src/main/resources/fileTemplates/j2ee/velocity/Velocity Build Constants.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/velocity/Velocity Build Constants.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/velocity/Velocity Build Constants.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,7 +0,0 @@ -package ${PACKAGE}; - -// The constants are replaced before compilation -public class BuildConstants { - - public static final String VERSION = "${version}"; -} Index: src/main/resources/fileTemplates/j2ee/velocity/Velocity Build Constants.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/velocity/Velocity Build Constants.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/velocity/Velocity Build Constants.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new BuildConstants.java file for Velocity projects.

- - Index: src/main/resources/fileTemplates/j2ee/velocity/Velocity Main Class V2.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/velocity/Velocity Main Class V2.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/velocity/Velocity Main Class V2.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,19 +0,0 @@ -package ${PACKAGE}; - -import com.google.inject.Inject; -import com.velocitypowered.api.event.lifecycle.ProxyInitializeEvent; -import com.velocitypowered.api.event.Subscribe; -#if(${HAS_DEPENDENCIES}) -import com.velocitypowered.api.plugin.Dependency; -#end -import com.velocitypowered.api.plugin.Plugin; -import org.slf4j.Logger; - -public class ${CLASS_NAME} { - - @Inject private Logger logger; - - @Subscribe - public void onProxyInitialization(ProxyInitializeEvent event) { - } -} Index: src/main/resources/fileTemplates/j2ee/velocity/Velocity Main Class V2.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/velocity/Velocity Main Class V2.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/velocity/Velocity Main Class V2.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new main class for Velocity 2.+.

- - Index: src/main/resources/fileTemplates/j2ee/velocity/Velocity Main Class.java.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/velocity/Velocity Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/velocity/Velocity Main Class.java.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,19 +0,0 @@ -package ${PACKAGE}; - -import com.google.inject.Inject; -import com.velocitypowered.api.event.proxy.ProxyInitializeEvent; -import com.velocitypowered.api.event.Subscribe; -#if(${HAS_DEPENDENCIES}) -import com.velocitypowered.api.plugin.Dependency; -#end -import com.velocitypowered.api.plugin.Plugin; -import org.slf4j.Logger; - -public class ${CLASS_NAME} { - - @Inject private Logger logger; - - @Subscribe - public void onProxyInitialization(ProxyInitializeEvent event) { - } -} Index: src/main/resources/fileTemplates/j2ee/velocity/Velocity Main Class.java.html =================================================================== --- src/main/resources/fileTemplates/j2ee/velocity/Velocity Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/velocity/Velocity Main Class.java.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new main class for Velocity.

- - Index: src/main/resources/fileTemplates/j2ee/velocity/Velocity build.gradle.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/velocity/Velocity build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/velocity/Velocity build.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,50 +0,0 @@ -plugins { - id 'java' - id 'eclipse' -} - -group = '${GROUP_ID}' -version = '${PLUGIN_VERSION}' - -repositories { - mavenCentral() -} - -dependencies { -} - -def targetJavaVersion = ${JAVA_VERSION} -java { - def javaVersion = JavaVersion.toVersion(targetJavaVersion) - sourceCompatibility = javaVersion - targetCompatibility = javaVersion - if (JavaVersion.current() < javaVersion) { - toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) - } -} - -tasks.withType(JavaCompile).configureEach { - options.encoding = 'UTF-8' - - if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { - options.release.set(targetJavaVersion) - } -} - -def templateSource = file('src/main/templates') -def templateDest = layout.buildDirectory.dir('generated/sources/templates') -def generateTemplates = tasks.register('generateTemplates', Copy) { task -> - def props = [ - 'version': project.version - ] - task.inputs.properties props - - task.from templateSource - task.into templateDest - task.expand props -} - -sourceSets.main.java.srcDir(generateTemplates.map { it.outputs }) - -rootProject.idea.project.settings.taskTriggers.afterSync generateTemplates -project.eclipse.synchronizationTasks(generateTemplates) Index: src/main/resources/fileTemplates/j2ee/velocity/Velocity build.gradle.html =================================================================== --- src/main/resources/fileTemplates/j2ee/velocity/Velocity build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/velocity/Velocity build.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new build.gradle for Velocity projects.

- - Index: src/main/resources/fileTemplates/j2ee/velocity/Velocity gradle.properties.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/velocity/Velocity gradle.properties.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/velocity/Velocity gradle.properties.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,3 +0,0 @@ -#if (${JAVA_VERSION}) -javaVersion=${JAVA_VERSION} -#end Index: src/main/resources/fileTemplates/j2ee/velocity/Velocity gradle.properties.html =================================================================== --- src/main/resources/fileTemplates/j2ee/velocity/Velocity gradle.properties.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/velocity/Velocity gradle.properties.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new gradle.properties file for Velocity projects.

- - Index: src/main/resources/fileTemplates/j2ee/velocity/Velocity pom.xml.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/velocity/Velocity pom.xml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/velocity/Velocity pom.xml.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,150 +0,0 @@ - - - 4.0.0 - - - - - jar - - - - - ${JAVA_VERSION} - UTF-8 - - - - - release - - - - org.apache.maven.plugins - maven-source-plugin - ${maven_source_plugin_version} - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - ${maven_javadoc_plugin_version} - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-gpg-plugin - ${maven_gpg_plugin_version} - - - sign-artifacts - verify - - sign - - - - - - - - src/main/resources - true - - - - - - - - - - ${project.basedir}/src/main/resources - true - - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven_compiler_plugin_version} - - ${java.version} - ${java.version} - - - - org.codehaus.mojo - templating-maven-plugin - ${templating_maven_plugin_version} - - - filter-src - - filter-sources - - - - - - org.apache.maven.plugins - maven-site-plugin - ${maven_site_plugin_version} - - - net.trajano.wagon - wagon-git - ${wagon_git_version} - - - org.apache.maven.doxia - doxia-module-markdown - ${doxia_module_markdown_version} - - - - - org.apache.maven.plugins - maven-release-plugin - ${maven_release_plugin_version} - - true - @{project.version} - [RELEASE] - install deploy site-deploy - release - - - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - ${maven_javadoc_plugin_version} - - - - - - - - Index: src/main/resources/fileTemplates/j2ee/velocity/Velocity pom.xml.html =================================================================== --- src/main/resources/fileTemplates/j2ee/velocity/Velocity pom.xml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/velocity/Velocity pom.xml.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new pom.xml for Velocity.

- - Index: src/main/resources/fileTemplates/j2ee/velocity/Velocity settings.gradle.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/velocity/Velocity settings.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/velocity/Velocity settings.gradle.ft (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,1 +0,0 @@ -rootProject.name = '${PROJECT_NAME}' Index: src/main/resources/fileTemplates/j2ee/velocity/Velocity settings.gradle.html =================================================================== --- src/main/resources/fileTemplates/j2ee/velocity/Velocity settings.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) +++ src/main/resources/fileTemplates/j2ee/velocity/Velocity settings.gradle.html (revision b568d06142977dcf39328de3dc6dbbd1cc5b0fd0) @@ -1,25 +0,0 @@ - - - - -

This is a built-in file template used to create a new settings.gradle for Velocity projects.

- -