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

Add options to hide overlay and landing blocks #24

Merged
merged 1 commit into from
Jul 12, 2023
Merged
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
19 changes: 19 additions & 0 deletions common/src/main/java/io/github/kurrycat/mpkmod/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import io.github.kurrycat.mpkmod.gui.screens.LandingBlockGuiScreen;
import io.github.kurrycat.mpkmod.gui.screens.main_gui.LabelConfiguration;
import io.github.kurrycat.mpkmod.gui.screens.main_gui.MainGuiScreen;
import io.github.kurrycat.mpkmod.gui.screens.options_gui.Option;
import io.github.kurrycat.mpkmod.gui.screens.options_gui.OptionsGuiScreen;
import io.github.kurrycat.mpkmod.landingblock.LandingBlock;
import io.github.kurrycat.mpkmod.modules.MPKModule;
Expand All @@ -30,6 +31,20 @@ public class Main implements MPKModule {
public static MainGuiScreen mainGUI;
public static InfoTree infoTree;

@Option.Field(
category = "labels",
displayName = "Display Overlay",
description = "Whether to show all the components on the overlay while playing"
)
public static boolean displayOverlay = true;

@Option.Field(
category = "landingblocks",
displayName = "Highlight Landing Blocks",
description = "Whether to highlight all enabled landing blocks"
)
public static boolean highlightLandingBlocks = true;

@Override
public void init() {
infoTree = InfoString.createInfoTree();
Expand Down Expand Up @@ -109,6 +124,8 @@ public void loaded() {
EventAPI.addListener(
EventAPI.EventListener.onRenderOverlay(
e -> {
if (!displayOverlay) return;

Profiler.startSection("components");
if (mainGUI != null) {
mainGUI.setSize(Renderer2D.getScaledSize());
Expand All @@ -126,6 +143,8 @@ public void loaded() {
EventAPI.addListener(
new EventAPI.EventListener<OnRenderWorldOverlayEvent>(
e -> {
if (!highlightLandingBlocks) return;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would work, but using the var as a default value for the visibility setting in the gui would probably be better, even if it would be more complicated


Profiler.startSection("renderLBOverlays");
LandingBlockGuiScreen.lbs.forEach(lb -> {
if (lb.enabled || lb.highlight && lb.boundingBox != null)
Expand Down