Skip to content

Commit 4b9ecab

Browse files
committed
Compatibility patch for realmsfix
1 parent a01ed15 commit 4b9ecab

File tree

6 files changed

+33
-14
lines changed

6 files changed

+33
-14
lines changed

Diff for: gradle.properties

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ org.gradle.jvmargs=-Xmx1G
55
# check these on https://modmuss50.me/fabric.html
66

77
minecraft_version=1.21
8-
yarn_mappings=1.21+build.1
8+
yarn_mappings=1.21-rc1+build.1
99
loader_version=0.15.11
1010

1111
#Fabric api
12-
fabric_version=0.100.1+1.21
12+
fabric_version=0.100.7+1.21
1313

1414
# Mod Properties
15-
mod_version = 4.0.3
15+
mod_version = 4.0.4
1616
maven_group = xyz.sillyjune
1717
archives_base_name = Notebook
1818

Diff for: src/main/java/xyz/sillyjune/notebook/Notebook.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,5 @@ public static ButtonTextures getBookIcon() {
9191
public static NotebookConfig CONFIG;
9292
public static final Identifier BOOK_TEXTURE = Identifier.of("textures/gui/book.png");
9393
public static String BOOK_FOLDER = "Notebook";
94-
public static boolean GAY = true;
94+
public static boolean GAY = true; // I might be straight but gay people are pretty cool
9595
}

Diff for: src/main/java/xyz/sillyjune/notebook/NotebookScreen.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) {
205205
super.render(context, mouseX, mouseY, delta);
206206
if (GAY) { context.drawText(this.textRenderer, Text.translatable("notebook.gay"), 5, this.height - 22, Colors.WHITE, true); }
207207
if (CONFIG.debug()) {
208-
context.drawText(this.textRenderer, Text.of("Notebook v4.0.3 - " + Text.translatable("devwarning.info").getString()), 5, this.height - 10, Colors.WHITE, true);
208+
context.drawText(this.textRenderer, Text.of("Notebook v4.0.4 - " + Text.translatable("devwarning.info").getString()), 5, this.height - 10, Colors.WHITE, true);
209209
} else {
210-
context.drawText(this.textRenderer, Text.of("Notebook v4.0.3"), 5, this.height - 10, Colors.WHITE, true);
210+
context.drawText(this.textRenderer, Text.of("Notebook v4.0.4"), 5, this.height - 10, Colors.WHITE, true);
211211
}
212212
}
213213
public void renderBackground(DrawContext context, int mouseX, int mouseY, float delta) {

Diff for: src/main/java/xyz/sillyjune/notebook/mixin/GameMenuScreenButton.java

+11-4
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
import org.spongepowered.asm.mixin.injection.Inject;
1212
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
1313

14-
import static xyz.sillyjune.notebook.Notebook.MAIN_BUTTON_ICON;
15-
import static xyz.sillyjune.notebook.Notebook.getBookIcon;
14+
import static xyz.sillyjune.notebook.Notebook.*;
1615

1716
@Mixin(GameMenuScreen.class)
1817
public abstract class GameMenuScreenButton extends Screen {
@@ -21,7 +20,15 @@ protected GameMenuScreenButton(Text title) {
2120
}
2221
@Inject(at = @At("RETURN"), method="initWidgets")
2322
private void addCustomButton(CallbackInfo ci) {
24-
ButtonTextures icon = getBookIcon();
25-
this.addDrawableChild(new TexturedButtonWidget(this.width / 2 + 104, this.height / 4 + 96 + -16, 20, 20, icon, (button) -> this.client.setScreen(new NotebookScreen())));
23+
TexturedButtonWidget b = new TexturedButtonWidget(
24+
this.width / 2 + 104,
25+
this.height / 4 + 96 + -16,
26+
20,
27+
20,
28+
getBookIcon(),
29+
(button) -> this.client.setScreen(new NotebookScreen())
30+
);
31+
b.setMessage(Text.translatable("key.notebook.open"));
32+
this.addDrawableChild(b);
2633
}
2734
}

Diff for: src/main/java/xyz/sillyjune/notebook/mixin/TitleScreenButton.java

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package xyz.sillyjune.notebook.mixin;
22

3+
import net.minecraft.client.MinecraftClient;
4+
import net.minecraft.client.gui.Drawable;
35
import net.minecraft.client.gui.screen.ButtonTextures;
6+
import net.minecraft.client.gui.screen.option.OptionsScreen;
7+
import net.minecraft.client.gui.widget.ButtonWidget;
48
import xyz.sillyjune.notebook.NotebookScreen;
59
import net.fabricmc.api.EnvType;
610
import net.fabricmc.api.Environment;
@@ -23,10 +27,18 @@ public abstract class TitleScreenButton extends Screen {
2327
protected TitleScreenButton(Text title) {
2428
super(title);
2529
}
26-
@Inject(at = @At("RETURN"), method="initWidgetsNormal")
30+
@Inject(at = @At("TAIL"), method="initWidgetsNormal")
2731
private void addCustomButton(int y, int spacingY, CallbackInfo ci) {
28-
ButtonTextures icon = getBookIcon();
29-
this.addDrawableChild(new TexturedButtonWidget((this.width / 2 + 104), y + spacingY + CONFIG.button_offset(), 20, 20, icon, (button) -> this.client.setScreen(new NotebookScreen())));
32+
TexturedButtonWidget b = new TexturedButtonWidget(
33+
(this.width / 2 + 104),
34+
y + spacingY + CONFIG.button_offset(),
35+
20,
36+
20,
37+
getBookIcon(),
38+
(button) -> this.client.setScreen(new NotebookScreen())
39+
);
40+
b.setMessage(Text.translatable("key.notebook.open"));
41+
this.addDrawableChild(b);
3042
}
3143
}
3244

Diff for: src/main/resources/notebook.mixins.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"required": true,
33
"minVersion": "0.8",
44
"package": "xyz.sillyjune.notebook.mixin",
5-
"compatibilityLevel": "JAVA_17",
5+
"compatibilityLevel": "JAVA_21",
66
"mixins": [],
77
"client": [
88
"TitleScreenButton",

0 commit comments

Comments
 (0)