generated from MrSphay/codex-agent-repository-kit
Decompile upstream Explosion Overhaul 0.2.3.0
This commit is contained in:
62
com/vinlanx/explosionoverhaul/ScanLoadPromptHUD.java
Normal file
62
com/vinlanx/explosionoverhaul/ScanLoadPromptHUD.java
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.vinlanx.explosionoverhaul;
|
||||
|
||||
import com.vinlanx.explosionoverhaul.ScanLoadInfoHUD;
|
||||
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 ScanLoadPromptHUD {
|
||||
private static boolean isVisible = false;
|
||||
|
||||
public static boolean isVisible() {
|
||||
return isVisible;
|
||||
}
|
||||
|
||||
public static void setVisible(boolean visible) {
|
||||
isVisible = visible;
|
||||
if (!visible) {
|
||||
ScanLoadInfoHUD.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 = "Found existing scan data for this world!";
|
||||
int x = 10;
|
||||
int y = 10;
|
||||
String key1Text = "[" + ModKeyMappings.ACCEPT_SCAN.m_90863_().getString() + "] = Load Data";
|
||||
String key2Text = "[" + ModKeyMappings.DECLINE_SCAN.m_90863_().getString() + "] = New Scan";
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user