Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
port to architectury
Browse files Browse the repository at this point in the history
  • Loading branch information
TexBlock committed Feb 2, 2024
1 parent 0812d7d commit 5dc5536
Show file tree
Hide file tree
Showing 88 changed files with 2,231 additions and 1,872 deletions.
54 changes: 36 additions & 18 deletions .github/workflows/build.yml
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
41 changes: 13 additions & 28 deletions .gitignore
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
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
<img src="./src/main/resources/assets/ok_zoomer/icon.png" align="right" width="128px" alt="Ok Zoomer icon"/>
<img src="./src/main/resources/assets/mio_zoomer/icon.png" align="right" width="128px" alt="Mio Zoomer icon"/>

# Ok Zoomer
# Mio Zoomer

Ok Zoomer is a mod that adds a highly configurable zoom packed with tons of features!
OK Zoomer unofficial architectury port.

By default, an unique take on zooming is provided, however, by configuring this mod through Mod Menu or a file, the zoom can be adapted for your own purposes! Here's an example: want a cinematic camera while zooming? Enable it! Want to have a better control over it? Toggle it to the Multiplied mode and adjust the multiplier! Do you hate it but still want some grip on the zoom? Enable "Reduce Sensitivity"! On this mod, you are in charge of the zoom!
Mio Zoomer is a mod that adds a configurable feature-packed zoom key, which allows for zooming. By default, the zoom key is bound to `C` with the zoom itself being different, with features like zoom scrolling, smooth transitions and reduced mouse sensitivity.

For more information, see the [Modrinth page](https://modrinth.com/mod/ok-zoomer) or the [CurseForge one](https://www.curseforge.com/minecraft/mc-mods/ok-zoomer)
However, this isn't the end of the story, because here, you are in charge of your own zoom! Through the config screen, which is accessible through either the `/mio_zoomer` client command or the Mod Menu, the zoom is completely configurable, and if the default behavior isn't exactly what you want, you can change the smallest details or even restore the OptiFine zoom with a press of a button!

For more information, see the [Modrinth page](https://modrinth.com/mod/mio-zoomer) (SOON) or the [CurseForge page](https://www.curseforge.com/minecraft/mc-mods/mio-zoomer) (SOON)

## Dependencies

This mod requires the [Architectury API](https://modrinth.com/mod/architectury-api), [ZoomerLibrary](https://modrinth.com/mod/zoomerlibrary), [AzusaConfig]().

[Mod Menu (Fabric side)](https://modrinth.com/mod/modmenu) is optional but it might be a more convenient way to access the config screen.

## Download

This mod is available for download on the following services:

- [Modrinth (recommended)](https://modrinth.com/mod/ok-zoomer)
- [CurseForge](https://www.curseforge.com/minecraft/mc-mods/ok-zoomer)
- [GitHub Releases (alternative)](https://github.com/EnnuiL/OkZoomer/releases)
- [Modrinth (recommended)](https://modrinth.com/mod/mio-zoomer) (SOON)
- [CurseForge](https://www.curseforge.com/minecraft/mc-mods/mio-zoomer) (SOON)
- [GitHub Releases (alternative)](https://github.com/ThinkingStudios/MioZoomer/releases)

## License

Expand Down
117 changes: 30 additions & 87 deletions build.gradle
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()
}
}
29 changes: 29 additions & 0 deletions common/build.gradle
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.
}
}
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);
}
}
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();
}
}
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());
}
}
Loading

0 comments on commit 5dc5536

Please sign in to comment.