Skip to content

Commit

Permalink
Merge branch 'refs/heads/2023.1' into 2023.2
Browse files Browse the repository at this point in the history
  • Loading branch information
RedNesto committed Feb 26, 2024
2 parents 0549e5a + 75b9199 commit e47fda5
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 21 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
5 changes: 4 additions & 1 deletion src/main/kotlin/facet/MinecraftFacetDetector.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -88,7 +89,9 @@ class MinecraftFacetDetector : ProjectActivity {
}

if (needsReimport) {
ProjectReimporter.reimport(project)
runInEdt {
ProjectReimporter.reimport(project)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ class ForgeRunConfigDataService : AbstractProjectDataService<ProjectData, Projec
}
}

if (project.isDisposed) {
return
}

project.guessProjectDir()?.let { dir ->
LocalFileSystem.getInstance().refreshFiles(listOf(dir), true, true, null)
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/platform/forge/util/ForgeConstants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class NewInsnSelectorParser : MixinSelectorParser {
return if (strippedValue.startsWith('(')) {
NewInsnDescriptorSelector(strippedValue)
} else {
NewInsnTypeSelector(strippedValue)
NewInsnTypeSelector(strippedValue.removeSurrounding("L", ";"))
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/kotlin/platform/velocity/creator/asset-steps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/platform/velocity/creator/ui-steps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/toml/platform/forge/ModsTomlSchema.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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='''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class ModsTomlCompletionContributor : CompletionContributor() {
extendBooleanValues("showAsResourcePack")
extendBooleanValues("logoBlur")
extendBooleanValues("mandatory")
extendBooleanValues("clientSideOnly")
}

private fun extendKnownValues(key: String, values: Set<String>) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/test/kotlin/platform/forge/ModsTomlCompletionTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class ModsTomlCompletionTest : BasePlatformTestCase() {
"license",
"showAsResourcePack",
"issueTrackerURL",
"clientSideOnly",
)
}

Expand Down

0 comments on commit e47fda5

Please sign in to comment.