-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Port] Update to special/flint-1.21.1 (v2.5.3)
- Loading branch information
Showing
10 changed files
with
236 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import xyz.wagyourtail.unimined.api.mapping.task.ExportMappingsTask | ||
import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask | ||
|
||
/** | ||
* Retrieve a Project Property | ||
*/ | ||
operator fun String.invoke(): String? { | ||
return project.properties[this] as String? | ||
} | ||
|
||
val modName: String by extra | ||
val modId: String by extra | ||
|
||
val isLegacy: Boolean by extra | ||
val protocol: Int by extra | ||
val isJarMod: Boolean by extra | ||
val accessWidenerFile: File by extra | ||
val isMCPJar: Boolean by extra | ||
val isModern: Boolean by extra | ||
val versionFormat: String by extra | ||
val versionLabel: String by extra | ||
val mcVersionLabel: String by extra | ||
val mcMappingsType: String by extra | ||
val canUseATs: Boolean by extra | ||
val baseVersionLabel: String by extra | ||
|
||
unimined.minecraft { | ||
// N/A | ||
} | ||
|
||
val common: Configuration by configurations.creating | ||
val shadowCommon: Configuration by configurations.creating | ||
|
||
configurations.compileClasspath.get().extendsFrom(common) | ||
configurations.runtimeClasspath.get().extendsFrom(common) | ||
|
||
dependencies { | ||
// Flint API Implementation | ||
"modImplementation"("net.flintloader:flint-api:${"flint_api_version"()}") | ||
// Mod Menu API Implementation | ||
"modImplementation"("${"modmenu_group"()}:ModMenu:${"modmenu_version"()}") | ||
|
||
"common"(project(path = ":common")) { isTransitive = false } | ||
"common"(project(path = ":common", configuration = "shade")) { | ||
exclude(group = "com.google.code.gson") | ||
} | ||
"common"(project(path = ":common", configuration = "runtime")) | ||
"shadowCommon"(project(path = ":common", configuration = "shadeOnly")) | ||
"shadowCommon"(project(path = ":common")) { isTransitive = false } | ||
} | ||
|
||
val resourceTargets = listOf( | ||
"flintmodule.json", | ||
"pack.mcmeta" | ||
) | ||
val replaceProperties = mapOf( | ||
"mod_id" to modId, | ||
"mod_name" to modName, | ||
"version" to baseVersionLabel, | ||
"mcversion" to mcVersionLabel, | ||
"loader_version_range" to "flint_loader_version_range"() | ||
) | ||
|
||
tasks.processResources { | ||
inputs.properties(replaceProperties) | ||
|
||
filesMatching(resourceTargets) { | ||
expand(replaceProperties) | ||
} | ||
} | ||
|
||
tasks.shadowJar { | ||
mustRunAfter(project(":common").tasks.shadowJar) | ||
dependsOn(project(":common").tasks.shadowJar) | ||
from(zipTree(project(":common").tasks.shadowJar.get().archiveFile)) | ||
configurations = listOf(shadowCommon) | ||
archiveClassifier.set("dev-shadow") | ||
} | ||
|
||
tasks.named<RemapJarTask>("remapJar") { | ||
dependsOn(tasks.shadowJar.get()) | ||
asJar { | ||
inputFile.set(tasks.shadowJar.get().archiveFile) | ||
archiveClassifier.set(project.name) | ||
} | ||
} | ||
|
||
tasks.jar { | ||
archiveClassifier.set("dev") | ||
} | ||
|
||
tasks.sourcesJar { | ||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
val commonSources = project(":common").tasks.sourcesJar | ||
dependsOn(commonSources.get()) | ||
from(commonSources.get().archiveFile.map { zipTree(it) }) | ||
} |
55 changes: 55 additions & 0 deletions
55
flint/src/main/java/com/gitlab/cdagaming/craftpresence/flint/CraftPresenceFlint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2018 - 2025 CDAGaming ([email protected]) | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package com.gitlab.cdagaming.craftpresence.flint; | ||
|
||
import com.gitlab.cdagaming.craftpresence.CraftPresence; | ||
import io.github.cdagaming.unicore.utils.OSUtils; | ||
import net.flintloader.loader.api.FlintModule; | ||
|
||
/** | ||
* The Primary Application Class and Utilities | ||
* | ||
* @author CDAGaming | ||
*/ | ||
public class CraftPresenceFlint implements FlintModule { | ||
@Override | ||
public void initializeModule() { | ||
try { | ||
if (OSUtils.JAVA_SPEC < 1.8f) { | ||
throw new UnsupportedOperationException("Incompatible JVM!!! @MOD_NAME@ requires Java 8 or above to work properly!"); | ||
} | ||
new CraftPresence(this::setupIntegrations); | ||
} catch (NoClassDefFoundError ex) { | ||
throw new UnsupportedOperationException("Unable to initialize @MOD_NAME@! @UNILIB_NAME@ (unilib) is required to run this mod (Requires @UNILIB_MIN_VERSION@ or above)", ex); | ||
} | ||
} | ||
|
||
/** | ||
* Setup external integrations and attachments to the primary application | ||
*/ | ||
public void setupIntegrations() { | ||
// N/A | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
flint/src/main/java/com/gitlab/cdagaming/craftpresence/flint/impl/ModMenuImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2018 - 2025 CDAGaming ([email protected]) | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package com.gitlab.cdagaming.craftpresence.flint.impl; | ||
|
||
import com.gitlab.cdagaming.craftpresence.config.gui.MainGui; | ||
import com.terraformersmc.modmenu.api.ConfigScreenFactory; | ||
import com.terraformersmc.modmenu.api.ModMenuApi; | ||
|
||
/** | ||
* Hook to provide Integration with ProspectorDev's ModMenu | ||
* | ||
* @author CDAGaming | ||
*/ | ||
public class ModMenuImpl implements ModMenuApi { | ||
@Override | ||
public ConfigScreenFactory<?> getModConfigScreenFactory() { | ||
return MainGui::new; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessWidener v2 named | ||
|
||
accessible field net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl postDisconnectScreen Lnet/minecraft/client/gui/screens/Screen; | ||
accessible method com/mojang/realmsclient/RealmsMainScreen getSelectedServer ()Lcom/mojang/realmsclient/dto/RealmsServer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"id": "${mod_id}", | ||
"version": "${version}", | ||
"name": "${mod_name}", | ||
"description": "Completely Customize the way others see you play in Discord!", | ||
"authors": [ | ||
"CDAGaming" | ||
], | ||
"license": "MIT", | ||
"icon": "logo.png", | ||
"entryPoints": { | ||
"main": "com.gitlab.cdagaming.craftpresence.flint.CraftPresenceFlint", | ||
"modmenu": "com.gitlab.cdagaming.craftpresence.flint.impl.ModMenuImpl" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"pack": { | ||
"description": "${mod_name} Resources", | ||
"pack_format": 34 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters