Skip to content

Commit 8223b65

Browse files
committed
feat: Support MC 1.21.1, 1.21.9-1.21.10
* Update dependency top.hendrixshen.magiclib:magiclib-better-dev to v0.3.68-beta * Update dependency fabric-loom to v1.12-SNAPSHOT * Update dependency fabric-loader to v0.18.4 Signed-off-by: MSDNicrosoft <i@msdnicrosoft.work>
1 parent 3bd8226 commit 8223b65

11 files changed

Lines changed: 84 additions & 18 deletions

File tree

build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,21 @@ preprocess {
1313
def mc1193 = createNode("1.19.3", 1_19_03, "mojang")
1414
def mc1194 = createNode("1.19.4", 1_19_04, "mojang")
1515
def mc1206 = createNode("1.20.6", 1_20_06, "mojang")
16+
def mc1211 = createNode("1.21.1", 1_21_01, "mojang")
1617
def mc1215 = createNode("1.21.5", 1_21_05, "mojang")
1718
def mc1218 = createNode("1.21.8", 1_21_08, "mojang")
19+
def mc12110 = createNode("1.21.10", 1_21_10, "mojang")
1820

1921
mc1165.link(mc1171, null)
2022
mc1171.link(mc1182, null)
2123
mc1182.link(mc1192, null)
2224
mc1192.link(mc1193, null)
2325
mc1193.link(mc1194, null)
2426
mc1194.link(mc1206, null)
25-
mc1206.link(mc1215, null)
27+
mc1206.link(mc1211, null)
28+
mc1211.link(mc1215, null)
2629
mc1215.link(mc1218, null)
30+
mc1218.link(mc12110, null)
2731
}
2832

2933
def ENV = System.getenv()

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[versions]
22
# Gradle Plugins
3-
fabric-loom = "1.11-SNAPSHOT"
3+
fabric-loom = "1.12-SNAPSHOT"
44
preprocessor = "d452ef7"
55
grgit = "5.3.3"
66
yamlang = "1.5.0"
77
replace-token = "1.2.0"
88

99
# modApi
10-
fabric-loader = "0.17.2"
10+
fabric-loader = "0.18.4"
1111
lombok = "1.18.42"
1212

1313
[plugins]
@@ -22,5 +22,5 @@ replace-token = { id = "top.hendrixshen.replace-token", version.ref = "replace-t
2222
fabric-loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric-loader" }
2323
lombok = { module = "org.projectlombok:lombok", version.ref = "lombok" }
2424

25-
# modRuntimeOnly Dependencies
25+
# modRuntimeOnly
2626
magiclib-core-fabric = { module = "top.hendrixshen.magiclib:magiclib-core-fabric", version = "0.8.160" }

settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"1.19.3",
88
"1.19.4",
99
"1.20.6",
10+
"1.21.1",
1011
"1.21.5",
11-
"1.21.8"
12+
"1.21.8",
13+
"1.21.10"
1214
]
1315
}

