Skip to content

Commit

Permalink
Merge pull request #82 from halotroop2288/pr/foxloader
Browse files Browse the repository at this point in the history
FoxLoader Support + Fix ReIndev Dependency Notation
wagyourtail authored Aug 2, 2024

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
2 parents 68bfa03 + d71e571 commit 97018db
Showing 26 changed files with 972 additions and 114 deletions.
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@ import org.jetbrains.annotations.ApiStatus
import xyz.wagyourtail.unimined.api.source.task.MigrateMappingsTask
import xyz.wagyourtail.unimined.api.minecraft.MinecraftConfig
import xyz.wagyourtail.unimined.api.minecraft.patch.fabric.FabricLikeApiExtension
import xyz.wagyourtail.unimined.util.DefaultMap
import xyz.wagyourtail.unimined.util.FinalizeOnRead
import xyz.wagyourtail.unimined.util.sourceSets
import java.nio.file.Path
@@ -123,7 +122,7 @@ abstract class UniminedExtension(val project: Project) {
}

/**
* @since 1.4.0
* @since 1.3.5
*/
@JvmOverloads
abstract fun reIndev(
@@ -133,7 +132,7 @@ abstract class UniminedExtension(val project: Project) {
)

/**
* @since 1.4.0
* @since 1.3.5
*/
@JvmOverloads
fun reIndev(
@@ -147,7 +146,7 @@ abstract class UniminedExtension(val project: Project) {
}

/**
* @since 1.4.0
* @since 1.3.5
*/
@JvmOverloads
fun reIndev(
@@ -164,7 +163,7 @@ abstract class UniminedExtension(val project: Project) {
}

/**
* @since 1.4.0
* @since 1.3.5
*/
@JvmOverloads
fun reIndev(
Original file line number Diff line number Diff line change
@@ -15,7 +15,9 @@ import xyz.wagyourtail.unimined.api.minecraft.patch.forge.ForgeLikePatcher
import xyz.wagyourtail.unimined.api.minecraft.patch.forge.MinecraftForgePatcher
import xyz.wagyourtail.unimined.api.minecraft.patch.forge.NeoForgedPatcher
import xyz.wagyourtail.unimined.api.minecraft.patch.jarmod.JarModAgentPatcher
import xyz.wagyourtail.unimined.api.minecraft.patch.reindev.FoxLoaderPatcher
import xyz.wagyourtail.unimined.api.minecraft.patch.rift.RiftPatcher
import java.lang.UnsupportedOperationException

/**
* usage:
@@ -335,6 +337,41 @@ interface PatchProviders {
}
}

/**
* enables the FoxLoader patcher.
* @since 1.3.5
*/
fun foxLoader() {
foxLoader {}
}

/**
* enables the FoxLoader patcher.
* @param action the action to configure the patcher.
* @since 1.3.5
*/
fun foxLoader(action: FoxLoaderPatcher.() -> Unit) {
throw UnsupportedOperationException("Only ReIndev is supported by FoxLoader.")
}

/**
* enables the FoxLoader patcher.
* @param action the action to configure the patcher.
* @since 1.3.5
*/
fun foxLoader(
@DelegatesTo(
value = FoxLoaderPatcher::class,
strategy = Closure.DELEGATE_FIRST
) action: Closure<*>
) {
foxLoader {
action.delegate = this
action.resolveStrategy = Closure.DELEGATE_FIRST
action.call()
}
}

/**
* enables the jar mod patcher.
* @param action the action to configure the patcher.
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
package xyz.wagyourtail.unimined.api.minecraft.patch.reindev

import groovy.lang.Closure
import groovy.lang.DelegatesTo
import org.gradle.api.artifacts.Dependency
import xyz.wagyourtail.unimined.api.minecraft.patch.MinecraftPatcher

/**
* The class responsible for patching ReIndev for FoxLoader.
*
* usage:
* ```groovy
* foxLoader {
* loader()
* modId = "example-mod"
* clientMod = "com.example.example.mod.ExampleClient"
* }
* ```
* @see loader
* @see modId
* @see commonMod
* @see clientMod
* @see serverMod
* @since 1.3.5
*/
interface FoxLoaderPatcher : MinecraftPatcher {

/**
* Picks the version of the loader automatically, based on the ReIndev version.
*
* @since 1.3.5
*/
fun loader()

/**
* @since 1.3.5
*/
fun loader(dep: Any) {
loader(dep) {}
}

/**
* Sets the dependency for FoxLoader explicitly.
* @param dep Either a version number or a dependency notation.
*
* @since 1.3.5
*/
fun loader(dep: Any, action: Dependency.() -> Unit)

/**
* Sets the dependency for FoxLoader explicitly.
* @param dep Either a version number or a dependency notation.
*
* @since 1.3.5
*/
fun loader(
dep: Any,
@DelegatesTo(
value = Dependency::class,
strategy = Closure.DELEGATE_FIRST
) action: Closure<*>
) {
loader(dep) {
action.delegate = this
action.resolveStrategy = Closure.DELEGATE_FIRST
action.call()
}
}

/**
* Path to your mod's common initializer. Must extend from Mod.
*
* Example: `com.example.example.mod.ExampleMod`
* @since 1.3.5
*/
var commonMod: String

/**
* Path to your mod's client initializer. Must extend from Mod and implement ClientMod.
*
* Example: `com.example.example.mod.ExampleClient`
* @since 1.3.5
*/
var clientMod: String

/**
* Path to your mod's server initializer. Must extend from Mod and implement ServerMod.
*
* Example: `com.example.example.mod.ExampleServer`
* @since 1.3.5
*/
var serverMod: String

/**
* Required. The short ID of your mod.
*
* Example: `example-mod`
* @since 1.3.5
*/
var modId: String

/**
* The version number of your mod. Defaults to the project version.
*
* Example: `1.0.0`
* @since 1.3.5
*/
var modVersion: String

/**
* The name of your mod.
*
* Example: `Example Mod`
* @since 1.3.5
*/
var modName: String

/**
* Provided for the convenience of migration
* @since 1.3.5
*/
@Deprecated("", replaceWith = ReplaceWith("modDescription"))
var modDesc: String

/**
* The description of your mod. This must fit on one line in the mod list screen.
*
* Example: `An example mod for FoxLoader!`
* @since 1.3.5
*/
var modDescription: String

/**
* The web homepage for your mod.
*
* Example: `https://example.com/example-mod`
* @since 1.3.5
*/
var modWebsite: String

/**
* The entrypoint for your mod's ASM transformations. Must implement PreClassTransformer.
*
* Example: `com.example.example.mod.transformer.ExamplePreClassTransformer`
* @since 1.3.5
*/
var preClassTransformer: String

/**
*
* Example: `com.example.example.mod.plugin.ExampleFoxLoaderPlugin`
*
* @since 1.3.5
*/
var loadingPlugin: String

/**
* Adds the "unofficial" tag to your mod in the mod list screen.
* @since 1.3.5
*/
var unofficial: Boolean
}
Loading

0 comments on commit 97018db

Please sign in to comment.