generated from MrSphay/codex-agent-repository-kit
64 lines
2.7 KiB
Java
64 lines
2.7 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package com.vinlanx.explosionoverhaul;
|
|
|
|
import com.vinlanx.explosionoverhaul.BlockIndexManager;
|
|
import com.vinlanx.explosionoverhaul.ScanInfoHUD;
|
|
import com.vinlanx.explosionoverhaul.client.ModKeyMappings;
|
|
import net.minecraft.client.Minecraft;
|
|
import net.minecraft.client.gui.GuiGraphics;
|
|
import net.minecraftforge.api.distmarker.Dist;
|
|
import net.minecraftforge.client.event.RenderGuiOverlayEvent;
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|
import net.minecraftforge.fml.common.Mod;
|
|
|
|
@Mod.EventBusSubscriber(value={Dist.CLIENT})
|
|
public class ScanPromptHUD {
|
|
private static boolean isVisible = false;
|
|
|
|
public static boolean isVisible() {
|
|
return isVisible;
|
|
}
|
|
|
|
public static void setVisible(boolean visible) {
|
|
isVisible = visible;
|
|
if (!visible) {
|
|
ScanInfoHUD.setVisible(false);
|
|
}
|
|
}
|
|
|
|
@SubscribeEvent
|
|
public static void onRenderGuiOverlay(RenderGuiOverlayEvent.Post event) {
|
|
if (!isVisible) {
|
|
return;
|
|
}
|
|
Minecraft mc = Minecraft.m_91087_();
|
|
if (mc.f_91074_ == null) {
|
|
return;
|
|
}
|
|
if (!mc.f_91074_.m_20310_(2) && !mc.m_91091_()) {
|
|
return;
|
|
}
|
|
GuiGraphics guiGraphics = event.getGuiGraphics();
|
|
String promptText = BlockIndexManager.isRescanMode() ? "Rescan all chunks?" : "Start chunk scanning?";
|
|
int x = 10;
|
|
int y = 10;
|
|
String key1Text = "[" + ModKeyMappings.ACCEPT_SCAN.m_90863_().getString() + "] = Yes";
|
|
String key2Text = "[" + ModKeyMappings.DECLINE_SCAN.m_90863_().getString() + "] = No";
|
|
String key3Text = "[" + ModKeyMappings.INFO_SCAN.m_90863_().getString() + "] = Info";
|
|
int maxWidth = Math.max(mc.f_91062_.m_92895_(promptText), mc.f_91062_.m_92895_("Press " + key1Text + ", " + key2Text + ", " + key3Text));
|
|
guiGraphics.m_280509_(x - 5, y - 5, x + maxWidth + 10, y + 35, Integer.MIN_VALUE);
|
|
guiGraphics.m_280488_(mc.f_91062_, promptText, x, y, 0xFFFFFF);
|
|
int currentX = x;
|
|
int textY = y + 12;
|
|
guiGraphics.m_280488_(mc.f_91062_, "Press ", currentX, textY, 0xFFFFFF);
|
|
guiGraphics.m_280488_(mc.f_91062_, key1Text, currentX += mc.f_91062_.m_92895_("Press "), textY, 65280);
|
|
guiGraphics.m_280488_(mc.f_91062_, ", ", currentX += mc.f_91062_.m_92895_(key1Text), textY, 0xFFFFFF);
|
|
guiGraphics.m_280488_(mc.f_91062_, key2Text, currentX += mc.f_91062_.m_92895_(", "), textY, 0xFF0000);
|
|
guiGraphics.m_280488_(mc.f_91062_, ", ", currentX += mc.f_91062_.m_92895_(key2Text), textY, 0xFFFFFF);
|
|
guiGraphics.m_280488_(mc.f_91062_, key3Text, currentX += mc.f_91062_.m_92895_(", "), textY, 0xFFFF00);
|
|
}
|
|
}
|
|
|