diff --git a/build.gradle.kts b/build.gradle.kts index 6082ee0f8..f92d06dc6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,7 +34,7 @@ plugins { mcdev groovy idea - id("org.jetbrains.intellij") version "1.17.0" + id("org.jetbrains.intellij") version "1.17.2" id("org.cadixdev.licenser") id("org.jlleitschuh.gradle.ktlint") version "10.3.0" } diff --git a/gradle.properties b/gradle.properties index 1880dff20..4497ac3cd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,7 +24,7 @@ kotlin.code.style=official ideaVersion = 2023.2.2 ideaVersionName = 2023.2.2 -coreVersion = 1.7.2 +coreVersion = 1.7.3 downloadIdeaSources = true pluginTomlVersion = 232.8660.88 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7f93135c4..d64cd4917 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 3fa8f862f..a80b22ce5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew.bat b/gradlew.bat index 93e3f59f1..25da30dbd 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/src/main/kotlin/facet/MinecraftFacetDetector.kt b/src/main/kotlin/facet/MinecraftFacetDetector.kt index 3cb71f732..29b1e5f6d 100644 --- a/src/main/kotlin/facet/MinecraftFacetDetector.kt +++ b/src/main/kotlin/facet/MinecraftFacetDetector.kt @@ -31,6 +31,7 @@ import com.demonwav.mcdev.util.runWriteTaskLater import com.intellij.facet.FacetManager import com.intellij.facet.impl.ui.libraries.LibrariesValidatorContextImpl import com.intellij.framework.library.LibraryVersionProperties +import com.intellij.openapi.application.runInEdt import com.intellij.openapi.module.Module import com.intellij.openapi.module.ModuleManager import com.intellij.openapi.project.Project @@ -88,7 +89,9 @@ class MinecraftFacetDetector : ProjectActivity { } if (needsReimport) { - ProjectReimporter.reimport(project) + runInEdt { + ProjectReimporter.reimport(project) + } } } diff --git a/src/main/kotlin/platform/forge/gradle/ForgeRunConfigDataService.kt b/src/main/kotlin/platform/forge/gradle/ForgeRunConfigDataService.kt index 02f64032e..2d5642ad3 100644 --- a/src/main/kotlin/platform/forge/gradle/ForgeRunConfigDataService.kt +++ b/src/main/kotlin/platform/forge/gradle/ForgeRunConfigDataService.kt @@ -176,6 +176,10 @@ class ForgeRunConfigDataService : AbstractProjectDataService LocalFileSystem.getInstance().refreshFiles(listOf(dir), true, true, null) } diff --git a/src/main/kotlin/platform/forge/util/ForgeConstants.kt b/src/main/kotlin/platform/forge/util/ForgeConstants.kt index 9c70703a5..4fb17ae0b 100644 --- a/src/main/kotlin/platform/forge/util/ForgeConstants.kt +++ b/src/main/kotlin/platform/forge/util/ForgeConstants.kt @@ -51,6 +51,6 @@ object ForgeConstants { // From https://github.com/MinecraftForge/MinecraftForge/blob/38a5400a8c878fe39cd389e6d4f68619d2738b88/src/fmllauncher/java/net/minecraftforge/fml/loading/moddiscovery/ModInfo.java#L45 val MOD_ID_REGEX = "^[a-z][a-z0-9_-]{1,63}$".toRegex() - val DISPLAY_TEST_MANIFEST_VERSION = SemanticVersion.release(41, 0, 15) + val DISPLAY_TEST_MANIFEST_VERSION = SemanticVersion.release(40, 2, 14) val CLIENT_ONLY_MANIFEST_VERSION = SemanticVersion.release(49, 0, 6) } diff --git a/src/main/kotlin/platform/mixin/handlers/injectionPoint/NewInsnInjectionPoint.kt b/src/main/kotlin/platform/mixin/handlers/injectionPoint/NewInsnInjectionPoint.kt index a421dd21f..622be249f 100644 --- a/src/main/kotlin/platform/mixin/handlers/injectionPoint/NewInsnInjectionPoint.kt +++ b/src/main/kotlin/platform/mixin/handlers/injectionPoint/NewInsnInjectionPoint.kt @@ -223,7 +223,7 @@ class NewInsnSelectorParser : MixinSelectorParser { return if (strippedValue.startsWith('(')) { NewInsnDescriptorSelector(strippedValue) } else { - NewInsnTypeSelector(strippedValue) + NewInsnTypeSelector(strippedValue.removeSurrounding("L", ";")) } } } diff --git a/src/main/kotlin/platform/velocity/creator/asset-steps.kt b/src/main/kotlin/platform/velocity/creator/asset-steps.kt index 9bfa2e4db..39e4e0244 100644 --- a/src/main/kotlin/platform/velocity/creator/asset-steps.kt +++ b/src/main/kotlin/platform/velocity/creator/asset-steps.kt @@ -103,12 +103,12 @@ class VelocityModifyMainClassStep( val authors = data.getUserData(AuthorsStep.KEY) ?: emptyList() val dependencies = data.getUserData(DependStep.KEY) ?: emptyList() - NonProjectFileWritingAccessProvider.disableChecksDuring { - project.runWriteTaskInSmartMode { + project.runWriteTaskInSmartMode { + NonProjectFileWritingAccessProvider.disableChecksDuring { val mainClassVirtualFile = VfsUtil.findFile(Path.of(mainClassFile), true) - ?: return@runWriteTaskInSmartMode + ?: return@disableChecksDuring val mainClassPsi = PsiManager.getInstance(project).findFile(mainClassVirtualFile) as? PsiJavaFile - ?: return@runWriteTaskInSmartMode + ?: return@disableChecksDuring val psiClass = mainClassPsi.classes[0] val annotation = buildString { diff --git a/src/main/kotlin/platform/velocity/creator/ui-steps.kt b/src/main/kotlin/platform/velocity/creator/ui-steps.kt index 7b2cff5dd..6019e2926 100644 --- a/src/main/kotlin/platform/velocity/creator/ui-steps.kt +++ b/src/main/kotlin/platform/velocity/creator/ui-steps.kt @@ -95,6 +95,7 @@ class VelocityVersionStep( 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 } diff --git a/src/main/kotlin/toml/platform/forge/ModsTomlSchema.kt b/src/main/kotlin/toml/platform/forge/ModsTomlSchema.kt index fa60abab7..800a6cc2f 100644 --- a/src/main/kotlin/toml/platform/forge/ModsTomlSchema.kt +++ b/src/main/kotlin/toml/platform/forge/ModsTomlSchema.kt @@ -48,6 +48,8 @@ license="All rights reserved" showAsResourcePack=false # A URL to refer people to when problems occur with this mod. issueTrackerURL="http://my.issue.tracker/" +# 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=false # A list of mods - how many allowed here is determined by the individual mod loader [[mods]] # The modid of the mod. @@ -74,7 +76,7 @@ authors="Love, Cheese and small house plants" # 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) +displayTest="MATCH_VERSION" # if nothing is specified, MATCH_VERSION is the default when clientSideOnly=false, otherwise IGNORE_ALL_VERSION when clientSideOnly=true (#optional) # The description text for the mod (multi line!) description=''' diff --git a/src/main/kotlin/toml/platform/forge/completion/ModsTomlCompletionContributor.kt b/src/main/kotlin/toml/platform/forge/completion/ModsTomlCompletionContributor.kt index 7b87c4ac7..45de2e1f2 100644 --- a/src/main/kotlin/toml/platform/forge/completion/ModsTomlCompletionContributor.kt +++ b/src/main/kotlin/toml/platform/forge/completion/ModsTomlCompletionContributor.kt @@ -58,6 +58,7 @@ class ModsTomlCompletionContributor : CompletionContributor() { extendBooleanValues("showAsResourcePack") extendBooleanValues("logoBlur") extendBooleanValues("mandatory") + extendBooleanValues("clientSideOnly") } private fun extendKnownValues(key: String, values: Set) = diff --git a/src/main/kotlin/toml/platform/forge/inspections/ModsTomlValidationInspection.kt b/src/main/kotlin/toml/platform/forge/inspections/ModsTomlValidationInspection.kt index 44a7170d8..d5490af52 100644 --- a/src/main/kotlin/toml/platform/forge/inspections/ModsTomlValidationInspection.kt +++ b/src/main/kotlin/toml/platform/forge/inspections/ModsTomlValidationInspection.kt @@ -112,6 +112,15 @@ class ModsTomlValidationInspection : LocalInspectionTool() { holder.registerProblem(value, TextRange(1, endOffset), "Order $order does not exist") } } + "clientSideOnly" -> { + val forgeVersion = runCatching { + keyValue.findMcpModule()?.getSettings()?.platformVersion?.let(SemanticVersion::parse) + }.getOrNull() + val minVersion = ForgeConstants.CLIENT_ONLY_MANIFEST_VERSION + if (forgeVersion != null && forgeVersion < minVersion) { + holder.registerProblem(keyValue.key, "ClientSideOnly is only available since $minVersion") + } + } } } diff --git a/src/test/kotlin/platform/forge/ModsTomlCompletionTest.kt b/src/test/kotlin/platform/forge/ModsTomlCompletionTest.kt index 5c222c6c1..a62d2fafe 100644 --- a/src/test/kotlin/platform/forge/ModsTomlCompletionTest.kt +++ b/src/test/kotlin/platform/forge/ModsTomlCompletionTest.kt @@ -53,6 +53,7 @@ class ModsTomlCompletionTest : BasePlatformTestCase() { "license", "showAsResourcePack", "issueTrackerURL", + "clientSideOnly", ) }