Skip to content

Commit eae9f97

Browse files
committed
port: update to 1.21.10
1 parent 6cff4ac commit eae9f97

7 files changed

Lines changed: 62 additions & 27 deletions

File tree

build.gradle

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'fabric-loom' version '1.10-SNAPSHOT'
2+
id 'fabric-loom' version "${loom_version}"
33
id 'maven-publish'
44
id "io.github.p03w.machete" version "2.0.1"
55
}
@@ -39,12 +39,11 @@ processResources {
3939
inputs.property "version", project.version
4040

4141
filesMatching("fabric.mod.json") {
42-
expand "version": project.version
42+
expand "version": inputs.properties.version
4343
}
4444
}
4545

4646
tasks.withType(JavaCompile).configureEach {
47-
// Since Minecraft 1.21, Java 21 is preferred.
4847
it.options.release = 21
4948
}
5049

@@ -62,3 +61,21 @@ jar {
6261
rename { "${it}_${inputs.properties.archivesName}"}
6362
}
6463
}
64+
65+
// configure the maven publication
66+
publishing {
67+
publications {
68+
create("mavenJava", MavenPublication) {
69+
artifactId = project.archives_base_name
70+
from components.java
71+
}
72+
}
73+
74+
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
75+
repositories {
76+
// Add repositories to publish to here.
77+
// Notice: This block does NOT have the same function as the block in the top level.
78+
// The repositories here will be used for publishing your artifact, not for
79+
// retrieving dependencies.
80+
}
81+
}

gradle.properties

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
# Done to increase the memory available to gradle.
22
org.gradle.jvmargs=-Xmx1G
3+
org.gradle.parallel=true
4+
5+
# IntelliJ IDEA is not yet fully compatible with configuration cache, see: https://github.com/FabricMC/fabric-loom/issues/1349
6+
org.gradle.configuration-cache=false
37

48
# Fabric Properties
59
# check these on https://fabricmc.net/develop
6-
minecraft_version=1.21.6
7-
yarn_mappings=1.21.6+build.1
8-
loader_version=0.16.14
10+
minecraft_version=1.21.10
11+
yarn_mappings=1.21.10+build.3
12+
loader_version=0.18.1
13+
loom_version=1.13-SNAPSHOT
914

1015
# Mod Properties
1116
mod_version=3.1.1
12-
target_version=1.21.6
17+
target_version=1.21.10
1318
maven_group=me.contaria
1419
archives_base_name=fastquit
1520

1621
# Dependencies
17-
fabric_api_version=0.127.1+1.21.6
18-
modmenu_version=15.0.0-beta.2
19-
cloth_config_version=19.0.147
22+
fabric_api_version=0.138.3+1.21.10
23+
modmenu_version=16.0.0-rc.1
24+
cloth_config_version=20.0.149

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

