-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #164 from LostLuma/multi-platform
Add Forge and NeoForge support
- Loading branch information
Showing
126 changed files
with
1,792 additions
and
408 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 |
---|---|---|
@@ -1,86 +1,72 @@ | ||
plugins { | ||
id "maven-publish" | ||
alias libs.plugins.fabric.loom | ||
alias libs.plugins.architectury | ||
alias libs.plugins.architectury.loom apply false | ||
} | ||
|
||
group = project.maven_group | ||
version = "${generateVersion()}+minecraft-${libs.versions.minecraft.get()}" | ||
|
||
base { | ||
archivesName = project.archives_base_name | ||
} | ||
|
||
repositories { | ||
maven { url = "https://maven.shedaniel.me/" } // cloth config | ||
maven { url = "https://maven.terraformersmc.com/releases/" } // modmenu | ||
architectury { | ||
minecraft = libs.versions.minecraft.get() | ||
} | ||
|
||
dependencies { | ||
minecraft libs.minecraft | ||
mappings loom.officialMojangMappings() | ||
subprojects { | ||
if (project.name == "platforms") { | ||
return | ||
} | ||
|
||
modImplementation libs.fabric.api | ||
modImplementation libs.fabric.loader | ||
apply plugin: "dev.architectury.loom" | ||
|
||
modApi libs.modmenu | ||
modApi libs.cloth.config | ||
} | ||
loom { | ||
silentMojangMappingsLicense() | ||
} | ||
|
||
loom { | ||
accessWidenerPath = file("src/main/resources/dynamic_fps.accesswidener") | ||
dependencies { | ||
minecraft libs.minecraft | ||
mappings loom.officialMojangMappings() | ||
} | ||
} | ||
|
||
processResources { | ||
inputs.property "version", generateVersion() | ||
|
||
filesMatching("fabric.mod.json") { | ||
expand "version": generateVersion() | ||
allprojects { | ||
if (project.name == "platforms") { | ||
return | ||
} | ||
} | ||
|
||
java { | ||
withSourcesJar() | ||
apply plugin: "java" | ||
apply plugin: "architectury-plugin" | ||
apply plugin: "maven-publish" | ||
|
||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(17) | ||
base { | ||
archivesName = rootProject.archives_base_name | ||
} | ||
} | ||
|
||
tasks.withType(JavaCompile).configureEach { | ||
it.options.encoding = "UTF-8" | ||
group = rootProject.maven_group | ||
|
||
javaCompiler = javaToolchains.compilerFor { | ||
languageVersion = JavaLanguageVersion.of(17) | ||
if (!project.hasProperty("loom.platform")) { | ||
version = rootProject.mod_version | ||
} else { | ||
var platform = project.property("loom.platform") | ||
version = "${rootProject.mod_version}+minecraft-${libs.versions.minecraft.get()}-${platform}" | ||
} | ||
|
||
it.options.compilerArgs += ["-Xlint:deprecation", "-Xlint:unchecked"] | ||
} | ||
|
||
tasks.withType(org.gradle.jvm.tasks.Jar).configureEach { | ||
it.from(".") { | ||
include("LICENSE") | ||
repositories { | ||
// Add repositories to retrieve artifacts from in here. | ||
// You should only use this when depending on other mods because | ||
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically. | ||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html | ||
// for more information about repositories. | ||
} | ||
} | ||
|
||
// configure the maven publication | ||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
java { | ||
withSourcesJar() | ||
|
||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(17) | ||
} | ||
} | ||
|
||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. | ||
repositories { | ||
// Add repositories to publish to here. | ||
// Notice: This block does NOT have the same function as the block in the top level. | ||
// The repositories here will be used for publishing your artifact, not for | ||
// retrieving dependencies. | ||
} | ||
} | ||
tasks.withType(JavaCompile).configureEach { | ||
it.options.encoding = "UTF-8" | ||
|
||
def generateVersion() { | ||
var version = project.mod_version; | ||
// NOTE: To create a release jar run `./gradlew build -Prelease=true` | ||
return project.hasProperty("release") ? version : version + "-alpha"; | ||
javaCompiler = javaToolchains.compilerFor { | ||
languageVersion = JavaLanguageVersion.of(17) | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,8 +1,10 @@ | ||
# Gradle | ||
# Gradle Properties | ||
org.gradle.parallel = true | ||
org.gradle.jvmargs = -Xmx1G | ||
org.gradle.jvmargs = -Xmx3G | ||
|
||
# Mod Properties | ||
mod_version = 3.3.3 | ||
maven_group = juliand665 | ||
archives_base_name = dynamic-fps | ||
|
||
enabled_platforms=fabric,forge,neoforge,quilt |
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 |
---|---|---|
@@ -1,22 +1,52 @@ | ||
[versions] | ||
minecraft = "1.20" | ||
fabric_loader = "0.15.3" | ||
minecraft = "1.20.4" | ||
|
||
modmenu = "7.0.1" | ||
fabric_api = "0.83.0+1.20" | ||
# Platform libraries | ||
|
||
cloth_config = "11.0.99" | ||
fabric_loader = "0.15.6" | ||
fabric_api = "0.96.1+1.20.4" | ||
|
||
forge = "1.20.4-49.0.30" | ||
|
||
neoforge = "20.4.160-beta" | ||
|
||
quilt_loader = "0.23.1" | ||
quilt_standard_libraries = "7.0.0-alpha.10+1.20.2" | ||
|
||
# Third-party libraries | ||
|
||
modmenu = "9.0.0" | ||
cloth_config = "13.0.121" | ||
|
||
mixinextras = "0.3.5" | ||
|
||
[libraries] | ||
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" } | ||
|
||
# Platform libraries | ||
|
||
fabric_loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric_loader" } | ||
# fabric_api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric_api" } | ||
|
||
forge = { module = "net.minecraftforge:forge", version.ref = "forge" } | ||
|
||
neoforge = { module = "net.neoforged:neoforge", version.ref = "neoforge" } | ||
|
||
quilt_loader = { module = "org.quiltmc:quilt-loader", version.ref = "quilt_loader" } | ||
qsl_lifecycle_events = { module = "org.quiltmc.qsl.core:lifecycle_events", version.ref = "quilt_standard_libraries" } | ||
|
||
# Third-party libraries | ||
|
||
modmenu = { module = "com.terraformersmc:modmenu", version.ref = "modmenu" } | ||
fabric_api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric_api" } | ||
cloth_config = { module = "me.shedaniel.cloth:cloth-config", version.ref = "cloth_config" } | ||
|
||
cloth_config = { module = "me.shedaniel.cloth:cloth-config-fabric", version.ref = "cloth_config" } | ||
mixinextras_common = { module = "io.github.llamalad7:mixinextras-common", version.ref = "mixinextras" } | ||
mixinextras_forge = { module = "io.github.llamalad7:mixinextras-forge", version.ref = "mixinextras" } | ||
|
||
[bundles] | ||
|
||
[plugins] | ||
fabric_loom = { id = "fabric-loom", version = "1.5.7" } | ||
shadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" } | ||
|
||
architectury = { id = "architectury-plugin", version = "3.4.151" } | ||
architectury_loom = { id = "dev.architectury.loom", version = "1.5.388" } |
Binary file not shown.
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,28 @@ | ||
architectury { | ||
common(rootProject.enabled_platforms.split(",")) | ||
} | ||
|
||
loom { | ||
accessWidenerPath = file("src/main/resources/dynamic_fps.accesswidener") | ||
} | ||
|
||
dependencies { | ||
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies | ||
// Do NOT use other classes from fabric loader | ||
modImplementation libs.fabric.loader | ||
modImplementation libs.cloth.config | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenCommon(MavenPublication) { | ||
artifactId = rootProject.archives_base_name | ||
from components.java | ||
} | ||
} | ||
|
||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. | ||
repositories { | ||
// Add repositories to publish to here. | ||
} | ||
} |
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions
22
platforms/common/src/main/java/dynamic_fps/impl/mixin/GuiMixin.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,22 @@ | ||
package dynamic_fps.impl.mixin; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import dynamic_fps.impl.DynamicFPSMod; | ||
import net.minecraft.client.gui.Gui; | ||
|
||
@Mixin(Gui.class) | ||
public class GuiMixin { | ||
/** | ||
* Cancels rendering the GUI if it is determined to currently not be visible. | ||
*/ | ||
@Inject(method = "render", at = @At("HEAD"), cancellable = true) | ||
private void shouldRender(CallbackInfo callbackInfo) { | ||
if (!DynamicFPSMod.shouldShowLevels()) { | ||
callbackInfo.cancel(); | ||
} | ||
} | ||
} |
Oops, something went wrong.