Skip to content

Commit aab627f

Browse files
1.21.9/1.21.10 port (#533)
* 1.21.9 port * fix button misalignment * 1.21.10 update * Update Fabric API to 0.135.0+1.21.10 --------- Co-authored-by: Aizistral <admin@aizistral.com>
1 parent 198b4b8 commit aab627f

File tree

14 files changed

+49
-41
lines changed

14 files changed

+49
-41
lines changed

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import org.apache.tools.ant.taskdefs.condition.Os
22

33
plugins {
4-
id 'fabric-loom' version '1.10.2'
4+
id 'fabric-loom' version '1.11-SNAPSHOT'
55
id 'maven-publish'
66
id "com.modrinth.minotaur" version "2.+"
77
id "com.matthewprenger.cursegradle" version "1.+"
@@ -158,7 +158,7 @@ curseforge {
158158
mainArtifact(remapJar)
159159

160160
addGameVersion project.minecraft_version
161-
addGameVersion "1.21.6"
161+
addGameVersion "1.21.9"
162162
addGameVersion 'Fabric'
163163
addGameVersion 'Java 21'
164164

@@ -190,7 +190,7 @@ modrinth {
190190
versionType = "${version_type}"
191191
changelog = rootProject.file("docs/CHANGELOG.md").text
192192
uploadFile = remapJar
193-
gameVersions = [ project.minecraft_version, "1.21.6" ]
193+
gameVersions = [ project.minecraft_version, "1.21.9" ]
194194
loaders = ['fabric']
195195

196196
dependencies {

gradle.properties

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx4G
33
org.gradle.daemon=false
44

55
# Toolchain Properties
6-
minecraft_version=1.21.7
7-
yarn_mappings=1.21.7+build.1
8-
fabric_loader_version=0.16.14
9-
forge_version=1.21.7-57.0.0
10-
neoforge_version=21.7.0-beta
6+
minecraft_version=1.21.10
7+
yarn_mappings=1.21.10+build.1
8+
fabric_loader_version=0.17.2
9+
forge_version=1.21.10-60.0.0
10+
neoforge_version=21.10.1-beta
1111

1212
# Mod Properties
13-
mod_version=1.21.7-v2.14.0
13+
mod_version=1.21.9-v2.15.0
1414
maven_group=com.aizistral.nochatreports
1515
archives_base_name=NoChatReports-FABRIC
1616
mod_id=nochatreports
@@ -23,14 +23,14 @@ mod_icon=assets/nochatreports/textures/misc/ncr_logo.png
2323
mod_license=WTFPL
2424

2525
# Dependencies
26-
fabric_version=0.128.1+1.21.7
27-
mod_menu_version=15.0.0-beta.2
28-
cloth_config_version=19.0.146
26+
fabric_version=0.135.0+1.21.10
27+
mod_menu_version=16.0.0-rc.1
28+
cloth_config_version=20.0.148
2929

3030
# Dependencies in mods.toml
31-
dep_forge=[57,)
32-
dep_neoforge=[21.7.0,)
33-
dep_minecraft=[1.21.7,)
31+
dep_forge=[59,)
32+
dep_neoforge=[21.9.0-beta,)
33+
dep_minecraft=[1.21.9,)
3434

3535
# Publishing
3636
curse_id=634062

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.12.1-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

neoforge/src/main/java/com/aizistral/nochatreports/neoforge/NoChatReports.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
import net.minecraft.client.Minecraft;
77
import net.minecraft.client.multiplayer.ClientPacketListener;
88
import net.neoforged.api.distmarker.Dist;
9-
import net.neoforged.api.distmarker.OnlyIn;
109
import net.neoforged.neoforge.client.event.ClientPlayerNetworkEvent;
11-
import net.neoforged.neoforge.event.server.ServerStartedEvent;
1210
import net.neoforged.bus.api.SubscribeEvent;
1311
import net.neoforged.fml.common.EventBusSubscriber;
1412
import net.neoforged.fml.common.Mod;
@@ -26,12 +24,12 @@ public NoChatReports() {
2624

2725
@Override
2826
public boolean isOnClient() {
29-
return FMLEnvironment.dist == Dist.CLIENT;
27+
return FMLEnvironment.getDist() == Dist.CLIENT;
3028
}
3129

3230
@Override
3331
public boolean isOnDedicatedServer() {
34-
return FMLEnvironment.dist == Dist.DEDICATED_SERVER;
32+
return FMLEnvironment.getDist() == Dist.DEDICATED_SERVER;
3533
}
3634

3735
@Override

src/main/java/com/aizistral/nochatreports/common/NCRClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public static void resendLastChatMessage() {
8888
var chatScr = mc.screen instanceof ChatScreen chat ? chat : null;
8989

9090
if (chatScr == null) {
91-
chatScr = new ChatScreen("");
91+
chatScr = new ChatScreen("", false);
9292
chatScr.init(mc, mc.getWindow().getGuiScaledWidth(), mc.getWindow().getGuiScaledHeight());
9393
}
9494

src/main/java/com/aizistral/nochatreports/common/gui/AdaptiveWarningScreen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void render(GuiGraphics graphics, int i, int j, float f) {
6161
super.render(graphics, i, j, f);
6262
this.renderTitle(graphics);
6363
int k = this.width / 2 - this.message.getWidth() / 2;
64-
this.message.renderLeftAligned(graphics, k, this.hugeGUI() ? 35 : 70, this.getLineHeight(), 0xFFFFFFFF);
64+
this.message.render(graphics, MultiLineLabel.Align.LEFT, k, this.hugeGUI() ? 35 : 70, this.getLineHeight(), true, 0xFFFFFFFF);
6565
}
6666

6767
private void renderTitle(GuiGraphics graphics) {

src/main/java/com/aizistral/nochatreports/common/gui/TooltipHelper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.aizistral.nochatreports.common.gui;
22

3+
import net.minecraft.Util;
34
import net.minecraft.client.Minecraft;
45
import net.minecraft.network.chat.Component;
56
import net.minecraft.network.chat.MutableComponent;
@@ -11,7 +12,7 @@ private TooltipHelper() {
1112
}
1213

1314
public static MutableComponent getCtrl() {
14-
if (Minecraft.ON_OSX)
15+
if (Util.getPlatform() == Util.OS.OSX)
1516
return Component.translatable("key.nochatreports.cmd");
1617
else
1718
return Component.translatable("key.nochatreports.ctrl");

src/main/java/com/aizistral/nochatreports/common/mixins/client/MixinChatListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private void onHandleSystemMessage(Component message, boolean overlay, CallbackI
7272

7373
if (NCRConfig.getServerPreferences().hasModeCurrent(SigningMode.PROMPT)) {
7474
Screen returnScreen = Minecraft.getInstance().screen instanceof ChatScreen chat ? chat
75-
: new ChatScreen("");
75+
: new ChatScreen("", false);
7676
Screen unsafeScreen = new UnsafeServerScreen(returnScreen);
7777
Minecraft.getInstance().setScreen(unsafeScreen);
7878

src/main/java/com/aizistral/nochatreports/common/mixins/client/MixinJoinMultiplayerScreen.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package com.aizistral.nochatreports.common.mixins.client;
22

3+
import net.minecraft.client.gui.layouts.HeaderAndFooterLayout;
4+
import net.minecraft.client.gui.layouts.LinearLayout;
5+
import org.spongepowered.asm.mixin.Final;
36
import org.spongepowered.asm.mixin.Mixin;
7+
import org.spongepowered.asm.mixin.Shadow;
48
import org.spongepowered.asm.mixin.injection.At;
59
import org.spongepowered.asm.mixin.injection.Inject;
610
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -12,7 +16,6 @@
1216
import com.aizistral.nochatreports.common.gui.GUIShenanigans;
1317
import com.aizistral.nochatreports.common.gui.SwitchableSprites;
1418

15-
import net.minecraft.client.gui.components.ImageButton;
1619
import net.minecraft.client.gui.screens.Screen;
1720
import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen;
1821
import net.minecraft.locale.Language;
@@ -27,6 +30,8 @@
2730

2831
@Mixin(JoinMultiplayerScreen.class)
2932
public abstract class MixinJoinMultiplayerScreen extends Screen {
33+
@Shadow @Final
34+
private HeaderAndFooterLayout layout;
3035
private static final ResourceLocation RELOAD_TEXTURE = ResourceLocation.fromNamespaceAndPath("nochatreports", "textures/gui/config_reload_button.png"),
3136
TOGGLE_TEXTURE = ResourceLocation.fromNamespaceAndPath("nochatreports", "textures/gui/ncr_toggle_button.png");
3237
private static final Component RELOAD_TOOLTIP = Component.translatable("gui.nochatreports.reload_config_tooltip");
@@ -38,18 +43,22 @@ protected MixinJoinMultiplayerScreen() {
3843

3944
@Inject(method = "init", at = @At("HEAD"))
4045
private void onInit(CallbackInfo info) {
46+
LinearLayout ncrButtons = this.layout.addToFooter(LinearLayout.vertical().spacing(4), layoutSettings -> {
47+
layoutSettings.paddingLeft(336);
48+
});
49+
4150
if (NCRConfig.getClient().showReloadButton()) {
42-
var button = new AdvancedImageButton(this.width/2 + 158, this.height - 54, 20, 20,
51+
var button = new AdvancedImageButton(0, 0, 20, 20,
4352
SwitchableSprites.of(GUIShenanigans.getSprites("config_reload_button")),
4453
btn -> NCRConfig.load(), CommonComponents.EMPTY, this);
4554
button.setTooltip(new AdvancedTooltip(RELOAD_TOOLTIP).setMaxWidth(250));
4655
button.active = true;
4756
button.visible = true;
48-
this.addRenderableWidget(button);
57+
ncrButtons.addChild(button);
4958
}
5059

5160
if (NCRConfig.getClient().showNCRButton()) {
52-
var button = new AdvancedImageButton(this.width/2 + 158, this.height - 30, 20, 20,
61+
var button = new AdvancedImageButton(0, 0, 20, 20,
5362
SwitchableSprites.of(
5463
GUIShenanigans.getSprites("ncr_active_button"),
5564
GUIShenanigans.getSprites("ncr_inactive_button")
@@ -71,7 +80,7 @@ private void onInit(CallbackInfo info) {
7180
.enableMod() ? "on" : "off")))).setMaxWidth(250));
7281
button.active = true;
7382
button.visible = true;
74-
this.addRenderableWidget(button);
83+
ncrButtons.addChild(button);
7584
}
7685
}
7786

src/main/java/com/aizistral/nochatreports/common/mixins/client/MixinOnlineServerEntry.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public abstract class MixinOnlineServerEntry extends ServerSelectionList.Entry {
3737
@Shadow @Final
3838
private ServerData serverData;
3939

40-
@Inject(method = "render", at = @At("RETURN"))
41-
private void onRender(GuiGraphics graphics, int i, int j, int k, int l, int m, int n, int o, boolean bl, float f, CallbackInfo info) {
40+
@Inject(method = "renderContent", at = @At("RETURN"))
41+
private void onRender(GuiGraphics graphics, int i, int j, boolean bl, float f, CallbackInfo info) {
4242
if (!NCRConfig.getClient().verifiedIconEnabled())
4343
return;
4444

@@ -47,16 +47,16 @@ private void onRender(GuiGraphics graphics, int i, int j, int k, int l, int m, i
4747
yOffset = NCRConfig.getClient().getVerifiedIconOffsetY();
4848

4949
GlStateManager._enableBlend();
50-
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, VERIFIED_ICON, k + l - 35 + xOffset, j - 1 + yOffset, 14, 14);
50+
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, VERIFIED_ICON, this.getContentRight() - 35 + xOffset, this.getContentY() - 1 + yOffset, 14, 14);
5151
GlStateManager._disableBlend();
5252

53-
int t = n - k;
54-
int u = o - j;
55-
if (t >= l - 35 + xOffset && t <= l - 22 + xOffset && u >= 0 + yOffset && u <= 11 + yOffset) {
53+
int t = i - this.getContentX();
54+
int u = j - this.getContentY();
55+
if (t >= this.getContentWidth() - 35 + xOffset && t <= this.getContentWidth() - 22 + xOffset && u >= 0 + yOffset && u <= 11 + yOffset) {
5656
graphics.setTooltipForNextFrame(Lists.transform(FontHelper.wrap(this.minecraft.font,
5757
Language.getInstance().getOrDefault("gui.nochatreports.verified_server"), 250).stream()
5858
.map(Component::literal).collect(Collectors.toCollection(() ->
59-
new ArrayList<Component>())), Component::getVisualOrderText), n, o);
59+
new ArrayList<Component>())), Component::getVisualOrderText), i, j);
6060
}
6161
}
6262
}

0 commit comments

Comments
 (0)