@@ -32,14 +32,15 @@ public class FramerateCommand {
3232
3333 public static void register (CommandDispatcher <FabricClientCommandSource > dispatcher ) {
3434 dispatcher .register (literal ("cfps" )
35+ .executes (ctx -> getMaxFps (ctx .getSource ()))
3536 .then (literal ("unlimited" )
3637 .executes (ctx -> maxFps (ctx .getSource (), Integer .MAX_VALUE ))
3738 ).then (argument ("maxfps" , integer ())
3839 .suggests ((context , builder ) -> {
3940 int maxFps = getDisplayMaxFramerate ();
4041 for (int refreshRate : COMMON_REFRESH_RATES ) {
4142 if (refreshRate > maxFps ) {
42- break ;
43+ continue ;
4344 }
4445 builder .suggest (refreshRate );
4546 }
@@ -51,12 +52,22 @@ public static void register(CommandDispatcher<FabricClientCommandSource> dispatc
5152
5253 }
5354
55+ private static int getMaxFps (FabricClientCommandSource source ) {
56+ int framerateLimit = source .getClient ().getFramerateLimitTracker ().getFramerateLimit ();
57+ if (framerateLimit < Integer .MAX_VALUE ) {
58+ source .sendFeedback (Component .translatable ("commands.cfps.success.get" , framerateLimit ));
59+ } else {
60+ source .sendFeedback (Component .translatable ("commands.cfps.success.get.unlimited" ));
61+ }
62+ return framerateLimit ;
63+ }
64+
5465 private static int maxFps (FabricClientCommandSource source , int maxFps ) {
5566 source .getClient ().getFramerateLimitTracker ().setFramerateLimit (maxFps );
5667 if (maxFps == Integer .MAX_VALUE ) {
57- source .sendFeedback (Component .translatable ("commands.cfps.success.unlimited" ));
68+ source .sendFeedback (Component .translatable ("commands.cfps.success.set. unlimited" ));
5869 } else {
59- source .sendFeedback (Component .translatable ("commands.cfps.success" , maxFps ));
70+ source .sendFeedback (Component .translatable ("commands.cfps.success.set " , maxFps ));
6071 }
6172 return maxFps ;
6273 }
0 commit comments