src/main/java/work/msdnicrosoft/commandbuttons/CommandButtons.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
import net.minecraft.client.KeyMapping;
88
import net.minecraft.client.Minecraft;
99
import net.minecraft.client.player.LocalPlayer;
10+
//#if MC >= 12109
11+
import net.minecraft.resources.ResourceLocation;
12+
//#endif
1013
import org.jetbrains.annotations.NotNull;
1114
import org.lwjgl.glfw.GLFW;
1215
import work.msdnicrosoft.commandbuttons.data.ConfigManager;
@@ -22,11 +25,16 @@ public class CommandButtons implements ModInitializer {
2225
@Override
2326
public void onInitialize() {
2427
ConfigManager.init();
28+
2529
KeyMapping keyBinding = KeyBindingHelper.registerKeyBinding(new KeyMapping(
2630
"mgbuttons.key.opengui",
2731
InputConstants.Type.KEYSYM,
2832
GLFW.GLFW_KEY_G,
29-
"mgbuttons.key.category"
33+
//#if MC >= 12109
34+
KeyMapping.Category.register(ResourceLocation.fromNamespaceAndPath("mgbuttons", "category"))
35+
//#else
36+
//$$ "key.category.mgbuttons.category"
37+
//#endif
3038
));
3139

3240
ClientTickEvents.END_CLIENT_TICK.register(client -> {

src/main/java/work/msdnicrosoft/commandbuttons/gui/WrapperCommandGUIScreen.java

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
import net.minecraft.client.Minecraft;
1111
import net.minecraft.client.gui.GuiGraphics;
1212
import net.minecraft.client.gui.screens.Screen;
13+
//#if MC >= 12109
14+
import net.minecraft.client.input.KeyEvent;
15+
//#endif
1316
import org.jetbrains.annotations.Nullable;
1417
import org.lwjgl.glfw.GLFW;
1518

@@ -84,16 +87,35 @@ public void removed() {
8487
}
8588

8689
@Override
87-
public boolean keyPressed(int ch, int keyCode, int modifiers) {
90+
public boolean keyPressed(
91+
//#if MC >= 12109
92+
KeyEvent input
93+
//#else
94+
//$$ int ch, int keyCode, int modifiers
95+
//#endif
96+
) {
8897
// Support for returning to previous screens.
89-
if (ch == GLFW.GLFW_KEY_ESCAPE && this.parent != null) {
98+
boolean isEscapeKey =
99+
//#if MC >= 12109
100+
input.key() == GLFW.GLFW_KEY_ESCAPE
101+
//#else
102+
//$$ ch == GLFW.GLFW_KEY_ESCAPE
103+
//#endif
104+
;
105+
if (isEscapeKey && this.parent != null) {
90106
Minecraft.getInstance().setScreen(this.parent);
91107
if (this.returnAction != null) {
92-
// Need to apply list update in main screen.
108+
// Need to apply list update in the main screen.
93109
this.returnAction.run();
94110
}
95111
return true;
96112
}
97-
return super.keyPressed(ch, keyCode, modifiers);
113+
return super.keyPressed(
114+
//#if MC >= 12119
115+
input
116+
//#else
117+
//$$ ch, keyCode, modifiers
118+
//#endif
119+
);
98120
}
99121
}

src/main/resources/assets/mgbuttons/lang/en_us.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ mgbuttons:
99
delete: Delete mode
1010
edit: Edit mode
1111
search: Search...
12-
key:
13-
category: Command GUI Buttons
14-
opengui: Open GUI
12+
key.opengui: Open GUI
13+
14+
key.category.mgbuttons.category: Command GUI Buttons

src/main/resources/assets/mgbuttons/lang/zh_cn.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ mgbuttons:
99
delete: 删除模式
1010
edit: 编辑模式
1111
search: 搜索...
12-
key:
13-
category: Command GUI Buttons
14-
opengui: 打开 GUI
12+
key.opengui: 打开 GUI
13+
14+
key.category.mgbuttons.category: Command GUI Buttons

versions/1.16.5/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ dependencies {
5252
modApi("maven.modrinth:modmenu:${project.modmenu_version}")
5353

5454
// Make development client more comfortable.
55-
modRuntimeOnly("top.hendrixshen.magiclib:magiclib-better-dev-${project.minecraft_version}${project.minecraft_version.size() == 4 ? ".0" : ""}-fabric:0.3.63") {
55+
modRuntimeOnly("top.hendrixshen.magiclib:magiclib-better-dev-${project.minecraft_version}${project.minecraft_version.size() == 4 ? ".0" : ""}-fabric:0.3.68-beta") {
5656
transitive = false
5757
}
5858

versions/1.21.1/gradle.properties

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Dependency Versions
2+
minecraft_dependency=1.21.1
3+
minecraft_version=1.21.1
4+
minecraft_out=1.21.1
5+
6+
# Required Libraries
7+
# FabricAPI 0.116.7+1.21.1
8+
fabric_version=0.116.7+1.21.1
9+
10+
# LibGui 11.1.0+1.21
11+
libgui_version=11.1.0+1.21
12+
13+
# Runtime Libraries - Only for development environment
14+
# Mod Menu - 11.0.3
15+
modmenu_version=11.0.3

versions/1.21.10/gradle.properties

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Dependency Versions
2+
minecraft_dependency=>=1.21.9 <=1.21.10
3+
minecraft_version=1.21.10
4+
minecraft_out=1.21.9-10
5+
6+
# Required Libraries
7+
# FabricAPI 0.138.4+1.21.10
8+
fabric_version=0.138.4+1.21.10
9+
10+
# LibGui 15.0.0+1.21.9-rc1
11+
libgui_version=15.0.0+1.21.9-rc1
12+
13+
# Runtime Libraries - Only for development environment
14+
# Mod Menu - 16.0.0
15+
modmenu_version=16.0.0

0 commit comments

Comments
 (0)