Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
- name: ✨ Checkout repository
uses: actions/checkout@v4

- name: ☕ Set up JDK 21
- name: ☕ Set up JDK 25
uses: actions/setup-java@v4
with:
java-version: 21
java-version: 25
distribution: temurin

- name: 🐘 Set up Gradle
Expand All @@ -45,10 +45,8 @@ jobs:
with:
name: artifacts
path: |
**/build/devlibs/*-sources.jar
**/build/libs/*.jar
!**/build/libs/*-dev-shadow.jar
!**/build/libs/*-sources.jar
!**/build/libs/*-dev.jar
!build/**
!common/**

Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ jobs:
- name: ✨ Checkout repository
uses: actions/checkout@v4

- name: ☕ Set up JDK 21
- name: ☕ Set up JDK 25
uses: actions/setup-java@v4
with:
java-version: 21
java-version: 25
distribution: temurin

- name: 🐘 Set up Gradle
Expand Down Expand Up @@ -84,9 +84,9 @@ jobs:
with:
name: "[Fabric] ${{ steps.props.outputs.mod_name }} ${{ needs.release.outputs.tag_name }}"
files: |
fabric/build/libs/!(*-@(dev|dev-shadow|javadoc|sources)).jar
fabric/build/libs/!(*-@(dev|javadoc|sources)).jar
fabric/build/libs/*-javadoc.jar
fabric/build/devlibs/*-sources.jar
fabric/build/libs/*-sources.jar
version: ${{ needs.release.outputs.tag_name }}
changelog: For a list of changes, please refer to https://github.com/axieum/authme/releases/tag/${{ needs.release.outputs.tag_name }}
loaders: |
Expand All @@ -106,9 +106,9 @@ jobs:
with:
name: "[NeoForge] ${{ steps.props.outputs.mod_name }} ${{ needs.release.outputs.tag_name }}"
files: |
neoforge/build/libs/!(*-@(dev|dev-shadow|javadoc|sources)).jar
neoforge/build/libs/!(*-@(dev|javadoc|sources)).jar
neoforge/build/libs/*-javadoc.jar
neoforge/build/devlibs/*-sources.jar
neoforge/build/libs/*-sources.jar
version: ${{ needs.release.outputs.tag_name }}
changelog: For a list of changes, please refer to https://github.com/axieum/authme/releases/tag/${{ needs.release.outputs.tag_name }}
loaders: |
Expand All @@ -125,7 +125,5 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
shopt -s extglob
gh release upload ${{ needs.release.outputs.tag_name }} fabric/build/libs/!(*-@(dev|dev-shadow|sources)).jar
gh release upload ${{ needs.release.outputs.tag_name }} fabric/build/devlibs/*-sources.jar
gh release upload ${{ needs.release.outputs.tag_name }} neoforge/build/libs/!(*-@(dev|dev-shadow|sources)).jar
gh release upload ${{ needs.release.outputs.tag_name }} neoforge/build/devlibs/*-sources.jar
gh release upload ${{ needs.release.outputs.tag_name }} fabric/build/libs/!(*-@(dev)).jar
gh release upload ${{ needs.release.outputs.tag_name }} neoforge/build/libs/!(*-@(dev)).jar
18 changes: 11 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
plugins {
id 'architectury-plugin' version '3.4-SNAPSHOT'
id 'dev.architectury.loom' version '1.13-SNAPSHOT' apply false
id 'architectury-plugin' version '3.5-SNAPSHOT'
id 'com.gradleup.shadow' version '9.4.1' apply false
id 'dev.architectury.loom-no-remap' version '1.14-SNAPSHOT' apply false
}

architectury {
minecraft = project.minecraft_version
}

subprojects {
apply plugin: 'dev.architectury.loom'
apply plugin: 'com.gradleup.shadow'
apply plugin: 'dev.architectury.loom-no-remap'

loom {
silentMojangMappingsLicense()
}

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.officialMojangMappings()
}
}

Expand All @@ -28,9 +29,6 @@ allprojects {

group = rootProject.maven_group
version = rootProject.version
archivesBaseName = rootProject.archives_base_name

sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21

// Perform tests using the JUnit test suite
test {
Expand All @@ -41,6 +39,12 @@ allprojects {
java {
withJavadocJar()
withSourcesJar()

sourceCompatibility = targetCompatibility = JavaVersion.VERSION_25;
}

base {
archivesName = rootProject.archives_base_name;
}
Comment thread
axieum marked this conversation as resolved.

// Add the licence to all distributions
Expand Down
41 changes: 37 additions & 4 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ architectury {
common rootProject.enabled_platforms.split(", ")
}

loom {
accessWidenerPath = file("src/main/resources/${project.mod_id}.accesswidener")
configurations {
shadowCommon
}

dependencies {
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
implementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"

api "commons-logging:commons-logging:${project.apache_logging_version}"
api "org.apache.httpcomponents:httpcore:${project.apache_httpcore_version}"
api "org.apache.httpcomponents:httpclient:${project.apache_httpclient_version}"
modApi "com.teamresourceful.resourcefulconfig:resourcefulconfig-common-${project.resourceful_config_version}"
api "com.teamresourceful.resourcefulconfig:resourcefulconfig-common-${project.resourceful_config_version}"
}

processResources {
Expand All @@ -27,3 +27,36 @@ processResources {
// pack.mcmeta
filesMatching('pack.mcmeta') { expand(['mod_name': project.mod_name]) }
}

jar {
archiveAppendix.set project.name
archiveClassifier.set 'dev'
}

shadowJar {
dependsOn jar
mainSpec.sourcePaths.clear()
from zipTree(jar.archiveFile)
configurations = [project.configurations.shadowCommon]
archiveAppendix.set project.name
archiveClassifier.unset()
}

sourcesJar {
archiveAppendix.set project.name
}

javadocJar {
archiveAppendix.set project.name
}

configurations {
apiElements {
outgoing.artifacts.clear()
outgoing.artifact(shadowJar)
}
runtimeElements {
outgoing.artifacts.clear()
outgoing.artifact(shadowJar)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.GuiGraphicsExtractor;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.ImageButton;
import net.minecraft.client.gui.components.Tooltip;
Expand Down Expand Up @@ -244,10 +244,10 @@ protected void onDrag(MouseButtonEvent event, double deltaX, double deltaY)
}

@Override
public void renderContents(@NotNull GuiGraphics context, int mouseX, int mouseY, float delta)
public void extractContents(@NotNull GuiGraphicsExtractor context, int mouseX, int mouseY, float delta)
{
// Cascade the rendering
super.renderContents(context, mouseX, mouseY, delta);
super.extractContents(context, mouseX, mouseY, delta);

// Render the current session status
final int u;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@

import me.axieum.mcmod.authme.mixin.MinecraftAccessor;
import me.axieum.mcmod.authme.mixin.RealmsAvailabilityAccessor;
import me.axieum.mcmod.authme.mixin.RealmsClientAccessor;
import me.axieum.mcmod.authme.mixin.ReportingContextAccessor;
import me.axieum.mcmod.authme.mixin.SplashManagerAccessor;
import me.axieum.mcmod.authme.mixinHelper.YggdrasilAuthenticationServiceGetter;
import static me.axieum.mcmod.authme.api.AuthMe.LOGGER;

/**
Expand Down Expand Up @@ -98,8 +100,8 @@ public static void setUser(User user)

// Necessary for Realms to re-check for a valid session
synchronized (RealmsClient.class) {
RealmsClient realmsClient = new RealmsClient(user.getSessionId(), user.getName(), client);
RealmsClient.realmsClientInstance = realmsClient;
RealmsClient realmsClient = RealmsClientAccessor.init(user.getSessionId(), user.getName(), client);
RealmsClientAccessor.setRealmsClientInstance(realmsClient);
((MinecraftAccessor) client).setRealmsDataFetcher(new RealmsDataFetcher(realmsClient));
RealmsAvailabilityAccessor.setFuture(null);
}
Expand Down Expand Up @@ -194,7 +196,9 @@ public static MinecraftSessionService getSessionService()
*/
public static YggdrasilAuthenticationService getAuthService()
{
return Minecraft.getInstance().authme$getAuthService();
YggdrasilAuthenticationServiceGetter getter =
(YggdrasilAuthenticationServiceGetter) Minecraft.getInstance();
return getter.authme$getAuthService();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.DisconnectedScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen;
import net.minecraft.network.DisconnectionDetails;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.contents.TranslatableContents;
Expand Down Expand Up @@ -56,7 +57,13 @@ private void init(CallbackInfo ci)
addRenderableWidget(
Button.builder(
Component.translatable("gui.authme.button.relogin"),
btn -> minecraft.setScreen(new AuthMethodScreen(parent))
btn -> minecraft.setScreen(
new AuthMethodScreen(
parent instanceof JoinMultiplayerScreen
? new JoinMultiplayerScreen(((JoinMultiplayerScreenAccessor) parent).getLastScreen())
: parent
)
)
).bounds(
backButton.getX(),
backButton.getY(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package me.axieum.mcmod.authme.mixin;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen;

/**
* Provides the means to access protected members of the multiplayer screen.
*/
@Mixin(JoinMultiplayerScreen.class)
public interface JoinMultiplayerScreenAccessor
{
@Accessor
Screen getLastScreen();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package me.axieum.mcmod.authme.mixin;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.gen.Invoker;

import com.mojang.realmsclient.client.RealmsClient;

import net.minecraft.client.Minecraft;

/**
* Provides a means of accessing RealmsClient's internals.
*/
@Mixin(RealmsClient.class)
public interface RealmsClientAccessor
{
/**
* The constructor for the RealmsClient class.
*
* @param sessionId The session id.
* @param username The username of the player.
* @param minecraft The client Minecraft instance;
* @return The constructed RealmsClient
*/
@Invoker(value = "<init>")
static RealmsClient init(String sessionId, String username, Minecraft minecraft)
{
throw new AssertionError();
}

/**
* Sets the realmsClientInstance field.
*
* @param client The new value of the field.
*/
@Accessor(value = "realmsClientInstance")
static void setRealmsClientInstance(RealmsClient client)
{
throw new AssertionError();
}
}
3 changes: 1 addition & 2 deletions common/src/main/resources/architectury.common.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"accessWidener": "authme.accesswidener",
"injected_interfaces": {
"net/minecraft/class_310": ["me/axieum/mcmod/authme/mixinHelper/YggdrasilAuthenticationServiceGetter"]
"net/minecraft/client/Minecraft": ["me/axieum/mcmod/authme/mixinHelper/YggdrasilAuthenticationServiceGetter"]
}
}
4 changes: 0 additions & 4 deletions common/src/main/resources/authme.accesswidener

This file was deleted.

2 changes: 2 additions & 0 deletions common/src/main/resources/authme.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
"mixins": [],
"client": [
"DisconnectedScreenMixin",
"JoinMultiplayerScreenAccessor",
"JoinMultiplayerScreenMixin",
"MinecraftAccessor",
"MinecraftMixin",
"RealmsAvailabilityAccessor",
"RealmsClientAccessor",
"RealmsGenericErrorScreenMixin",
"ReportingContextAccessor",
"SplashManagerAccessor"
Expand Down
Loading
Loading