Skip to content

Commit

Permalink
feat: 1.20.5-rc3 Quilt port (based on FAPI for now)
Browse files Browse the repository at this point in the history
  • Loading branch information
VidTu committed Apr 22, 2024
1 parent ecf6643 commit 62d327c
Show file tree
Hide file tree
Showing 10 changed files with 263 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ jobs:
1.20.4-forge/build/libs/
1.20.4-neoforge/build/libs/
1.20.5-fabric/build/libs/
1.20.5-quilt/build/libs/
2 changes: 1 addition & 1 deletion 1.20.4-neoforge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dependencies {
minecraft("com.mojang:minecraft:1.20.4")
mappings(loom.officialMojangMappings())

// Forge
// NeoForge
neoForge("net.neoforged:neoforge:20.4.232")

// Root
Expand Down
2 changes: 1 addition & 1 deletion 1.20.4-quilt/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies {
minecraft("com.mojang:minecraft:1.20.4")
mappings(loom.officialMojangMappings())

// Fabric
// Quilt
modImplementation(libs.quilt.loader)
modImplementation("org.quiltmc.quilted-fabric-api:quilted-fabric-api:9.0.0-alpha.8+0.97.0-1.20.4")
modImplementation("com.terraformersmc:modmenu:9.0.0")
Expand Down
2 changes: 1 addition & 1 deletion 1.20.4-quilt/src/main/resources/quilt.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
{
"id": "java",
"versions": ">=17",
"reason": "In-Game Account Switcher makes use of modern (17+) Java in its code."
"reason": "In-Game Account Switcher makes use of modern Java in its code."
}
],
"entrypoints": {
Expand Down
75 changes: 75 additions & 0 deletions 1.20.5-quilt/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
plugins {
id("dev.architectury.loom") version "1.6-SNAPSHOT"
}

java.sourceCompatibility = JavaVersion.VERSION_21
java.targetCompatibility = JavaVersion.VERSION_21
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
group = "ru.vidtu.ias"
base.archivesName = "IAS-Quilt-1.20.5"
evaluationDependsOn(":1.20.5")
val shared = project(":1.20.5")

repositories {
mavenCentral()
maven("https://maven.quiltmc.org/repository/release/")
maven("https://maven.fabricmc.net/")
maven("https://maven.terraformersmc.com/releases/")
}

loom {
silentMojangMappingsLicense()
runs.named("client") {
vmArgs("-XX:+IgnoreUnrecognizedVMOptions", "-Xmx2G", "-XX:+AllowEnhancedClassRedefinition", "-XX:HotswapAgent=fatjar", "-Dfabric.debug.disableClassPathIsolation=true")
}
@Suppress("UnstableApiUsage")
mixin {
defaultRefmapName = "ias.mixins.refmap.json"
}
}

dependencies {
// Minecraft
minecraft("com.mojang:minecraft:1.20.5-rc3")
mappings(loom.officialMojangMappings())

// Quilt
modImplementation(libs.quilt.loader)
modImplementation("net.fabricmc.fabric-api:fabric-api:0.97.5+1.20.5")
modImplementation("com.terraformersmc:modmenu:10.0.0-alpha.3")

// Root
compileOnly(shared)
}

tasks.withType<JavaCompile> {
source(rootProject.sourceSets.main.get().java)
source(shared.sourceSets.main.get().java)
options.encoding = "UTF-8"
options.release.set(21)
}

tasks.withType<ProcessResources> {
from(rootProject.sourceSets.main.get().resources)
from(shared.sourceSets.main.get().resources)
inputs.property("version", project.version)
filesMatching("quilt.mod.json") {
expand("version" to project.version)
}
}

tasks.withType<Jar> {
from(rootDir.resolve("LICENSE"))
from(rootDir.resolve("GPL"))
manifest {
attributes(
"Specification-Title" to "In-Game Account Switcher",
"Specification-Version" to project.version,
"Specification-Vendor" to "VidTu",
"Implementation-Title" to "IAS-Quilt-1.20.5",
"Implementation-Version" to project.version,
"Implementation-Vendor" to "VidTu",
"MixinConfigs" to "ias.mixins.json"
)
}
}
36 changes: 36 additions & 0 deletions 1.20.5-quilt/src/main/java/ru/vidtu/ias/IASModMenu.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* In-Game Account Switcher is a mod for Minecraft that allows you to change your logged in account in-game, without restarting Minecraft.
* Copyright (C) 2015-2022 The_Fireplace
* Copyright (C) 2021-2024 VidTu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>
*/

package ru.vidtu.ias;

import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import ru.vidtu.ias.screen.ConfigScreen;

/**
* Main IAS hook for ModMenu.
*
* @author VidTu
*/
public final class IASModMenu implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return ConfigScreen::new;
}
}
71 changes: 71 additions & 0 deletions 1.20.5-quilt/src/main/java/ru/vidtu/ias/IASQuilt.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* In-Game Account Switcher is a mod for Minecraft that allows you to change your logged in account in-game, without restarting Minecraft.
* Copyright (C) 2015-2022 The_Fireplace
* Copyright (C) 2021-2024 VidTu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>
*/

package ru.vidtu.ias;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents;
import net.fabricmc.fabric.api.client.screen.v1.Screens;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.screens.TitleScreen;
import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen;
import org.quiltmc.loader.api.ModContainer;
import org.quiltmc.loader.api.ModMetadata;
import org.quiltmc.loader.api.QuiltLoader;
import org.quiltmc.loader.api.Version;

