diff --git a/build.gradle.kts b/build.gradle.kts index 81e81fa53..128256b89 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -28,12 +28,12 @@ import org.jlleitschuh.gradle.ktlint.tasks.BaseKtLintCheckTask import org.jlleitschuh.gradle.ktlint.tasks.KtLintFormatTask plugins { - kotlin("jvm") version "1.8.0" + kotlin("jvm") version "1.9.0" java mcdev groovy idea - id("org.jetbrains.intellij") version "1.14.1" + id("org.jetbrains.intellij") version "1.15.0" id("org.cadixdev.licenser") id("org.jlleitschuh.gradle.ktlint") version "10.3.0" } @@ -282,7 +282,7 @@ license { exclude("com/demonwav/mcdev/platform/mixin/invalidInjectorMethodSignature/*.java") - tasks { + this.tasks { register("gradle") { files.from( fileTree(project.projectDir) { diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cbfa..033e24c4c 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f398c33c4..62f495dfe 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68d6..fcb6fca14 100755 --- a/gradlew +++ b/gradlew @@ -85,9 +85,6 @@ done APP_BASE_NAME=${0##*/} APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,10 +130,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -144,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,6 +197,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in diff --git a/src/main/kotlin/creator/creator-utils.kt b/src/main/kotlin/creator/creator-utils.kt index b239c7140..38af05308 100644 --- a/src/main/kotlin/creator/creator-utils.kt +++ b/src/main/kotlin/creator/creator-utils.kt @@ -66,8 +66,12 @@ fun FixedAssetsNewProjectWizardStep.addLicense(project: Project) { addTemplates(project, "LICENSE" to "${license.id}.txt") } -fun splitPackage(text: String): Pair { +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 diff --git a/src/main/kotlin/creator/step/FixedAssetsNewProjectWizardStep.kt b/src/main/kotlin/creator/step/FixedAssetsNewProjectWizardStep.kt index d58e160c1..08f37552d 100644 --- a/src/main/kotlin/creator/step/FixedAssetsNewProjectWizardStep.kt +++ b/src/main/kotlin/creator/step/FixedAssetsNewProjectWizardStep.kt @@ -51,7 +51,7 @@ import java.nio.file.Path abstract class FixedAssetsNewProjectWizardStep(parent: NewProjectWizardStep) : AbstractNewProjectWizardStep(parent) { lateinit var outputDirectory: String private val assets = arrayListOf() - val templateProperties = hashMapOf() + val templateProperties = hashMapOf() private val filesToOpen = hashSetOf() fun addAssets(vararg assets: Any) = addAssets(assets.toList()) @@ -66,9 +66,9 @@ abstract class FixedAssetsNewProjectWizardStep(parent: NewProjectWizardStep) : A } } - fun addTemplateProperties(vararg properties: Pair) = addTemplateProperties(properties.toMap()) + fun addTemplateProperties(vararg properties: Pair) = addTemplateProperties(properties.toMap()) - fun addTemplateProperties(properties: Map) = templateProperties.putAll(properties) + fun addTemplateProperties(properties: Map) = templateProperties.putAll(properties) fun addFilesToOpen(vararg relativeCanonicalPaths: String) = addFilesToOpen(relativeCanonicalPaths.toList()) diff --git a/src/main/kotlin/platform/forge/creator/asset-steps.kt b/src/main/kotlin/platform/forge/creator/asset-steps.kt index 345a15399..038d449c4 100644 --- a/src/main/kotlin/platform/forge/creator/asset-steps.kt +++ b/src/main/kotlin/platform/forge/creator/asset-steps.kt @@ -53,7 +53,8 @@ class ForgeProjectFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningA override fun setupAssets(project: Project) { val mcVersion = data.getUserData(ForgeVersionChainStep.MC_VERSION_KEY) ?: return val forgeVersion = data.getUserData(ForgeVersionChainStep.FORGE_VERSION_KEY) ?: return - val (mainPackageName, mainClassName) = splitPackage(data.getUserData(MainClassStep.KEY) ?: return) + val mainClass = data.getUserData(MainClassStep.KEY) ?: return + val (mainPackageName, mainClassName) = splitPackage(mainClass) val buildSystemProps = findStep>() val modName = data.getUserData(AbstractModNameStep.KEY) ?: return val license = data.getUserData(LicenseStep.KEY) ?: return @@ -108,12 +109,12 @@ class ForgeProjectFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningA 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_MAIN_CLASS_TEMPLATE + else -> MinecraftTemplates.FG3_1_16_MAIN_CLASS_TEMPLATE } assets.addTemplates( project, - "src/main/java/${mainPackageName.replace('.', '/')}/$mainClassName.java" to mainClassTemplate, + "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, ) @@ -124,10 +125,12 @@ class ForgeProjectFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningA } if (configTemplate != null) { - assets.addTemplates( - project, - "src/main/java/${mainPackageName.replace('.', '/')}/Config.java" to configTemplate, - ) + 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) diff --git a/src/main/kotlin/platform/forge/creator/gradle-steps.kt b/src/main/kotlin/platform/forge/creator/gradle-steps.kt index d698fc7b4..8668e9121 100644 --- a/src/main/kotlin/platform/forge/creator/gradle-steps.kt +++ b/src/main/kotlin/platform/forge/creator/gradle-steps.kt @@ -40,7 +40,6 @@ 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 @@ -95,9 +94,6 @@ class ForgeGradleFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAs assets.addTemplateProperties( "MOD_NAME" to modName, "MC_VERSION" to mcVersion, - "MCP_CHANNEL" to "official", - "MCP_VERSION" to mcVersion, - "MCP_MC_VERSION" to mcVersion, "MC_NEXT_VERSION" to mcNextVersion, "FORGE_VERSION" to forgeVersion, "FORGE_SPEC_VERSION" to forgeVersion.parts[0].versionString, @@ -122,13 +118,6 @@ class ForgeGradleFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningAs assets.addTemplateProperties("GAME_TEST_FRAMEWORK" to "true") } - if (mcVersion <= MinecraftVersions.MC1_16_5) { - assets.addTemplateProperties( - "MCP_CHANNEL" to "snapshot", - "MCP_VERSION" to "20210309", - ) - } - assets.addTemplates( project, "build.gradle" to MinecraftTemplates.FG3_BUILD_GRADLE_TEMPLATE, diff --git a/src/main/kotlin/platform/mcp/fabricloom/FabricLoomDecompileSourceProvider.kt b/src/main/kotlin/platform/mcp/fabricloom/FabricLoomDecompileSourceProvider.kt index 444d921a6..ee74c1226 100644 --- a/src/main/kotlin/platform/mcp/fabricloom/FabricLoomDecompileSourceProvider.kt +++ b/src/main/kotlin/platform/mcp/fabricloom/FabricLoomDecompileSourceProvider.kt @@ -29,6 +29,7 @@ import com.intellij.openapi.application.runWriteActionAndWait import com.intellij.openapi.externalSystem.task.TaskCallback import com.intellij.openapi.roots.LibraryOrderEntry import com.intellij.openapi.roots.OrderRootType +import com.intellij.openapi.roots.impl.libraries.LibraryEx import com.intellij.openapi.util.ActionCallback import com.intellij.psi.PsiFile import com.intellij.psi.PsiJavaFile @@ -103,6 +104,10 @@ class FabricLoomDecompileSourceProvider : AttachSourcesProvider { val library = libraryEntry.library if (library != null) { runWriteActionAndWait { + if (library is LibraryEx && library.isDisposed) { + return@runWriteActionAndWait + } + val model = library.modifiableModel model.addRoot("jar://$sourcePath!/", OrderRootType.SOURCES) model.commit() diff --git a/src/main/kotlin/platform/mixin/handlers/injectionPoint/ConstantInjectionPoint.kt b/src/main/kotlin/platform/mixin/handlers/injectionPoint/ConstantInjectionPoint.kt index c551b456b..c67d1fcb0 100644 --- a/src/main/kotlin/platform/mixin/handlers/injectionPoint/ConstantInjectionPoint.kt +++ b/src/main/kotlin/platform/mixin/handlers/injectionPoint/ConstantInjectionPoint.kt @@ -24,6 +24,7 @@ import com.demonwav.mcdev.platform.mixin.reference.MixinSelector import com.demonwav.mcdev.util.constantValue import com.demonwav.mcdev.util.createLiteralExpression import com.demonwav.mcdev.util.descriptor +import com.demonwav.mcdev.util.ifNotBlank import com.intellij.codeInsight.lookup.LookupElementBuilder import com.intellij.openapi.project.Project import com.intellij.psi.JavaPsiFacade @@ -60,7 +61,7 @@ class ConstantInjectionPoint : InjectionPoint() { val longValue = args["longValue"]?.toLongOrNull() val doubleValue = args["doubleValue"]?.toDoubleOrNull() val stringValue = args["stringValue"] - val classValue = args["classValue"]?.let { Type.getObjectType(it.replace('.', '/')) } + val classValue = args["classValue"]?.ifNotBlank { Type.getObjectType(it.replace('.', '/')) } val count = nullValue.toInt() + (intValue != null).toInt() + diff --git a/src/main/kotlin/platform/mixin/handlers/injectionPoint/ReturnInjectionPoint.kt b/src/main/kotlin/platform/mixin/handlers/injectionPoint/ReturnInjectionPoint.kt index 2e9edd315..de46787f3 100644 --- a/src/main/kotlin/platform/mixin/handlers/injectionPoint/ReturnInjectionPoint.kt +++ b/src/main/kotlin/platform/mixin/handlers/injectionPoint/ReturnInjectionPoint.kt @@ -36,6 +36,7 @@ import com.intellij.psi.PsiMethod import com.intellij.psi.PsiMethodReferenceExpression import com.intellij.psi.PsiReturnStatement import com.intellij.psi.PsiTypes +import com.intellij.psi.controlFlow.AnalysisCanceledException import com.intellij.psi.controlFlow.ControlFlowUtil import org.objectweb.asm.Opcodes import org.objectweb.asm.tree.AbstractInsnNode @@ -113,7 +114,12 @@ abstract class AbstractReturnInjectionPoint(private val tailOnly: Boolean) : Inj } val rBrace = codeBlockToAnalyze.rBrace ?: return - val controlFlow = HighlightControlFlowUtil.getControlFlowNoConstantEvaluate(codeBlockToAnalyze) + val controlFlow = try { + HighlightControlFlowUtil.getControlFlowNoConstantEvaluate(codeBlockToAnalyze) + } catch (e: AnalysisCanceledException) { + return + } + if (ControlFlowUtil.canCompleteNormally(controlFlow, 0, controlFlow.size)) { if (tailOnly) { result.clear() diff --git a/src/main/kotlin/platform/mixin/inspection/addedMembers/AddedMembersNameFormatInspection.kt b/src/main/kotlin/platform/mixin/inspection/addedMembers/AddedMembersNameFormatInspection.kt index 0f9a8e899..406cf3921 100644 --- a/src/main/kotlin/platform/mixin/inspection/addedMembers/AddedMembersNameFormatInspection.kt +++ b/src/main/kotlin/platform/mixin/inspection/addedMembers/AddedMembersNameFormatInspection.kt @@ -35,6 +35,7 @@ import com.intellij.icons.AllIcons import com.intellij.ide.util.SuperMethodWarningUtil import com.intellij.openapi.editor.Editor import com.intellij.openapi.module.Module +import com.intellij.openapi.project.DumbService import com.intellij.openapi.project.Project import com.intellij.openapi.ui.ComboBox import com.intellij.openapi.ui.ComponentValidator @@ -299,21 +300,27 @@ private class RenameWithInheritanceFix( if (isMethod) { val method = startElement as? PsiMethod ?: return if (editor != null) { - SuperMethodWarningUtil.checkSuperMethod(method, { md -> - RenameProcessor(project, md, newName, false, false).run() - true - }, editor) + DumbService.getInstance(project).smartInvokeLater { + SuperMethodWarningUtil.checkSuperMethod(method, { md -> + RenameProcessor(project, md, newName, false, false).run() + true + }, editor) + } } else { - val superMethod = method.findDeepestSuperMethods().firstOrNull() - for (md in listOfNotNull(superMethod, method)) { - RenameProcessor(project, md, newName, false, false).run() + DumbService.getInstance(project).smartInvokeLater { + val superMethod = method.findDeepestSuperMethods().firstOrNull() + for (md in listOfNotNull(superMethod, method)) { + RenameProcessor(project, md, newName, false, false).run() + } } } } else { if (!FileModificationService.getInstance().prepareFileForWrite(file)) { return } - RenameProcessor(project, startElement, newName, false, false).run() + DumbService.getInstance(project).smartInvokeLater { + RenameProcessor(project, startElement, newName, false, false).run() + } } } diff --git a/src/main/kotlin/platform/sponge/creator/asset-steps.kt b/src/main/kotlin/platform/sponge/creator/asset-steps.kt index 551537318..8620565aa 100644 --- a/src/main/kotlin/platform/sponge/creator/asset-steps.kt +++ b/src/main/kotlin/platform/sponge/creator/asset-steps.kt @@ -39,14 +39,15 @@ class SpongeProjectFilesStep(parent: NewProjectWizardStep) : AbstractLongRunning override fun setupAssets(project: Project) { val buildSystemProps = findStep>() - val (packageName, className) = splitPackage(data.getUserData(MainClassStep.KEY) ?: return) + 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/${packageName.replace('.', '/')}/$className.java" + val mainClassFile = "src/main/java/${mainClass.replace('.', '/')}.java" assets.addTemplates( project, mainClassFile to MinecraftTemplates.SPONGE8_MAIN_CLASS_TEMPLATE, diff --git a/src/main/kotlin/platform/velocity/creator/gradle-steps.kt b/src/main/kotlin/platform/velocity/creator/gradle-steps.kt index 54ec00803..186d11d5d 100644 --- a/src/main/kotlin/platform/velocity/creator/gradle-steps.kt +++ b/src/main/kotlin/platform/velocity/creator/gradle-steps.kt @@ -79,7 +79,11 @@ class VelocityGradleFilesStep(parent: NewProjectWizardStep) : AbstractLongRunnin "PACKAGE" to mainPackage, ) - val buildConstantsJava = "src/main/templates/${mainPackage.replace('.', '/')}/BuildConstants.java" + 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, diff --git a/src/main/kotlin/toml/platform/forge/inspections/ModsTomlValidationInspection.kt b/src/main/kotlin/toml/platform/forge/inspections/ModsTomlValidationInspection.kt index 5fcec7425..920df2f2b 100644 --- a/src/main/kotlin/toml/platform/forge/inspections/ModsTomlValidationInspection.kt +++ b/src/main/kotlin/toml/platform/forge/inspections/ModsTomlValidationInspection.kt @@ -72,7 +72,7 @@ class ModsTomlValidationInspection : LocalInspectionTool() { "modId" -> { val value = keyValue.value ?: return val modId = value.stringValue() ?: return - if (!ForgeConstants.MOD_ID_REGEX.matches(modId)) { + if (modId != "\"" && !ForgeConstants.MOD_ID_REGEX.matches(modId)) { val endOffset = if (value.text.endsWith('"')) modId.length + 1 else modId.length holder.registerProblem(value, TextRange(1, endOffset), "Mod ID is invalid") } @@ -80,7 +80,7 @@ class ModsTomlValidationInspection : LocalInspectionTool() { "displayTest" -> { val value = keyValue.value ?: return val test = value.stringValue() ?: return - if (test !in ForgeConstants.DISPLAY_TESTS) { + if (test != "\"" && test !in ForgeConstants.DISPLAY_TESTS) { val endOffset = if (value.text.endsWith('"')) test.length + 1 else test.length holder.registerProblem(value, TextRange(1, endOffset), "DisplayTest $test does not exist") } @@ -96,7 +96,7 @@ class ModsTomlValidationInspection : LocalInspectionTool() { "side" -> { val value = keyValue.value ?: return val side = value.stringValue() ?: return - if (side !in ForgeConstants.DEPENDENCY_SIDES) { + if (side != "\"" && side !in ForgeConstants.DEPENDENCY_SIDES) { val endOffset = if (value.text.endsWith('"')) side.length + 1 else side.length holder.registerProblem(value, TextRange(1, endOffset), "Side $side does not exist") } @@ -104,7 +104,7 @@ class ModsTomlValidationInspection : LocalInspectionTool() { "ordering" -> { val value = keyValue.value ?: return val order = value.stringValue() ?: return - if (order !in ForgeConstants.DEPENDENCY_ORDER) { + if (order != "\"" && order !in ForgeConstants.DEPENDENCY_ORDER) { val endOffset = if (value.text.endsWith('"')) order.length + 1 else order.length holder.registerProblem(value, TextRange(1, endOffset), "Order $order does not exist") } diff --git a/src/main/kotlin/toml/platform/forge/reference/ModsTomlReferenceContributor.kt b/src/main/kotlin/toml/platform/forge/reference/ModsTomlReferenceContributor.kt index 8f06e704c..1287fc418 100644 --- a/src/main/kotlin/toml/platform/forge/reference/ModsTomlReferenceContributor.kt +++ b/src/main/kotlin/toml/platform/forge/reference/ModsTomlReferenceContributor.kt @@ -45,6 +45,7 @@ import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferen import com.intellij.psi.search.GlobalSearchScope import com.intellij.psi.search.searches.ReferencesSearch import com.intellij.util.ProcessingContext +import kotlin.math.max import org.jetbrains.jps.model.java.JavaResourceRootType import org.jetbrains.uast.UAnnotation import org.jetbrains.uast.evaluateString @@ -126,7 +127,7 @@ object ModsTomlModIdReferenceProvider : PsiReferenceProvider() { } class ModsTomlModIdReference(element: TomlValue) : - PsiReferenceBase(element, TextRange(1, element.textLength - 1)) { + PsiReferenceBase(element, TextRange(1, max(element.textLength - 1, 1))) { val modId: String? = element.stringValue() diff --git a/src/main/kotlin/translations/inspections/NoTranslationInspection.kt b/src/main/kotlin/translations/inspections/NoTranslationInspection.kt index fc55160a7..84072d141 100644 --- a/src/main/kotlin/translations/inspections/NoTranslationInspection.kt +++ b/src/main/kotlin/translations/inspections/NoTranslationInspection.kt @@ -26,6 +26,8 @@ import com.intellij.codeInspection.LocalQuickFix import com.intellij.codeInspection.ProblemDescriptor import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder +import com.intellij.notification.Notification +import com.intellij.notification.NotificationType import com.intellij.openapi.project.Project import com.intellij.openapi.ui.Messages import com.intellij.psi.JavaElementVisitor @@ -73,6 +75,13 @@ class NoTranslationInspection : TranslationInspection() { TranslationFiles.add(literal, key, result) } } catch (ignored: IncorrectOperationException) { + } catch (e: Exception) { + Notification( + "Translation support error", + "Error while adding translation", + e.message ?: e.stackTraceToString(), + NotificationType.WARNING, + ).notify(project) } } diff --git a/src/main/kotlin/translations/intentions/ConvertToTranslationIntention.kt b/src/main/kotlin/translations/intentions/ConvertToTranslationIntention.kt index ab19cb9f7..cddb067e0 100644 --- a/src/main/kotlin/translations/intentions/ConvertToTranslationIntention.kt +++ b/src/main/kotlin/translations/intentions/ConvertToTranslationIntention.kt @@ -24,6 +24,8 @@ import com.demonwav.mcdev.translations.TranslationFiles import com.demonwav.mcdev.util.runWriteAction import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction import com.intellij.lang.java.JavaLanguage +import com.intellij.notification.Notification +import com.intellij.notification.NotificationType import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import com.intellij.openapi.ui.InputValidatorEx @@ -68,9 +70,9 @@ class ConvertToTranslationIntention : PsiElementBaseIntentionAction() { } }, ) - val key = result.first + val key = result.first ?: return val replaceLiteral = result.second - if (key != null) { + try { TranslationFiles.add(element, key, value) if (replaceLiteral) { val psi = PsiDocumentManager.getInstance(project).getPsiFile(editor.document) ?: return @@ -87,6 +89,13 @@ class ConvertToTranslationIntention : PsiElementBaseIntentionAction() { } } } + } catch (e: Exception) { + Notification( + "Translation support error", + "Error while adding translation", + e.message ?: e.stackTraceToString(), + NotificationType.WARNING, + ).notify(project) } } } diff --git a/src/main/kotlin/util/MinecraftTemplates.kt b/src/main/kotlin/util/MinecraftTemplates.kt index 3fcc02b79..da7e327b5 100644 --- a/src/main/kotlin/util/MinecraftTemplates.kt +++ b/src/main/kotlin/util/MinecraftTemplates.kt @@ -81,7 +81,7 @@ class MinecraftTemplates : FileTemplateGroupDescriptorFactory { FileTemplateGroupDescriptor("Forge", PlatformAssets.FORGE_ICON).let { forgeGroup -> group.addTemplate(forgeGroup) forgeGroup.addTemplate(FileTemplateDescriptor(FORGE_MIXINS_JSON_TEMPLATE, PlatformAssets.FORGE_ICON)) - forgeGroup.addTemplate(FileTemplateDescriptor(FG3_MAIN_CLASS_TEMPLATE)) + forgeGroup.addTemplate(FileTemplateDescriptor(FG3_1_16_MAIN_CLASS_TEMPLATE)) forgeGroup.addTemplate(FileTemplateDescriptor(FG3_1_17_MAIN_CLASS_TEMPLATE)) forgeGroup.addTemplate(FileTemplateDescriptor(FG3_1_18_MAIN_CLASS_TEMPLATE)) forgeGroup.addTemplate(FileTemplateDescriptor(FG3_1_19_MAIN_CLASS_TEMPLATE)) @@ -106,15 +106,6 @@ class MinecraftTemplates : FileTemplateGroupDescriptorFactory { fabricGroup.addTemplate(FileTemplateDescriptor(FABRIC_SETTINGS_GRADLE_TEMPLATE, PlatformAssets.FABRIC_ICON)) } - FileTemplateGroupDescriptor("Multi-Module", PlatformAssets.MINECRAFT_ICON).let { multiGroup -> - group.addTemplate(multiGroup) - multiGroup.addTemplate(FileTemplateDescriptor(MULTI_MODULE_BUILD_GRADLE_TEMPLATE)) - multiGroup.addTemplate(FileTemplateDescriptor(MULTI_MODULE_GRADLE_PROPERTIES_TEMPLATE)) - multiGroup.addTemplate(FileTemplateDescriptor(MULTI_MODULE_SETTINGS_GRADLE_TEMPLATE)) - multiGroup.addTemplate(FileTemplateDescriptor(MULTI_MODULE_POM_TEMPLATE)) - multiGroup.addTemplate(FileTemplateDescriptor(MULTI_MODULE_COMMON_POM_TEMPLATE)) - } - FileTemplateGroupDescriptor("Mixin", PlatformAssets.MIXIN_ICON).let { mixinGroup -> group.addTemplate(mixinGroup) mixinGroup.addTemplate(FileTemplateDescriptor(MIXIN_OVERWRITE_FALLBACK)) @@ -199,7 +190,7 @@ class MinecraftTemplates : FileTemplateGroupDescriptorFactory { const val SPONGE8_SETTINGS_GRADLE_TEMPLATE = "Sponge 8+ settings.gradle.kts" const val FORGE_MIXINS_JSON_TEMPLATE = "Forge Mixins Config.json" - const val FG3_MAIN_CLASS_TEMPLATE = "Forge (1.13+) Main Class.java" + const val FG3_1_16_MAIN_CLASS_TEMPLATE = "Forge (1.16+) Main Class.java" const val FG3_1_17_MAIN_CLASS_TEMPLATE = "Forge (1.17+) Main Class.java" const val FG3_1_18_MAIN_CLASS_TEMPLATE = "Forge (1.18+) Main Class.java" const val FG3_1_19_MAIN_CLASS_TEMPLATE = "Forge (1.19+) Main Class.java" @@ -235,12 +226,6 @@ class MinecraftTemplates : FileTemplateGroupDescriptorFactory { const val ARCHITECTURY_FORGE_MODS_TOML_TEMPLATE = "architectury_forge_mods.toml" const val ARCHITECTURY_FORGE_PACK_MCMETA_TEMPLATE = "architectury_forge_pack.mcmeta" - const val MULTI_MODULE_BUILD_GRADLE_TEMPLATE = "Multi-Module Base build.gradle" - const val MULTI_MODULE_GRADLE_PROPERTIES_TEMPLATE = "Multi-Module Base gradle.properties" - const val MULTI_MODULE_SETTINGS_GRADLE_TEMPLATE = "Multi-Module Base settings.gradle" - const val MULTI_MODULE_POM_TEMPLATE = "Multi-Module Base pom.xml" - const val MULTI_MODULE_COMMON_POM_TEMPLATE = "Multi-Module Common pom.xml" - const val MIXIN_OVERWRITE_FALLBACK = "Mixin Overwrite Fallback.java" const val GRADLE_WRAPPER_PROPERTIES = "MinecraftDev gradle-wrapper.properties" diff --git a/src/main/kotlin/util/utils.kt b/src/main/kotlin/util/utils.kt index f08bea1e1..0cd056c49 100644 --- a/src/main/kotlin/util/utils.kt +++ b/src/main/kotlin/util/utils.kt @@ -378,3 +378,11 @@ inline fun runCatchingKtIdeaExceptions(action: () -> T): T? = try { fun withSuppressed(original: T?, other: T): T = original?.apply { addSuppressed(other) } ?: other + +fun S.ifNotBlank(block: (S) -> R): R? { + if (this.isNotBlank()) { + return block(this) + } + + return null +} diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 3223819a7..a81c5a941 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -244,6 +244,7 @@ + diff --git a/src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) Main Class.java.html b/src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) Main Class.java.html deleted file mode 100644 index cb7dee13b..000000000 --- a/src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) Main Class.java.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - -

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

- - diff --git a/src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) Submodule build.gradle.ft b/src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) Submodule build.gradle.ft deleted file mode 100644 index 76ed35995..000000000 --- a/src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) Submodule build.gradle.ft +++ /dev/null @@ -1,232 +0,0 @@ -buildscript { - repositories { - // These repositories are only for Gradle plugins, put any other repositories in the repository block further below - maven { url = 'https://maven.minecraftforge.net' } - #if (${MIXINS}) - maven { url = 'https://repo.spongepowered.org/repository/maven-public/' } - #end - mavenCentral() - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true - #if (${MIXINS}) - classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT' - #end - } -} - -apply plugin: 'net.minecraftforge.gradle' -#if (${MIXINS}) -apply plugin: 'org.spongepowered.mixin' -#end - -java { - archivesBaseName = '${ARTIFACT_ID}' - toolchain.languageVersion = JavaLanguageVersion.of(${JAVA_VERSION}) -} - -minecraft { - // The mappings can be changed at any time and must be in the following format. - // Channel: Version: - // snapshot YYYYMMDD Snapshot are built nightly. - // stable # Stables are built at the discretion of the MCP team. - // official MCVersion Official field/method names from Mojang mapping files - // - // You must be aware of the Mojang license when using the 'official' mappings. - // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md - // - // 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. -#if(${MCP_CHANNEL} == "stable" || ${MCP_CHANNEL} == "snapshot") - mappings channel: '${MCP_CHANNEL}', version: '${MCP_VERSION}-${MCP_MC_VERSION}' -#else - mappings channel: '${MCP_CHANNEL}', version: '${MCP_VERSION}' -#end - - // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') - - // Default run configurations. - // These can be tweaked, removed, or duplicated as needed. - runs { - client { - workingDirectory project.file('run') - - // Recommended logging data for a userdev environment - // The markers can be added/removed 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 (${GAME_TEST_FRAMEWORK}) - property 'forge.enabledGameTestNamespaces', '${ARTIFACT_ID}' - #end - - mods { - ${MOD_NAME} { - source sourceSets.main - } - } - } - - server { - workingDirectory project.file('run') - - // Recommended logging data for a userdev environment - // The markers can be added/removed 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 (${GAME_TEST_FRAMEWORK}) - property 'forge.enabledGameTestNamespaces', '${ARTIFACT_ID}' - #end - - mods { - ${MOD_NAME} { - source sourceSets.main - } - } - } -#if (${GAME_TEST_FRAMEWORK}) - - gameTestServer { - 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' - - // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. - property 'forge.enabledGameTestNamespaces', '${ARTIFACT_ID}' - - mods { - ${MOD_NAME} { - source sourceSets.main - } - } - } -#end -#if (${HAS_DATA}) - - data { - workingDirectory project.file('run') - - // Recommended logging data for a userdev environment - // The markers can be added/removed 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' - - // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. - args '--mod', '${MOD_NAME}', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') - - mods { - ${MOD_NAME} { - source sourceSets.main - } - } - } -#end - } -} -#if (${MIXINS}) - -mixin { - add sourceSets.main, "${ARTIFACT_ID}.refmap.json" - - config "${ARTIFACT_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: - // flatDir { - // dir 'libs' - // } -} - -dependencies { - // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft' it is assumed - // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied. - // The userdev artifact is a special name and will get all sorts of transformations applied to it. - minecraft 'net.minecraftforge:forge:${FORGE_VERSION}' - - api project(":${COMMON_PROJECT_NAME}") - - // Real mod deobf dependency examples - these get remapped to your current mappings - // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency - // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency - // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency - - // Examples using mod jars from ./libs - // 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 -} - -// Example for how to get properties into the manifest for reading at runtime. -jar { - manifest { - attributes([ - "Specification-Title": "${MOD_NAME}", - #if (${AUTHOR_LIST}) - "Specification-Vendor": "${AUTHOR_LIST}", - #else - //"Specification-Vendor": "${MOD_NAME} authors", - #end - "Specification-Version": "1", // We are version 1 of ourselves - "Implementation-Title": project.name, - "Implementation-Version": project.jar.archiveVersion, - #if (${AUTHOR_LIST}) - "Implementation-Vendor": "${AUTHOR_LIST}", - #else - //"Implementation-Vendor": "${MOD_NAME} authors", - #end - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") - ]) - } -} - -tasks.withType(JavaCompile).configureEach { - options.release = ${JAVA_VERSION} -} - -jar.finalizedBy('reobfJar') diff --git a/src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) Submodule build.gradle.html b/src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) Submodule build.gradle.html deleted file mode 100644 index 81af625a3..000000000 --- a/src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) Submodule build.gradle.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - -

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

- - diff --git a/src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) gradle.properties.ft b/src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) gradle.properties.ft index d1c768d7b..2209f7496 100644 --- a/src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) gradle.properties.ft +++ b/src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) gradle.properties.ft @@ -29,7 +29,7 @@ loader_version_range=[${FORGE_SPEC_VERSION},) # # 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=${MCP_CHANNEL} +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} diff --git a/src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) Main Class.java.ft b/src/main/resources/fileTemplates/j2ee/forge/Forge (1.16+) Main Class.java.ft similarity index 99% rename from src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) Main Class.java.ft rename to src/main/resources/fileTemplates/j2ee/forge/Forge (1.16+) Main Class.java.ft index 964ee5793..62c39f3a6 100644 --- a/src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) Main Class.java.ft +++ b/src/main/resources/fileTemplates/j2ee/forge/Forge (1.16+) Main Class.java.ft @@ -47,7 +47,7 @@ public class ${CLASS_NAME} { private void doClientStuff(final FMLClientSetupEvent event) { // do something that can only be done on the client - LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings); + LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().options); } private void enqueueIMC(final InterModEnqueueEvent event) { diff --git a/src/main/resources/fileTemplates/j2ee/forge/Forge Main Class.java.html b/src/main/resources/fileTemplates/j2ee/forge/Forge (1.16+) Main Class.java.html similarity index 95% rename from src/main/resources/fileTemplates/j2ee/forge/Forge Main Class.java.html rename to src/main/resources/fileTemplates/j2ee/forge/Forge (1.16+) Main Class.java.html index a124f05b0..50001da67 100644 --- a/src/main/resources/fileTemplates/j2ee/forge/Forge Main Class.java.html +++ b/src/main/resources/fileTemplates/j2ee/forge/Forge (1.16+) Main Class.java.html @@ -20,6 +20,6 @@ -

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

+

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

diff --git a/src/main/resources/fileTemplates/j2ee/forge/Forge (1.20+) Config.java.ft b/src/main/resources/fileTemplates/j2ee/forge/Forge (1.20+) Config.java.ft index b710dda04..731800c18 100644 --- a/src/main/resources/fileTemplates/j2ee/forge/Forge (1.20+) Config.java.ft +++ b/src/main/resources/fileTemplates/j2ee/forge/Forge (1.20+) Config.java.ft @@ -35,7 +35,7 @@ public class Config // 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(Collections.singletonList("items"), () -> List.of("minecraft:iron_ingot"), Config::validateItemName); + .defineListAllowEmpty("items", List.of("minecraft:iron_ingot"), Config::validateItemName); static final ForgeConfigSpec SPEC = BUILDER.build(); diff --git a/src/main/resources/fileTemplates/j2ee/forge/Forge Main Class.java.ft b/src/main/resources/fileTemplates/j2ee/forge/Forge Main Class.java.ft deleted file mode 100644 index 6d5b6a506..000000000 --- a/src/main/resources/fileTemplates/j2ee/forge/Forge Main Class.java.ft +++ /dev/null @@ -1,106 +0,0 @@ -package ${PACKAGE_NAME}; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.registry.GameRegistry; - -@Mod( - modid = ${CLASS_NAME}.MOD_ID, - name = ${CLASS_NAME}.MOD_NAME, - version = ${CLASS_NAME}.VERSION -) -public class ${CLASS_NAME} { - - public static final String MOD_ID = "${ARTIFACT_ID}"; - public static final String MOD_NAME = "${MOD_NAME}"; - public static final String VERSION = "${MOD_VERSION}"; - - /** This is the instance of your mod as created by Forge. It will never be null. */ - @Mod.Instance(MOD_ID) - public static ${CLASS_NAME} INSTANCE; - - /** - * This is the first initialization event. Register tile entities here. - * The registry events below will have fired prior to entry to this method. - */ - @Mod.EventHandler - public void preinit(FMLPreInitializationEvent event) { - - } - - /** - * This is the second initialization event. Register custom recipes - */ - @Mod.EventHandler - public void init(FMLInitializationEvent event) { - - } - - /** - * This is the final initialization event. Register actions from other mods here - */ - @Mod.EventHandler - public void postinit(FMLPostInitializationEvent event) { - - } - - /** - * Forge will automatically look up and bind blocks to the fields in this class - * based on their registry name. - */ - @GameRegistry.ObjectHolder(MOD_ID) - public static class Blocks { - /* - public static final MySpecialBlock mySpecialBlock = null; // placeholder for special block below - */ - } - - /** - * Forge will automatically look up and bind items to the fields in this class - * based on their registry name. - */ - @GameRegistry.ObjectHolder(MOD_ID) - public static class Items { - /* - public static final ItemBlock mySpecialBlock = null; // itemblock for the block above - public static final MySpecialItem mySpecialItem = null; // placeholder for special item below - */ - } - - /** - * This is a special class that listens to registry events, to allow creation of mod blocks and items at the proper time. - */ - @Mod.EventBusSubscriber - public static class ObjectRegistryHandler { - /** Listen for the register event for creating custom items */ - @SubscribeEvent - public static void addItems(RegistryEvent.Register event) { - /* - event.getRegistry().register(new ItemBlock(Blocks.myBlock).setRegistryName(MOD_ID, "myBlock")); - event.getRegistry().register(new MySpecialItem().setRegistryName(MOD_ID, "mySpecialItem")); - */ - } - /** Listen for the register event for creating custom blocks */ - @SubscribeEvent - public static void addBlocks(RegistryEvent.Register event) { - /* - event.getRegistry().register(new MySpecialBlock().setRegistryName(MOD_ID, "mySpecialBlock")); - */ - } - } - /* EXAMPLE ITEM AND BLOCK - you probably want these in separate files - public static class MySpecialItem extends Item { - - } - - public static class MySpecialBlock extends Block { - - } - */ -} diff --git a/src/main/resources/fileTemplates/j2ee/forge/Forge build.gradle.ft b/src/main/resources/fileTemplates/j2ee/forge/Forge build.gradle.ft deleted file mode 100644 index 40fc1dbee..000000000 --- a/src/main/resources/fileTemplates/j2ee/forge/Forge build.gradle.ft +++ /dev/null @@ -1,57 +0,0 @@ -buildscript { - repositories { - mavenCentral() - maven { - name = "forge" - url = "https://files.minecraftforge.net/maven" - } - } - dependencies { - classpath "net.minecraftforge.gradle:ForgeGradle:${FORGEGRADLE_VERSION}-SNAPSHOT" - } -} - -apply plugin: "net.minecraftforge.gradle.forge" - -group = '${GROUP_ID}' -version = '${MOD_VERSION}' -archivesBaseName = '${ARTIFACT_ID}' - -minecraft { - version = project.forgeVersion - runDir = "run" - - // the mappings can be changed at any time, and must be in the following format. - // snapshot_YYYYMMDD snapshot are built nightly. - // stable_# stables are built at the discretion of the MCP team. - // 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 = project.mcpVersion - // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. -} - -repositories { - mavenCentral() -} - -dependencies { -} - -processResources { - // this will ensure that this task is redone when the versions change. - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version - - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include "mcmod.info" - - // replace version and mcversion - expand "version": project.version, "mcversion": project.minecraft.version - } - - // copy everything else, thats not the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude "mcmod.info" - } -} diff --git a/src/main/resources/fileTemplates/j2ee/forge/Forge build.gradle.html b/src/main/resources/fileTemplates/j2ee/forge/Forge build.gradle.html deleted file mode 100644 index 195f4b284..000000000 --- a/src/main/resources/fileTemplates/j2ee/forge/Forge build.gradle.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - -

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

- - diff --git a/src/main/resources/fileTemplates/j2ee/forge/Forge gradle.properties.ft b/src/main/resources/fileTemplates/j2ee/forge/Forge gradle.properties.ft deleted file mode 100644 index b60967cdd..000000000 --- a/src/main/resources/fileTemplates/j2ee/forge/Forge gradle.properties.ft +++ /dev/null @@ -1,8 +0,0 @@ -#if (${FORGE_VERSION}) -forgeVersion = ${FORGE_VERSION} -#end -#if (${MCP_VERSION}) -mcpVersion = ${MCP_VERSION} -#end -org.gradle.jvmargs=-Xmx3G -org.gradle.daemon=false diff --git a/src/main/resources/fileTemplates/j2ee/forge/Forge gradle.properties.html b/src/main/resources/fileTemplates/j2ee/forge/Forge gradle.properties.html deleted file mode 100644 index ff1164f45..000000000 --- a/src/main/resources/fileTemplates/j2ee/forge/Forge gradle.properties.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - -

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

- - diff --git a/src/main/resources/fileTemplates/j2ee/forge/Forge settings.gradle.ft b/src/main/resources/fileTemplates/j2ee/forge/Forge settings.gradle.ft deleted file mode 100644 index b66ab2349..000000000 --- a/src/main/resources/fileTemplates/j2ee/forge/Forge settings.gradle.ft +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = '${ARTIFACT_ID}' diff --git a/src/main/resources/fileTemplates/j2ee/forge/Forge settings.gradle.html b/src/main/resources/fileTemplates/j2ee/forge/Forge settings.gradle.html deleted file mode 100644 index e1370049d..000000000 --- a/src/main/resources/fileTemplates/j2ee/forge/Forge settings.gradle.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - -

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

- -