Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quilt Support #1984

Open
wants to merge 23 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
59b250f
Initial work on quilt support
anonymous123-code Mar 27, 2023
fcdc9d6
Gradle template fixes
anonymous123-code Mar 27, 2023
a6ebe7b
Properly add Quilt to Facet editor
anonymous123-code Mar 27, 2023
f52bf80
Add Templates to template editor
anonymous123-code Mar 27, 2023
4f48c2f
Fix generated qmj
anonymous123-code Mar 27, 2023
5810f9a
Dont generate client Entry Point on Server-Only mods
anonymous123-code Mar 27, 2023
d8e7fd2
Fix environment information in QMJ
anonymous123-code Mar 27, 2023
3fa28cf
Fix entrypoint name detected as name listener
anonymous123-code Mar 27, 2023
be2ecc5
QMJ template fix: use artifact id in mod icon path
anonymous123-code Mar 28, 2023
76f9ac1
Temp fix: remove gradle wrapper step to avoid sync and wrapper runnin…
anonymous123-code Mar 28, 2023
2a958a3
Fix: metadata is now properly filled
anonymous123-code Mar 28, 2023
76a1ad2
Fix formatting
anonymous123-code Mar 28, 2023
66953fe
Forgot some licenses
anonymous123-code Mar 28, 2023
93dde67
Some more formatting
anonymous123-code Mar 28, 2023
cf06e2f
Merge branch 'minecraft-dev:dev' into quilt
anonymous123-code Apr 13, 2023
bf81f89
Fix for https://github.com/QuiltMC/update-quilt-meta/issues/9
anonymous123-code Apr 13, 2023
9765754
Readd gradle wrapper step as it seems to be fixed since the merge
anonymous123-code Apr 18, 2023
df4142f
Revert "Fix for https://github.com/QuiltMC/update-quilt-meta/issues/9…
anonymous123-code Apr 18, 2023
e0b69e4
Merge remote-tracking branch 'super/dev' into quilt
anonymous123-code Apr 18, 2023
62651ed
Add Standard Library selector
anonymous123-code Apr 19, 2023
f4c1bab
Properly store changes to the authors input
anonymous123-code Apr 19, 2023
fe0a0a6
Refactor: Move row init inside init blocks
anonymous123-code Apr 19, 2023
00ef5a9
Refactor: Move row init inside init blocks
anonymous123-code Apr 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* Minecraft Dev for IntelliJ
*
* https://minecraftdev.org
*
* Copyright (c) 2023 minecraft-dev
*
* MIT License
*/

package com.demonwav.mcdev.platform.mcp.gradle.tooling.quiltloom

import org.gradle.api.Project
import org.jetbrains.annotations.NotNull
import org.jetbrains.plugins.gradle.tooling.ErrorMessageBuilder
import org.jetbrains.plugins.gradle.tooling.ModelBuilderService

