Skip to content

Commit 98e629a

Browse files
BytelyPlayaxieum
andcommitted
build: add support for Minecraft 26.1+ (#160)
Release-As: 9.1.0+26.1 Co-authored-by: Jonathan Hiles <jonathan@hil.es>
1 parent bddb803 commit 98e629a

20 files changed

Lines changed: 181 additions & 121 deletions

.github/workflows/build.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
- name: ✨ Checkout repository
2222
uses: actions/checkout@v4
2323

24-
- name: ☕ Set up JDK 21
24+
- name: ☕ Set up JDK 25
2525
uses: actions/setup-java@v4
2626
with:
27-
java-version: 21
27+
java-version: 25
2828
distribution: temurin
2929

3030
- name: 🐘 Set up Gradle
@@ -45,10 +45,8 @@ jobs:
4545
with:
4646
name: artifacts
4747
path: |
48-
**/build/devlibs/*-sources.jar
4948
**/build/libs/*.jar
50-
!**/build/libs/*-dev-shadow.jar
51-
!**/build/libs/*-sources.jar
49+
!**/build/libs/*-dev.jar
5250
!build/**
5351
!common/**
5452

.github/workflows/release.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ jobs:
4444
- name: ✨ Checkout repository
4545
uses: actions/checkout@v4
4646

47-
- name: ☕ Set up JDK 21
47+
- name: ☕ Set up JDK 25
4848
uses: actions/setup-java@v4
4949
with:
50-
java-version: 21
50+
java-version: 25
5151
distribution: temurin
5252

5353
- name: 🐘 Set up Gradle
@@ -84,9 +84,9 @@ jobs:
8484
with:
8585
name: "[Fabric] ${{ steps.props.outputs.mod_name }} ${{ needs.release.outputs.tag_name }}"
8686
files: |
87-
fabric/build/libs/!(*-@(dev|dev-shadow|javadoc|sources)).jar
87+
fabric/build/libs/!(*-@(dev|javadoc|sources)).jar
8888
fabric/build/libs/*-javadoc.jar
89-
fabric/build/devlibs/*-sources.jar
89+
fabric/build/libs/*-sources.jar
9090
version: ${{ needs.release.outputs.tag_name }}
9191
changelog: For a list of changes, please refer to https://github.com/axieum/authme/releases/tag/${{ needs.release.outputs.tag_name }}
9292
loaders: |
@@ -106,9 +106,9 @@ jobs:
106106
with:
107107
name: "[NeoForge] ${{ steps.props.outputs.mod_name }} ${{ needs.release.outputs.tag_name }}"
108108
files: |
109-
neoforge/build/libs/!(*-@(dev|dev-shadow|javadoc|sources)).jar
109+
neoforge/build/libs/!(*-@(dev|javadoc|sources)).jar
110110
neoforge/build/libs/*-javadoc.jar
111-
neoforge/build/devlibs/*-sources.jar
111+
neoforge/build/libs/*-sources.jar
112112
version: ${{ needs.release.outputs.tag_name }}
113113
changelog: For a list of changes, please refer to https://github.com/axieum/authme/releases/tag/${{ needs.release.outputs.tag_name }}
114114
loaders: |
@@ -125,7 +125,5 @@ jobs:
125125
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126126
run: |
127127
shopt -s extglob
128-
gh release upload ${{ needs.release.outputs.tag_name }} fabric/build/libs/!(*-@(dev|dev-shadow|sources)).jar
129-
gh release upload ${{ needs.release.outputs.tag_name }} fabric/build/devlibs/*-sources.jar
130-
gh release upload ${{ needs.release.outputs.tag_name }} neoforge/build/libs/!(*-@(dev|dev-shadow|sources)).jar
131-
gh release upload ${{ needs.release.outputs.tag_name }} neoforge/build/devlibs/*-sources.jar
128+
gh release upload ${{ needs.release.outputs.tag_name }} fabric/build/libs/!(*-@(dev)).jar
129+
gh release upload ${{ needs.release.outputs.tag_name }} neoforge/build/libs/!(*-@(dev)).jar

build.gradle

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
plugins {
2-
id 'architectury-plugin' version '3.4-SNAPSHOT'
3-
id 'dev.architectury.loom' version '1.13-SNAPSHOT' apply false
2+
id 'architectury-plugin' version '3.5-SNAPSHOT'
3+
id 'com.gradleup.shadow' version '9.4.1' apply false
4+
id 'dev.architectury.loom-no-remap' version '1.14-SNAPSHOT' apply false
45
}
56

67
architectury {
78
minecraft = project.minecraft_version
89
}
910

1011
subprojects {
11-
apply plugin: 'dev.architectury.loom'
12+
apply plugin: 'com.gradleup.shadow'
13+
apply plugin: 'dev.architectury.loom-no-remap'
1214

1315
loom {
1416
silentMojangMappingsLicense()
1517
}
1618

1719
dependencies {
1820
minecraft "com.mojang:minecraft:${project.minecraft_version}"
19-
mappings loom.officialMojangMappings()
2021
}
2122
}
2223

@@ -28,9 +29,6 @@ allprojects {
2829

2930
group = rootProject.maven_group
3031
version = rootProject.version
31-
archivesBaseName = rootProject.archives_base_name
32-
33-
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21
3432

3533
// Perform tests using the JUnit test suite
3634
test {
@@ -41,6 +39,12 @@ allprojects {
4139
java {
4240
withJavadocJar()
4341
withSourcesJar()
42+
43+
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_25;
44+
}
45+
46+
base {
47+
archivesName = rootProject.archives_base_name;
4448
}
4549

4650
// Add the licence to all distributions

common/build.gradle

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ architectury {
22
common rootProject.enabled_platforms.split(", ")
33
}
44

5-
loom {
6-
accessWidenerPath = file("src/main/resources/${project.mod_id}.accesswidener")
5+
configurations {
6+
shadowCommon
77
}
88

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

1212
api "commons-logging:commons-logging:${project.apache_logging_version}"
1313
api "org.apache.httpcomponents:httpcore:${project.apache_httpcore_version}"
1414
api "org.apache.httpcomponents:httpclient:${project.apache_httpclient_version}"
15-
modApi "com.teamresourceful.resourcefulconfig:resourcefulconfig-common-${project.resourceful_config_version}"
15+
api "com.teamresourceful.resourcefulconfig:resourcefulconfig-common-${project.resourceful_config_version}"
1616
}
1717

1818
processResources {
@@ -27,3 +27,36 @@ processResources {
2727
// pack.mcmeta
2828
filesMatching('pack.mcmeta') { expand(['mod_name': project.mod_name]) }
2929
}
30+
31+
jar {
32+
archiveAppendix.set project.name
33+
archiveClassifier.set 'dev'
34+
}
35+
36+
shadowJar {
37+
dependsOn jar
38+
mainSpec.sourcePaths.clear()
39+
from zipTree(jar.archiveFile)
40+
configurations = [project.configurations.shadowCommon]
41+
archiveAppendix.set project.name
42+
archiveClassifier.unset()
43+
}
44+
45+
sourcesJar {
46+
archiveAppendix.set project.name
47+
}
48+
49+
javadocJar {
50+
archiveAppendix.set project.name
51+
}
52+
53+
configurations {
54+
apiElements {
55+
outgoing.artifacts.clear()
56+
outgoing.artifact(shadowJar)
57+
}
58+
runtimeElements {
59+
outgoing.artifacts.clear()
60+
outgoing.artifact(shadowJar)
61+
}
62+
}

common/src/main/java/me/axieum/mcmod/authme/api/gui/widget/AuthButtonWidget.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import org.jetbrains.annotations.NotNull;
44
import org.jetbrains.annotations.Nullable;
55

6-
import net.minecraft.client.gui.GuiGraphics;
6+
import net.minecraft.client.gui.GuiGraphicsExtractor;
77
import net.minecraft.client.gui.components.Button;
88
import net.minecraft.client.gui.components.ImageButton;
99
import net.minecraft.client.gui.components.Tooltip;
@@ -244,10 +244,10 @@ protected void onDrag(MouseButtonEvent event, double deltaX, double deltaY)
244244
}
245245

246246
@Override
247-
public void renderContents(@NotNull GuiGraphics context, int mouseX, int mouseY, float delta)
247+
public void extractContents(@NotNull GuiGraphicsExtractor context, int mouseX, int mouseY, float delta)
248248
{
249249
// Cascade the rendering
250-
super.renderContents(context, mouseX, mouseY, delta);
250+
super.extractContents(context, mouseX, mouseY, delta);
251251

252252
// Render the current session status
253253
final int u;

common/src/main/java/me/axieum/mcmod/authme/api/util/SessionUtils.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020

2121
import me.axieum.mcmod.authme.mixin.MinecraftAccessor;
2222
import me.axieum.mcmod.authme.mixin.RealmsAvailabilityAccessor;
23+
import me.axieum.mcmod.authme.mixin.RealmsClientAccessor;
2324
import me.axieum.mcmod.authme.mixin.ReportingContextAccessor;
2425
import me.axieum.mcmod.authme.mixin.SplashManagerAccessor;
26+
import me.axieum.mcmod.authme.mixinHelper.YggdrasilAuthenticationServiceGetter;
2527
import static me.axieum.mcmod.authme.api.AuthMe.LOGGER;
2628

2729
/**
@@ -98,8 +100,8 @@ public static void setUser(User user)
98100

99101
// Necessary for Realms to re-check for a valid session
100102
synchronized (RealmsClient.class) {
101-
RealmsClient realmsClient = new RealmsClient(user.getSessionId(), user.getName(), client);
102-
RealmsClient.realmsClientInstance = realmsClient;
103+
RealmsClient realmsClient = RealmsClientAccessor.init(user.getSessionId(), user.getName(), client);
104+
RealmsClientAccessor.setRealmsClientInstance(realmsClient);
103105
((MinecraftAccessor) client).setRealmsDataFetcher(new RealmsDataFetcher(realmsClient));
104106
RealmsAvailabilityAccessor.setFuture(null);
105107
}
@@ -194,7 +196,9 @@ public static MinecraftSessionService getSessionService()
194196
*/
195197
public static YggdrasilAuthenticationService getAuthService()
196198
{
197-
return Minecraft.getInstance().authme$getAuthService();
199+
YggdrasilAuthenticationServiceGetter getter =
200+
(YggdrasilAuthenticationServiceGetter) Minecraft.getInstance();
201+
return getter.authme$getAuthService();
198202
}
199203

200204
/**

common/src/main/java/me/axieum/mcmod/authme/mixin/DisconnectedScreenMixin.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import net.minecraft.client.gui.components.Button;
1313
import net.minecraft.client.gui.screens.DisconnectedScreen;
1414
import net.minecraft.client.gui.screens.Screen;
15+
import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen;
1516
import net.minecraft.network.DisconnectionDetails;
1617
import net.minecraft.network.chat.Component;
1718
import net.minecraft.network.chat.contents.TranslatableContents;
@@ -56,7 +57,13 @@ private void init(CallbackInfo ci)
5657
addRenderableWidget(
5758
Button.builder(
5859
Component.translatable("gui.authme.button.relogin"),
59-
btn -> minecraft.setScreen(new AuthMethodScreen(parent))
60+
btn -> minecraft.setScreen(
61+
new AuthMethodScreen(
62+
parent instanceof JoinMultiplayerScreen
63+
? new JoinMultiplayerScreen(((JoinMultiplayerScreenAccessor) parent).getLastScreen())
64+
: parent
65+
)
66+
)
6067
).bounds(
6168
backButton.getX(),
6269
backButton.getY(),
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package me.axieum.mcmod.authme.mixin;
2+
3+
import org.spongepowered.asm.mixin.Mixin;
4+
import org.spongepowered.asm.mixin.gen.Accessor;
5+
6+
import net.minecraft.client.gui.screens.Screen;
7+
import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen;
8+
9+
/**
10+
* Provides the means to access protected members of the multiplayer screen.
11+
*/
12+
@Mixin(JoinMultiplayerScreen.class)
13+
public interface JoinMultiplayerScreenAccessor
14+
{
15+
@Accessor
16+
Screen getLastScreen();
17+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package me.axieum.mcmod.authme.mixin;
2+
3+
import org.spongepowered.asm.mixin.Mixin;
4+
import org.spongepowered.asm.mixin.gen.Accessor;
5+
import org.spongepowered.asm.mixin.gen.Invoker;
6+
7+
import com.mojang.realmsclient.client.RealmsClient;
8+
9+
import net.minecraft.client.Minecraft;
10+
11+
/**
12+
* Provides a means of accessing RealmsClient's internals.
13+
*/
14+
@Mixin(RealmsClient.class)
15+
public interface RealmsClientAccessor
16+
{
17+
/**
18+
* The constructor for the RealmsClient class.
19+
*
20+
* @param sessionId The session id.
21+
* @param username The username of the player.
22+
* @param minecraft The client Minecraft instance;
23+
* @return The constructed RealmsClient
24+
*/
25+
@Invoker(value = "<init>")
26+
static RealmsClient init(String sessionId, String username, Minecraft minecraft)
27+
{
28+
throw new AssertionError();
29+
}
30+
31+
/**
32+
* Sets the realmsClientInstance field.
33+
*
34+
* @param client The new value of the field.
35+
*/
36+
@Accessor(value = "realmsClientInstance")
37+
static void setRealmsClientInstance(RealmsClient client)
38+
{
39+
throw new AssertionError();
40+
}
41+
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
2-
"accessWidener": "authme.accesswidener",
32
"injected_interfaces": {
4-
"net/minecraft/class_310": ["me/axieum/mcmod/authme/mixinHelper/YggdrasilAuthenticationServiceGetter"]
3+
"net/minecraft/client/Minecraft": ["me/axieum/mcmod/authme/mixinHelper/YggdrasilAuthenticationServiceGetter"]
54
}
65
}

0 commit comments

Comments
 (0)