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 3
3
import com .mojang .brigadier .CommandDispatcher ;
4
4
import net .fabricmc .fabric .api .client .command .v2 .FabricClientCommandSource ;
5
5
import net .minecraft .client .Minecraft ;
6
+ import net .minecraft .client .Options ;
6
7
import net .minecraft .network .chat .Component ;
7
8
8
9
import java .util .function .IntSupplier ;
12
13
13
14
public class FramerateCommand {
14
15
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 ()
16
17
.mapToInt (monitor -> monitor .getCurrentMode ().getRefreshRate ())
17
- .max ().orElseThrow ();
18
+ .max ().orElseThrow ()) ;
18
19
19
20
public static void register (CommandDispatcher <FabricClientCommandSource > dispatcher ) {
20
21
dispatcher .register (literal ("cfps" )
Original file line number Diff line number Diff line change 2
2
3
3
import net .earthcomputer .clientcommands .command .FramerateCommand ;
4
4
import net .minecraft .client .Minecraft ;
5
+ import net .minecraft .client .Options ;
5
6
import org .spongepowered .asm .mixin .Mixin ;
6
7
import org .spongepowered .asm .mixin .injection .Constant ;
7
8
import org .spongepowered .asm .mixin .injection .ModifyConstant ;
8
9
9
10
@ Mixin (Minecraft .class )
10
11
public 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 ) {
13
14
return FramerateCommand .MAX_REFRESH_RATE .getAsInt ();
14
15
}
15
16
}
You can’t perform that action at this time.
0 commit comments