Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FPSLock and Fullbright #73

Merged
merged 1 commit into from
Jun 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions src/main/java/com/matt/forgehax/mods/FPSLock.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@

@RegisterMod
public class FPSLock extends ToggleMod {
private final Setting<Integer> fps =

private final Setting<Integer> defaultFps =
getCommandStub()
.builders()
.<Integer>newSettingBuilder()
.name("default-fps")
.description("default FPS to revert to")
.defaultTo(MC.gameSettings.limitFramerate)
.min(1)
.build();

private final Setting<Integer> fps =
getCommandStub()
.builders()
.<Integer>newSettingBuilder()
Expand All @@ -38,7 +49,7 @@ public class FPSLock extends ToggleMod {
.name("no-focus-fps")
.description("FPS when the game window doesn't have focus. Set to 0 to disable.")
.min(0)
.defaultTo(1)
.defaultTo(3)
.build();

public FPSLock() {
Expand All @@ -51,13 +62,13 @@ public FPSLock() {

private int getFps() {
if (no_focus_fps.get() > 0 && !Display.isActive()) return no_focus_fps.get();
else if (getWorld() != null) return fps.get() > 0 ? fps.get() : MC.gameSettings.limitFramerate;
else return menu_fps.get() > 0 ? menu_fps.get() : MC.gameSettings.limitFramerate;
else if (MC.currentScreen != null) return menu_fps.get() > 0 ? menu_fps.get() : defaultFps.get();
else return fps.get() > 0 ? fps.get() : defaultFps.get();
}

@Override
protected void onDisabled() {
MC.gameSettings.limitFramerate = 60;
MC.gameSettings.limitFramerate = defaultFps.get();
}

@SubscribeEvent
Expand Down
14 changes: 13 additions & 1 deletion src/main/java/com/matt/forgehax/mods/FullBrightMod.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.matt.forgehax.mods;

import com.matt.forgehax.util.command.Setting;
import com.matt.forgehax.util.mod.Category;
import com.matt.forgehax.util.mod.ToggleMod;
import com.matt.forgehax.util.mod.loader.RegisterMod;
Expand All @@ -12,14 +13,25 @@ public FullBrightMod() {
super(Category.WORLD, "FullBright", false, "Makes everything render with maximum brightness");
}

private final Setting<Float> defaultGamma =
getCommandStub()
.builders()
.<Float>newSettingBuilder()
.name("gamma")
.description("default gamma to revert to")
.defaultTo(MC.gameSettings.gammaSetting)
.min(0.1F)
.max(16F)
.build();

@Override
public void onEnabled() {
MC.gameSettings.gammaSetting = 16F;
}

@Override
public void onDisabled() {
MC.gameSettings.gammaSetting = 1F;
MC.gameSettings.gammaSetting = defaultGamma.get();
}

@SubscribeEvent
Expand Down