File tree Expand file tree Collapse file tree
src/main/java/cn/msdnicrosoft/commandbuttons Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22org.gradle.jvmargs =-Xmx1G
33# Fabric Properties
44# check these on https://fabricmc.net/develop
5- minecraft_version =1.19
5+ minecraft_version =1.19.1
66loader_version =0.14.8
77
88# Mod Properties
@@ -11,7 +11,7 @@ maven_group=cn.msdnicrosoft.commandbuttons
1111archives_base_name =command-gui-buttons
1212
1313# Dependencies
14- fabric_version =0.55.3 +1.19
14+ fabric_version =0.58.5 +1.19.1
1515libgui_version =6.0.0+1.19
1616gson_version =2.9.0
1717json_simple_version =1.1.1
Original file line number Diff line number Diff line change 66import net .fabricmc .api .ModInitializer ;
77import net .fabricmc .fabric .api .client .event .lifecycle .v1 .ClientTickEvents ;
88import net .fabricmc .fabric .api .client .keybinding .v1 .KeyBindingHelper ;
9+ import net .minecraft .Util ;
910import net .minecraft .client .KeyMapping ;
1011import net .minecraft .client .Minecraft ;
12+ import net .minecraft .client .gui .chat .ClientChatPreview ;
1113import net .minecraft .client .player .LocalPlayer ;
14+ import net .minecraft .network .chat .Component ;
1215import org .apache .logging .log4j .LogManager ;
1316import org .apache .logging .log4j .Logger ;
1417import org .json .simple .JSONObject ;
@@ -32,13 +35,15 @@ public static void send(String text) {
3235
3336 public static void send (String text , boolean useCommand ) {
3437 LocalPlayer player = mc .player ;
38+ ClientChatPreview chatPreview = new ClientChatPreview (mc );
39+ Component component = Util .mapNullable (chatPreview .pull (text ), ClientChatPreview .Preview ::response );
3540 if (player == null ) {
3641 return ;
3742 }
3843 if (useCommand ) {
39- player .command (text );
44+ player .commandSigned (text , component );
4045 } else {
41- player .chat (text );
46+ player .chatSigned (text , component );
4247 }
4348 }
4449
You can’t perform that action at this time.
0 commit comments