This repository has been archived by the owner on Jun 12, 2024. It is now read-only.
forked from Up-Mods/OkZoomer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
88 changed files
with
2,231 additions
and
1,872 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,40 @@ | ||
name: Build Mod | ||
on: push | ||
name: Build | ||
|
||
on: [ pull_request, push, workflow_dispatch ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
Build: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up Eclipse Temurin 20 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: temurin | ||
java-version: 20 | ||
- name: Build with Gradle | ||
run: gradle build | ||
- name: Upload build artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build-artifacts | ||
path: build/libs | ||
- uses: actions/checkout@v3 | ||
- name: Get github short hash | ||
id: github_short_hash | ||
run: echo "result=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 17 | ||
- name: Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
.gradle | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'build.gradle') }} | ||
- name: Build with Gradle | ||
run: | | ||
chmod +x gradlew | ||
./gradlew build | ||
- name: Upload artifacts (fabric) | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Artifacts-fabric | ||
path: ${{ github.workspace }}/fabric/build/libs | ||
- name: Upload artifacts (forge) | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Artifacts-forge | ||
path: ${{ github.workspace }}/forge/build/libs |
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,34 +1,19 @@ | ||
# Gradle | ||
.gradle/ | ||
build/ | ||
out/ | ||
classes/ | ||
|
||
# Quilt Loom | ||
remappedSrc/ | ||
run/ | ||
|
||
# Eclipse | ||
*.launch | ||
|
||
# IntelliJ Idea | ||
.idea/ | ||
*.iml | ||
*.ipr | ||
run/ | ||
*.iws | ||
|
||
# Fleet | ||
.fleet/ | ||
|
||
# Visual Studio Code | ||
.settings/ | ||
.vscode/ | ||
out/ | ||
*.iml | ||
.gradle/ | ||
output/ | ||
bin/ | ||
libs/ | ||
|
||
.classpath | ||
.project | ||
|
||
# Eclipse JDT LS | ||
workspace/ | ||
|
||
# macOS | ||
*.DS_Store | ||
.idea/ | ||
classes/ | ||
.metadata | ||
.vscode | ||
.settings | ||
*.launch |
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,100 +1,43 @@ | ||
plugins { | ||
id 'maven-publish' | ||
alias libs.plugins.quilt.loom | ||
alias libs.plugins.machete | ||
id "architectury-plugin" version "3.4-SNAPSHOT" | ||
id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false | ||
} | ||
|
||
archivesBaseName = project.archives_base_name | ||
version = System.env.GITHUB_ACTIONS == 'true' | ||
? "$project.version+${libs.versions.minecraft.get()}.github.$System.env.GITHUB_RUN_NUMBER" | ||
: "$project.version+${libs.versions.minecraft.get()}" | ||
group = project.maven_group | ||
|
||
repositories { | ||
mavenCentral() | ||
maven { url 'https://maven.gegy.dev' } | ||
maven { url 'https://maven.terraformersmc.com/releases/' } | ||
maven { url 'https://jitpack.io' } | ||
architectury { | ||
minecraft = rootProject.minecraft_version | ||
} | ||
|
||
// All the dependencies are declared at gradle/libs.version.toml and referenced with "libs.<id>" | ||
// See https://docs.gradle.org/current/userguide/platforms.html for information on how version catalogs work. | ||
dependencies { | ||
// To change the versions, see the gradle.properties file | ||
minecraft libs.minecraft | ||
mappings variantOf(libs.quilt.mappings) { classifier 'intermediary-v2' } | ||
modImplementation libs.quilt.loader | ||
|
||
modImplementation libs.quilted.fabric.api | ||
modImplementation(libs.mod.menu) { | ||
transitive = false | ||
} | ||
modImplementation libs.libzoomer | ||
modImplementation(libs.spruceui) { | ||
transitive = false | ||
} | ||
implementation libs.mixin.extras | ||
annotationProcessor libs.mixin.extras | ||
|
||
include libs.libzoomer | ||
include libs.spruceui | ||
include libs.mixin.extras | ||
} | ||
|
||
processResources { | ||
inputs.property 'version', version | ||
|
||
// Oh, for building, do the switcharoo | ||
filesMatching(['quilt.mod.json', 'fabric.mod.json']) { | ||
expand 'version': version | ||
} | ||
} | ||
subprojects { | ||
apply plugin: "dev.architectury.loom" | ||
|
||
tasks.withType(JavaCompile).configureEach { | ||
it.options.encoding = 'UTF-8' | ||
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17. | ||
it.options.release = 17 | ||
dependencies { | ||
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" | ||
//mappings "net.fabricmc:yarn:1.20.1+build.10:v2" | ||
mappings "org.quiltmc:quilt-mappings:${rootProject.quilt_mappings}:intermediary-v2" | ||
} | ||
} | ||
|
||
java { | ||
// Still required by IDEs such as Eclipse and Visual Studio Code | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
allprojects { | ||
apply plugin: "java" | ||
apply plugin: "architectury-plugin" | ||
apply plugin: "maven-publish" | ||
|
||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task if it is present. | ||
// If you remove this line, sources will not be generated. | ||
withSourcesJar() | ||
archivesBaseName = rootProject.archives_base_name | ||
version = rootProject.mod_version | ||
group = rootProject.maven_group | ||
|
||
// If this mod is going to be a library, then it should also generate Javadocs in order to aid with developement. | ||
// Uncomment this line to generate them. | ||
// withJavadocJar() | ||
} | ||
|
||
jar { | ||
from('LICENSE') { | ||
rename { "${it}_${archivesBaseName}" } | ||
} | ||
} | ||
|
||
|
||
machete { | ||
// JSON minification isn't effective on this scale and sacrifices readability | ||
json.enabled = false | ||
} | ||
repositories { | ||
maven { url = "https://jitpack.io" } | ||
maven { url = "https://api.modrinth.com/maven" } | ||
maven { url = "https://maven.quiltmc.org/repository/release" } | ||
} | ||
|
||
// Configure the maven publication | ||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
} | ||
} | ||
tasks.withType(JavaCompile) { | ||
options.encoding = "UTF-8" | ||
options.release = 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. | ||
} | ||
java { | ||
withSourcesJar() | ||
} | ||
} |
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,29 @@ | ||
architectury { | ||
common(rootProject.enabled_platforms.split(",")) | ||
} | ||
|
||
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 "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" | ||
modApi "dev.architectury:architectury:${rootProject.architectury_version}" | ||
modImplementation("com.github.HO-Artisan.AzusaConfig:AzusaConfig-fabric:1.20.1~dev-SNAPSHOT") | ||
modImplementation("maven.modrinth:obsidianui:${rootProject.obsidianui_version}-fabric") | ||
modImplementation("maven.modrinth:zoomerlibrary:${rootProject.zoomerlibrary_version}-fabric") | ||
|
||
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:0.3.5")) | ||
} | ||
|
||
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. | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
common/src/main/java/org/thinkingstudio/mio_zoomer/MioZoomerClientMod.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,34 @@ | ||
package org.thinkingstudio.mio_zoomer; | ||
|
||
import dev.architectury.event.EventResult; | ||
import dev.architectury.event.events.client.ClientRawInputEvent; | ||
import dev.architectury.platform.Platform; | ||
import dev.architectury.registry.client.keymappings.KeyMappingRegistry; | ||
import org.lwjgl.glfw.GLFW; | ||
import org.thinkingstudio.mio_zoomer.config.ConfigEnums; | ||
import org.thinkingstudio.mio_zoomer.config.MioZoomerConfigManager; | ||
import org.thinkingstudio.mio_zoomer.config.screen.MioZoomerConfigScreen; | ||
import org.thinkingstudio.mio_zoomer.key_binds.ZoomKeyBinds; | ||
import org.thinkingstudio.mio_zoomer.packets.ZoomPackets; | ||
import org.thinkingstudio.mio_zoomer.utils.ZoomUtils; | ||
|
||
|
||
// This class is responsible for registering the commands and packets | ||
public class MioZoomerClientMod { | ||
public static final String MODID = "mio_zoomer"; | ||
|
||
public static void onInitClient() { | ||
// Initialize the config | ||
new MioZoomerConfigManager(); | ||
|
||
// Register all the key binds | ||
KeyMappingRegistry.register(ZoomKeyBinds.ZOOM_KEY); | ||
if (ZoomKeyBinds.areExtraKeyBindsEnabled()) { | ||
KeyMappingRegistry.register(ZoomKeyBinds.DECREASE_ZOOM_KEY); | ||
KeyMappingRegistry.register(ZoomKeyBinds.INCREASE_ZOOM_KEY); | ||
KeyMappingRegistry.register(ZoomKeyBinds.RESET_ZOOM_KEY); | ||
} | ||
|
||
Platform.getMod(MODID).registerConfigurationScreen(MioZoomerConfigScreen::new); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
common/src/main/java/org/thinkingstudio/mio_zoomer/MioZoomerExpectPlatform.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,27 @@ | ||
package org.thinkingstudio.mio_zoomer; | ||
|
||
import dev.architectury.injectables.annotations.ExpectPlatform; | ||
import dev.architectury.platform.Platform; | ||
|
||
import java.nio.file.Path; | ||
|
||
public class MioZoomerExpectPlatform { | ||
/** | ||
* We can use {@link Platform#getConfigFolder()} but this is just an example of {@link ExpectPlatform}. | ||
* <p> | ||
* This must be a <b>public static</b> method. The platform-implemented solution must be placed under a | ||
* platform sub-package, with its class suffixed with {@code Impl}. | ||
* <p> | ||
* Example: | ||
* Expect: io.github.ennuil.mio_zoomer.MioZoomerExpectPlatform#getConfigDirectory() | ||
* Actual Fabric: net.examplemod.fabric.ExampleExpectPlatformImpl#getConfigDirectory() | ||
* Actual Forge: net.examplemod.forge.ExampleExpectPlatformImpl#getConfigDirectory() | ||
* <p> | ||
* <a href="https://plugins.jetbrains.com/plugin/16210-architectury">You should also get the IntelliJ plugin to help with @ExpectPlatform.</a> | ||
*/ | ||
@ExpectPlatform | ||
public static Path getConfigDirectory() { | ||
// Just throw an error, the content should get replaced at runtime. | ||
throw new AssertionError(); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
common/src/main/java/org/thinkingstudio/mio_zoomer/MioZoomerPreLaunchMod.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,11 @@ | ||
package org.thinkingstudio.mio_zoomer; | ||
|
||
import ho.artisan.azusa_config.shadow.quiltconfig.api.annotations.ConfigFieldAnnotationProcessors; | ||
|
||
import org.thinkingstudio.mio_zoomer.config.metadata.WidgetSize; | ||
|
||
public class MioZoomerPreLaunchMod { | ||
public static void onPreLaunch() { | ||
ConfigFieldAnnotationProcessors.register(WidgetSize.class, new WidgetSize.Processor()); | ||
} | ||
} |
Oops, something went wrong.