/**
* Main IAS class for Quilt.
*
* @author VidTu
*/
public final class IASQuilt implements ClientModInitializer {
@Override
public void onInitializeClient() {
// Create the UA and initialize.
String modVersion = QuiltLoader.getModContainer("ias")
.map(ModContainer::metadata)
.map(ModMetadata::version)
.map(Version::raw)
.orElse("UNKNOWN");
String loaderVersion = QuiltLoader.getModContainer("quilt_loader")
.map(ModContainer::metadata)
.map(ModMetadata::version)
.map(Version::raw)
.orElse("UNKNOWN");
IASMinecraft.init(QuiltLoader.getGameDir(), QuiltLoader.getConfigDir(), "Quilt", modVersion, loaderVersion);

// Register closer.
ClientLifecycleEvents.CLIENT_STOPPING.register(client -> IAS.close());

// Register screen handlers.
ScreenEvents.AFTER_INIT.register((client, screen, width, height) -> {
// Init.
IASMinecraft.onInit(client, screen, Screens.getButtons(screen)::add);

// Register drawer.
if (screen instanceof TitleScreen || screen instanceof JoinMultiplayerScreen) {
// Draw.
Font font = client.font;
ScreenEvents.afterRender(screen).register((scr, graphics, mouseX, mouseY, delta) -> IASMinecraft.onDraw(scr, font, graphics));
}
});
}
}
75 changes: 75 additions & 0 deletions 1.20.5-quilt/src/main/resources/quilt.mod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"schema_version": 1,
"quilt_loader": {
"group": "ru.vidtu.ias",
"id": "ias",
"version": "${version}",
"metadata": {
"name": "In-Game Account Switcher",
"description": "Allows you to change which account you are signed in to in-game without restarting Minecraft.",
"license": "LGPL-3.0-or-later",
"contributors": {
"VidTu": "Current Maintainer",
"The_Fireplace": "Original Mod Author",
"The_BrainStone": "Contributor",
"2xsaiko": "Contributor",
"Elvm": "Contributor"
},
"contact": {
"homepage": "https://modrinth.com/mod/in-game-account-switcher",
"sources": "https://github.com/The-Fireplace-Minecraft-Mods/In-Game-Account-Switcher",
"issues": "https://github.com/The-Fireplace-Minecraft-Mods/In-Game-Account-Switcher/issues",
"discord": "https://discord.gg/TpU2nEkSPk"
},
"icon": "ias.png"
},
"intermediate_mappings": "net.fabricmc:intermediary",
"depends": [
{
"id": "quilt_loader",
"versions": ">=0.24.0",
"reason": "In-Game Account Switcher requires Quilt mod loader to be loaded."
},
{
"id": "minecraft",
"versions": "1.20.5-rc.3",
"reason": "In-Game Account Switcher works only with Minecraft 1.20.5-rc3."
},
{
"id": "fabric-api",
"versions": ">=0.97.0",
"reason": "In-Game Account Switcher requires Quilted Fabric API (QFAPI) and Quilt Standard Libraries (QSL) to add its button into the GUI."
},
{
"id": "modmenu",
"versions": ">=10.0.0",
"reason": "In-Game Account Switcher recommends ModMenu for configuration access.",
"optional": true
},
{
"id": "java",
"versions": ">=21",
"reason": "In-Game Account Switcher makes use of modern Java in its code."
}
],
"entrypoints": {
"client": "ru.vidtu.ias.IASQuilt",
"modmenu": "ru.vidtu.ias.IASModMenu"
}
},
"minecraft": {
"environment": "client"
},
"mixin": "ias.mixins.json",
"modmenu": {
"links": {
"modmenu.modrinth": "https://modrinth.com/mod/in-game-account-switcher",
"modmenu.curseforge": "https://curseforge.com/minecraft/mc-mods/in-game-account-switcher",
"modmenu.github_releases": "https://github.com/The-Fireplace-Minecraft-Mods/In-Game-Account-Switcher/releases",
"modmenu.discord": "https://discord.gg/TpU2nEkSPk",
"ias.help.crypt": "https://github.com/The-Fireplace-Minecraft-Mods/In-Game-Account-Switcher/blob/main/docs/CRYPT.md",
"ias.help.errors": "https://github.com/The-Fireplace-Minecraft-Mods/In-Game-Account-Switcher/blob/main/docs/ERRORS.md",
"ias.help.stolen": "https://github.com/The-Fireplace-Minecraft-Mods/In-Game-Account-Switcher/blob/main/docs/STOLEN.md"
}
}
}
2 changes: 1 addition & 1 deletion 1.20.5/src/main/resources/ias.mixins.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"required": true,
"minVersion": "0.8",
"compatibilityLevel": "JAVA_21",
"compatibilityLevel": "JAVA_17",
"package": "ru.vidtu.ias.mixins",
"refmap": "ias.mixins.refmap.json",
"client": [
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ plugins {

rootProject.name = "In-Game Account Switcher"
include("1.20.4", "1.20.4-fabric", "1.20.4-quilt", "1.20.4-forge", "1.20.4-neoforge")
include("1.20.5", "1.20.5-fabric")
include("1.20.5", "1.20.5-fabric", "1.20.5-quilt")

0 comments on commit 62d327c

Please sign in to comment.