File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
src/main/java/net/earthcomputer/clientcommands Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 33import com .mojang .brigadier .CommandDispatcher ;
44import net .fabricmc .fabric .api .client .command .v2 .FabricClientCommandSource ;
55import net .minecraft .client .Minecraft ;
6+ import net .minecraft .client .Options ;
67import net .minecraft .network .chat .Component ;
78
89import java .util .function .IntSupplier ;
1213
1314public class FramerateCommand {
1415
15- public static final IntSupplier MAX_REFRESH_RATE = () -> Minecraft .getInstance ().virtualScreen .screenManager .monitors .values ().stream ()
16+ public static final IntSupplier MAX_REFRESH_RATE = () -> Math . max ( Options . UNLIMITED_FRAMERATE_CUTOFF , Minecraft .getInstance ().virtualScreen .screenManager .monitors .values ().stream ()
1617 .mapToInt (monitor -> monitor .getCurrentMode ().getRefreshRate ())
17- .max ().orElseThrow ();
18+ .max ().orElseThrow ()) ;
1819
1920 public static void register (CommandDispatcher <FabricClientCommandSource > dispatcher ) {
2021 dispatcher .register (literal ("cfps" )
Original file line number Diff line number Diff line change 22
33import net .earthcomputer .clientcommands .command .FramerateCommand ;
44import net .minecraft .client .Minecraft ;
5+ import net .minecraft .client .Options ;
56import org .spongepowered .asm .mixin .Mixin ;
67import org .spongepowered .asm .mixin .injection .Constant ;
78import org .spongepowered .asm .mixin .injection .ModifyConstant ;
89
910@ Mixin (Minecraft .class )
1011public class MinecraftMixin {
11- @ ModifyConstant (method = "runTick" , constant = @ Constant (intValue = 260 ))
12- private int uncapFps (int original ) {
12+ @ ModifyConstant (method = "runTick" , constant = @ Constant (intValue = Options . UNLIMITED_FRAMERATE_CUTOFF ))
13+ private int changeCutoff (int original ) {
1314 return FramerateCommand .MAX_REFRESH_RATE .getAsInt ();
1415 }
1516}
You can’t perform that action at this time.
0 commit comments