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

Added Overlay Message when turning on/off light overlay #161

Open
wants to merge 1 commit into
base: 1.19
Choose a base branch
from
Open
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 @@ -5,12 +5,15 @@
import dev.architectury.injectables.annotations.ExpectPlatform;
import it.unimi.dsi.fastutil.longs.Long2ByteMap;
import it.unimi.dsi.fastutil.longs.Long2ByteOpenHashMap;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Holder;
import net.minecraft.network.chat.CommonComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
Expand Down Expand Up @@ -74,9 +77,11 @@ public void queueChunk(CubicChunkPos pos) {
}

public void tick(Minecraft minecraft) {
while (LightOverlay.enableOverlay.consumeClick())
while (LightOverlay.enableOverlay.consumeClick()) {
LightOverlay.enabled = !LightOverlay.enabled;

minecraft.gui.setOverlayMessage(Component.translatable("overlay.lightoverlay").append(": ").append(LightOverlay.enabled ? Component.literal(CommonComponents.OPTION_ON.getString()).withStyle(ChatFormatting.GREEN) : Component.literal(CommonComponents.OPTION_OFF.getString()).withStyle(ChatFormatting.RED)), false);
}

try {
ticks++;
if (minecraft.player == null || !LightOverlay.enabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"key.lightoverlay.category": "Light Overlay",
"key.lightoverlay.enable_overlay": "Toggle Light Overlay",
"description.lightoverlay.caching": "Caching is recommended if the reach is above 16 or if you are running on a potato.",
"overlay.lightoverlay": "Light Overlay",
"config.lightoverlay.general": "General",
"config.lightoverlay.reach": "Reach:",
"config.lightoverlay.caching": "Caching:",
Expand Down