Skip to content

Commit

Permalink
Merge pull request #24 from srockw/toggle-overlay
Browse files Browse the repository at this point in the history
Add options to hide overlay and landing blocks
  • Loading branch information
kurrycat authored Jul 12, 2023
2 parents 336da6c + 2b7dd59 commit 251278c
Showing 1 changed file with 19 additions and 0 deletions.
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;

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

0 comments on commit 251278c

Please sign in to comment.