8000 + Hide Sidebar option for F3 Mode by MarcusSlover · Pull Request #81 · cominixo/BetterF3 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

+ Hide Sidebar option for F3 Mode #81

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

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@ private GeneralOptions() {
* Sets the background color.
*/
public static int backgroundColor = 0x6F505050;
/**
* Hides the sidebar while looking at F3.
*/
public static boolean hideSidebar = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ private ModConfigFile() {
general.set("animationSpeed", GeneralOptions.animationSpeed);
general.set("fontScale", GeneralOptions.fontScale);
general.set("background_color", GeneralOptions.backgroundColor);
general.set("hide_sidebar", GeneralOptions.hideSidebar);

final List<Config> configsLeft = new ArrayList<>();

Expand Down Expand Up @@ -230,6 +231,7 @@ public static void load(final FileType filetype) {
GeneralOptions.animationSpeed = general.getOrElse("animationSpeed", 1.0);
GeneralOptions.fontScale = general.getOrElse("fontScale", 1.0);
GeneralOptions.backgroundColor = general.getOrElse("background_color", 0x6F505050);
GeneralOptions.hideSidebar = general.getOrElse("hide_sidebar", true);
}

config.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ public static ConfigBuilder configBuilder(final Screen parent) {
.setSaveConsumer(newValue -> GeneralOptions.backgroundColor = newValue)
.build());

general.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.betterf3.sidebar"), GeneralOptions.hideSidebar)
.setDefaultValue(true)
.setTooltip(new TranslatableText("config.betterf3.sidebar.tooltip"))
.setSaveConsumer(newValue -> GeneralOptions.hideSidebar = newValue)
.build());

builder.transparentBackground();
return builder;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package me.cominixo.betterf3.mixin.scoreboard;

import me.cominixo.betterf3.config.GeneralOptions;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.hud.InGameHud;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

/**
* Mixin to cancel sidebar rendering during F3.
*/
@Mixin(InGameHud.class)
public class ScoreboardMixin {

@Shadow @Final private MinecraftClient client;

/**
* Cancels sidebar rendering during F3 if the hideSidebar setting is true.
*
* @param info Callback info
*/
@Inject(at = @At("HEAD"), method = "renderScoreboardSidebar", cancellable = true)
public void init(final CallbackInfo info) {
if (GeneralOptions.hideSidebar) {
if (this.client.options.debugEnabled) {
info.cancel();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Scoreboard related mixins.
*/
package me.cominixo.betterf3.mixin.scoreboard;
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/betterf3/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"config.betterf3.animations.tooltip": "Add an animation when closing and opening the F3 HUD.",
"config.betterf3.animationSpeed": "Animation Speed",
"config.betterf3.animationSpeed.tooltip": "Set the speed of the animation.",
"config.betterf3.sidebar": "Hide Sidebar",
"config.betterf3.sidebar.tooltip": "Hide sidebar during F3.",
"config.betterf3.fontScale": "Font Scale",
"config.betterf3.fontScale.tooltip": "Set the scale of the font.",
"config.betterf3.category.modules": "Modules",
Expand Down
3 changes: 2 additions & 1 deletion 7729 common/src/main/resources/betterf3.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"KeyboardMixin",
"chunk.ChunkBuilderMixin",
"chunk.ClientChunkMapMixin",
"chunk.ClientChunkManagerMixin"
"chunk.ClientChunkManagerMixin",
"scoreboard.ScoreboardMixin"
]
}
0