src/main/java/me/contaria/fastquit/mixin/LevelStorageSessionMixin.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ public abstract class LevelStorageSessionMixin {
4949
@Shadow
5050
public abstract void backupLevelDataFile(DynamicRegistryManager registryManager, SaveProperties saveProperties, @Nullable NbtCompound nbt);
5151

52+
@Synchronized
53+
@Shadow
54+
protected abstract void save(NbtCompound compound) throws IOException;
55+
5256
@Synchronized
5357
@Shadow
5458
public abstract long createBackup() throws IOException;
@@ -61,6 +65,10 @@ public abstract class LevelStorageSessionMixin {
6165
@Shadow
6266
protected abstract void save(Consumer<NbtCompound> nbtProcessor) throws IOException;
6367

68+
@Synchronized
69+
@Shadow
70+
public abstract boolean tryRestoreBackup();
71+
6472
@Synchronized
6573
@Shadow
6674
public abstract void close() throws IOException;

src/main/java/me/contaria/fastquit/mixin/MinecraftClientMixin.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
package me.contaria.fastquit.mixin;
22

3+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
4+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
35
import me.contaria.fastquit.FastQuit;
4-
import me.contaria.fastquit.TextHelper;
56
import me.contaria.fastquit.WorldInfo;
6-
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
77
import net.minecraft.client.MinecraftClient;
8-
import net.minecraft.client.gui.screen.MessageScreen;
98
import net.minecraft.client.gui.screen.Screen;
109
import net.minecraft.server.integrated.IntegratedServer;
1110
import org.spongepowered.asm.mixin.Mixin;
11+
import org.spongepowered.asm.mixin.Shadow;
1212
import org.spongepowered.asm.mixin.injection.At;
1313
import org.spongepowered.asm.mixin.injection.Inject;
1414
import org.spongepowered.asm.mixin.injection.Redirect;
1515
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
1616

1717
@Mixin(MinecraftClient.class)
1818
public abstract class MinecraftClientMixin {
19+
@Shadow
20+
private boolean integratedServerRunning;
1921

2022
@Redirect(
2123
method = "disconnect(Lnet/minecraft/client/gui/screen/Screen;Z)V",
@@ -35,15 +37,19 @@ private boolean fastquit(IntegratedServer server) {
3537
return true;
3638
}
3739

38-
@WrapWithCondition(
39-
method = "reset",
40+
@WrapOperation(
41+
method = "disconnect(Lnet/minecraft/client/gui/screen/Screen;Z)V",
4042
at = @At(
4143
value = "INVOKE",
42-
target = "Lnet/minecraft/client/MinecraftClient;render(Z)V"
44+
target = "Lnet/minecraft/client/MinecraftClient;setScreenAndRender(Lnet/minecraft/client/gui/screen/Screen;)V"
4345
)
4446
)
45-
private boolean fastquit$doNotOpenSaveScreen(MinecraftClient client, boolean tick, Screen screen) {
46-
return FastQuit.CONFIG.renderSavingScreen || !(screen instanceof MessageScreen && screen.getTitle().equals(TextHelper.translatable("menu.savingLevel")));
47+
private void fastquit$doNotOpenSaveScreen(MinecraftClient client, Screen screen, Operation<Void> original) {
48+
if (FastQuit.CONFIG.renderSavingScreen && this.integratedServerRunning) {
49+
original.call(client, screen);
50+
} else {
51+
client.setScreen(screen);
52+
}
4753
}
4854

4955
@Inject(

src/main/java/me/contaria/fastquit/mixin/WorldListWidgetWorldEntryMixin.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
88
import net.minecraft.client.MinecraftClient;
99
import net.minecraft.client.gui.DrawContext;
10-
import net.minecraft.client.gui.screen.world.SelectWorldScreen;
10+
import net.minecraft.client.gui.screen.Screen;
1111
import net.minecraft.client.gui.screen.world.WorldListWidget;
1212
import net.minecraft.world.level.storage.LevelStorage;
1313
import net.minecraft.world.level.storage.LevelSummary;
@@ -19,11 +19,10 @@
1919
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
2020

2121
@Mixin(WorldListWidget.WorldEntry.class)
22-
public abstract class WorldListWidgetWorldEntryMixin {
23-
22+
public abstract class WorldListWidgetWorldEntryMixin extends WorldListWidget.Entry {
2423
@Shadow
2524
@Final
26-
private SelectWorldScreen screen;
25+
private Screen screen;
2726
@Shadow
2827
@Final
2928
private MinecraftClient client;
@@ -73,18 +72,18 @@ public abstract class WorldListWidgetWorldEntryMixin {
7372
method = "render",
7473
at = @At(
7574
value = "INVOKE",
76-
target = "Lnet/minecraft/client/gui/DrawContext;drawTextWithShadow(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/Text;III)V",
75+
target = "Lnet/minecraft/client/gui/widget/TextWidget;render(Lnet/minecraft/client/gui/DrawContext;IIF)V",
7776
ordinal = 0,
7877
shift = At.Shift.AFTER
7978
)
8079
)
81-
private void fastquit$renderSavingTimeOnWorldList(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta, CallbackInfo ci) {
80+
private void fastquit$renderSavingTimeOnWorldList(DrawContext context, int mouseX, int mouseY, boolean hovered, float deltaTicks, CallbackInfo ci) {
8281
if (FastQuit.CONFIG.showSavingTime == FastQuitConfig.ShowSavingTime.TRUE) {
8382
FastQuit.getSavingWorld(this.client.getLevelStorage().getSavesDirectory().resolve(this.level.getName())).ifPresent(server -> {
8483
WorldInfo info = FastQuit.savingWorlds.get(server);
8584
if (info != null) {
8685
String time = info.getTimeSaving() + " ⌛";
87-
context.drawText(this.client.textRenderer, time, x + entryWidth - this.client.textRenderer.getWidth(time) - 4, y + 1, -6939106, false);
86+
context.drawText(this.client.textRenderer, time, this.getX() + this.getWidth() - this.client.textRenderer.getWidth(time) - 4, this.getY() + 1, -6939106, false);
8887
}
8988
});
9089
}

src/main/resources/fabric.mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
],
2929
"depends": {
3030
"fabricloader": ">=0.16.9",
31-
"minecraft": ">=1.21.6",
31+
"minecraft": ">=1.21.9",
3232
"fabric-resource-loader-v0": "*",
3333
"cloth-config": "*",
3434
"java": ">=21"

0 commit comments

Comments
 (0)