-
Notifications
You must be signed in to change notification settings - Fork 194
Modular refactor of codebase #749
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
Draft
Prospector
wants to merge
3
commits into
1.21
Choose a base branch
from
modular-refactor
base: 1.21
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
File renamed without changes.
This file contains hidden or 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
35 changes: 35 additions & 0 deletions
35
api/src/main/java/com/terraformersmc/modmenu/api/ModMenuApiImpl.java
This file contains hidden or 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,35 @@ | ||
| package com.terraformersmc.modmenu.api; | ||
|
|
||
| import net.fabricmc.loader.api.FabricLoader; | ||
|
|
||
| class ModMenuApiImpl { | ||
| static ModMenuGuiProvider guiProvider = null; | ||
| static ModMenuUpdateHandlerPreferenceProvider updateHandlerPreferenceProvider = null; | ||
|
|
||
| static ModMenuGuiProvider getGuiProvider() { | ||
| if (guiProvider == null) { | ||
| var entrypoints = FabricLoader.getInstance().getEntrypoints("modmenu-gui", ModMenuGuiProvider.class); | ||
| if (!entrypoints.isEmpty()) { | ||
| guiProvider = entrypoints.getFirst(); | ||
| } | ||
| } | ||
| if (guiProvider == null) { | ||
| throw new RuntimeException("Mod Menu's GUI is not installed, download here: https://modrinth.com/mod/modmenu"); | ||
| } | ||
| return guiProvider; | ||
| } | ||
|
|
||
| static ModMenuUpdateHandlerPreferenceProvider getUpdateHandlerPreferenceProvider() { | ||
| if (updateHandlerPreferenceProvider == null) { | ||
| var entrypoints = FabricLoader.getInstance() | ||
| .getEntrypoints("modmenu-update-preferences", ModMenuUpdateHandlerPreferenceProvider.class); | ||
| if (!entrypoints.isEmpty()) { | ||
| updateHandlerPreferenceProvider = entrypoints.getFirst(); | ||
| } | ||
| } | ||
| if (updateHandlerPreferenceProvider == null) { | ||
| throw new RuntimeException("Mod Menu's GUI is not installed, download here: https://modrinth.com/mod/modmenu"); | ||
| } | ||
| return updateHandlerPreferenceProvider; | ||
| } | ||
| } |
29 changes: 29 additions & 0 deletions
29
api/src/main/java/com/terraformersmc/modmenu/api/ModMenuGuiProvider.java
This file contains hidden or 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,29 @@ | ||
| package com.terraformersmc.modmenu.api; | ||
|
|
||
| import net.minecraft.client.gui.screen.Screen; | ||
| import net.minecraft.text.Text; | ||
|
|
||
| /** | ||
| * This is used to provide your own Mods screens much like Mod Menu's GUI module does. | ||
| * Most mods should not use this API. | ||
| * To use it, implement this as a "modmenu-gui" entrypoint to your mod. | ||
| */ | ||
| public interface ModMenuGuiProvider { | ||
|
|
||
| /** | ||
| * Used for creating a {@link Screen} instance of the Mod Menu | ||
| * "Mods" screen | ||
| * | ||
| * @param previous The screen before opening | ||
| * @return A "Mods" Screen | ||
| */ | ||
| Screen createModsScreen(Screen previous); | ||
|
|
||
| /** | ||
| * Used for creating a {@link Text} just like what would appear | ||
| * on a Mod Menu Mods button | ||
| * | ||
| * @return The text that would be displayed on a Mods button | ||
| */ | ||
| Text createModsButtonText(); | ||
| } |
14 changes: 14 additions & 0 deletions
14
api/src/main/java/com/terraformersmc/modmenu/api/ModMenuUpdateHandlerPreferenceProvider.java
This file contains hidden or 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,14 @@ | ||
| package com.terraformersmc.modmenu.api; | ||
|
|
||
| /** | ||
| * This is used to provide a user's preferences for the updates API in Mod Menu. | ||
| * To use it, implement this as a "modmenu-update-preferences" entrypoint to your mod. | ||
| */ | ||
| public interface ModMenuUpdateHandlerPreferenceProvider { | ||
| /** | ||
| * Used for your GUI provider to indicate a user's update channel preferences to users of Mod Menu API | ||
| * | ||
| * @return The update channel the user prefers | ||
| */ | ||
| UpdateChannel getUpdateChannelPreference(); | ||
| } |
This file contains hidden or 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
This file contains hidden or 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,14 @@ | ||
| { | ||
| "schemaVersion": 1, | ||
| "id": "modmenu-api", | ||
| "name": "Mod Menu API", | ||
| "version": "$version", | ||
| "environment": "client", | ||
| "license": "MIT", | ||
| "icon": "assets/modmenu/icon.png", | ||
| "depends": { | ||
| "fabricloader": ">=0.15.10", | ||
| "minecraft": ">=1.21" | ||
| }, | ||
| "description": "The API used for defining config screens or update checkers." | ||
| } | ||
This file contains hidden or 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,37 +1,75 @@ | ||
| plugins { | ||
| id 'fabric-loom' version '1.6-SNAPSHOT' | ||
| id 'java' | ||
| id 'idea' | ||
| id 'eclipse' | ||
| id 'maven-publish' | ||
| id 'fabric-loom' version '1.6.+' | ||
| } | ||
|
|
||
| apply from: 'https://raw.githubusercontent.com/TerraformersMC/GradleScripts/2.7/ferry.gradle' | ||
| allprojects { | ||
| apply plugin: 'java' | ||
| apply plugin: 'idea' | ||
| apply plugin: 'eclipse' | ||
| apply plugin: 'maven-publish' | ||
| apply plugin: 'fabric-loom' | ||
|
|
||
| dependencies { | ||
| minecraft "com.mojang:minecraft:$project.minecraft_version" | ||
| mappings "net.fabricmc:yarn:$project.yarn_mappings:v2" | ||
| sourceCompatibility = JavaVersion.VERSION_21 | ||
| targetCompatibility = JavaVersion.VERSION_21 | ||
|
|
||
| mod "fabric-loader", "net.fabricmc:fabric-loader:$project.loader_version" | ||
| repositories { | ||
| maven { | ||
| name = 'Nucleoid' | ||
| url = 'https://maven.nucleoid.xyz/' | ||
| } | ||
| } | ||
|
|
||
| includeMod "fabric-api", fabricApi.module("fabric-api-base", project.fabric_version) | ||
| includeMod "fabric-api", fabricApi.module("fabric-resource-loader-v0", project.fabric_version) | ||
| includeMod "fabric-api", fabricApi.module("fabric-screen-api-v1", project.fabric_version) | ||
| includeMod "fabric-api", fabricApi.module("fabric-key-binding-api-v1", project.fabric_version) | ||
| includeMod "fabric-api", fabricApi.module("fabric-lifecycle-events-v1", project.fabric_version) | ||
| ext { | ||
| mod = { String localOverrideKey, Object dep -> | ||
| File file = file("../.${localOverrideKey}-local"); | ||
| if (file.exists()) { | ||
| dependencies.implementation(dep) | ||
| } else { | ||
| dependencies.modImplementation(dep) | ||
| } | ||
| } | ||
|
|
||
| includeMod "text-placeholder-api", "eu.pb4:placeholder-api:${project.text_placeholder_api_version}" | ||
| includeMod = { String localOverrideKey, Object dep -> | ||
| mod(localOverrideKey, dep) | ||
| dependencies.include(dep) | ||
| } | ||
| } | ||
|
|
||
| compileOnly "org.quiltmc:quilt-loader:$project.quilt_loader_version" | ||
| } | ||
| dependencies { | ||
| minecraft "com.mojang:minecraft:$project.minecraft_version" | ||
| mappings "net.fabricmc:yarn:$project.yarn_mappings:v2" | ||
|
|
||
| mod "fabric-loader", "net.fabricmc:fabric-loader:$project.loader_version" | ||
| } | ||
|
|
||
| tasks.withType(JavaCompile).configureEach { | ||
| it.options.release = 21 | ||
| it.options.encoding = "UTF-8" | ||
| } | ||
|
|
||
| java { | ||
| withSourcesJar() | ||
|
|
||
| repositories { | ||
| maven { | ||
| name = 'TerraformersMC' | ||
| url = 'https://maven.terraformersmc.com/' | ||
| sourceCompatibility = JavaVersion.VERSION_21 | ||
| targetCompatibility = JavaVersion.VERSION_21 | ||
| } | ||
| maven { | ||
| name = 'Quilt' | ||
| url = 'https://maven.quiltmc.org/repository/release' | ||
|
|
||
| jar { | ||
| from "LICENSE" | ||
| } | ||
| maven { | ||
| name = 'Nucleoid' | ||
| url = 'https://maven.nucleoid.xyz/' | ||
| } | ||
|
|
||
| dependencies { | ||
| modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" | ||
| modImplementation "eu.pb4:placeholder-api:${project.text_placeholder_api_version}" | ||
|
|
||
| afterEvaluate { | ||
| subprojects.each { | ||
| implementation project(path: ":${it.path}", configuration: "namedElements") | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.