class QuiltLoomModelBuilderImpl implements ModelBuilderService {

@Override
boolean canBuild(String modelName) {
return QuiltLoomModel.name == modelName
}

@Override
Object buildAll(String modelName, Project project) {
if (!project.plugins.hasPlugin('quilt-loom')) {
return null
}

def loomExtension = project.extensions.getByName('loom')

try {
return build(project, loomExtension)
} catch (GroovyRuntimeException ignored) {
// Must be using an older loom version, fallback.
return buildLegacy(project, loomExtension)
}
}

QuiltLoomModel build(Project project, Object loomExtension) {
def tinyMappings = loomExtension.mappingsFile
def splitMinecraftJar = loomExtension.areEnvironmentSourceSetsSplit()

def decompilers = [:]

if (splitMinecraftJar) {
decompilers << ["common": getDecompilers(loomExtension, false)]
decompilers << ["client": getDecompilers(loomExtension, true)]
} else {
decompilers << ["single": getDecompilers(loomExtension, false)]
}

//noinspection GroovyAssignabilityCheck
return new QuiltLoomModelImpl(tinyMappings, decompilers, splitMinecraftJar)
}

List<QuiltLoomModelImpl.DecompilerModelImpl> getDecompilers(Object loomExtension, boolean client) {
loomExtension.decompilerOptions.collect {
def task = loomExtension.getDecompileTask(it, client)
def sourcesPath = task.outputJar.get().getAsFile().getAbsolutePath()
new QuiltLoomModelImpl.DecompilerModelImpl(name: it.name, taskName: task.name, sourcesPath: sourcesPath)
}
}

QuiltLoomModel buildLegacy(Project project, Object loomExtension) {
def tinyMappings = loomExtension.mappingsProvider.tinyMappings.toFile().getAbsoluteFile()
def decompilers = loomExtension.decompilerOptions.collect {
def task = project.tasks.getByName('genSourcesWith' + it.name.capitalize())
def sourcesPath = task.runtimeJar.get().getAsFile().getAbsolutePath().dropRight(4) + "-sources.jar"
new QuiltLoomModelImpl.DecompilerModelImpl(name: it.name, taskName: task.name, sourcesPath: sourcesPath)
}

//noinspection GroovyAssignabilityCheck
return new QuiltLoomModelImpl(tinyMappings, ["single": decompilers], false)
}

@Override
ErrorMessageBuilder getErrorMessageBuilder(@NotNull Project project, @NotNull Exception e) {
return ErrorMessageBuilder.create(
project, e, "MinecraftDev import errors"
).withDescription("Unable to build MinecraftDev QuiltLoom project configuration")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Minecraft Dev for IntelliJ
*
* https://minecraftdev.org
*
* Copyright (c) 2023 minecraft-dev
*
* MIT License
*/

package com.demonwav.mcdev.platform.mcp.gradle.tooling.quiltloom

import groovy.transform.Immutable

@Immutable(knownImmutableClasses = [File])
class QuiltLoomModelImpl implements QuiltLoomModel, Serializable {
File tinyMappings
Map<String, List<DecompilerModel>> decompilers
boolean splitMinecraftJar

@Immutable
static class DecompilerModelImpl implements DecompilerModel, Serializable {
String name
String taskName
String sourcesPath
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Minecraft Dev for IntelliJ
*
* https://minecraftdev.org
*
* Copyright (c) 2023 minecraft-dev
*
* MIT License
*/

package com.demonwav.mcdev.platform.mcp.gradle.tooling.quiltloom;

import java.io.File;
import java.util.List;
import java.util.Map;

public interface QuiltLoomModel {

File getTinyMappings();

Map<String, List<DecompilerModel>> getDecompilers();

boolean getSplitMinecraftJar();

interface DecompilerModel {

String getName();

String getTaskName();

String getSourcesPath();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
com.demonwav.mcdev.platform.mcp.gradle.tooling.archloom.ArchitecturyModelBuilderImpl
com.demonwav.mcdev.platform.mcp.gradle.tooling.fabricloom.FabricLoomModelBuilderImpl
com.demonwav.mcdev.platform.mcp.gradle.tooling.quiltloom.QuiltLoomModelBuilderImpl
com.demonwav.mcdev.platform.mcp.gradle.tooling.vanillagradle.VanillaGradleModelBuilderImpl
com.demonwav.mcdev.platform.mcp.gradle.tooling.McpModelFG2BuilderImpl
com.demonwav.mcdev.platform.mcp.gradle.tooling.McpModelFG3BuilderImpl
3 changes: 3 additions & 0 deletions src/main/kotlin/asset/PlatformAssets.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ object PlatformAssets : Assets() {
val FABRIC_ICON = loadIcon("/assets/icons/platform/Fabric.png")
val FABRIC_ICON_2X = loadIcon("/assets/icons/platform/Fabric@2x.png")

val QUILT_ICON = loadIcon("/assets/icons/platform/Quilt.png")
val QUILT_ICON_2X = loadIcon("/assets/icons/platform/Quilt@2x.png")

val ARCHITECTURY_ICON = loadIcon("/assets/icons/platform/Architectury.png")
val ARCHITECTURY_ICON_2X = loadIcon("/assets/icons/platform/Architectury@2x.png")

Expand Down
Loading