now able to toggle hud modules
This commit is contained in:
parent
8f6646b7e0
commit
90347f7476
5 changed files with 137 additions and 0 deletions
|
@ -0,0 +1,49 @@
|
|||
package me.kawaiizenbo.moonlight.ui.hud.editor;
|
||||
|
||||
import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
|
||||
public class HUDModuleButton
|
||||
{
|
||||
public HUDModule module;
|
||||
public int x, y, width, height = 0;
|
||||
|
||||
public HUDModuleButton(HUDModule module)
|
||||
{
|
||||
this.module = module;
|
||||
this.width = 124;
|
||||
this.height = 12;
|
||||
}
|
||||
|
||||
public void render(DrawContext drawContext, int mouseX, int mouseY, int x, int y, TextRenderer textRenderer)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
drawContext.fill(x, y, x + width, y + height, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222);
|
||||
drawContext.drawText(textRenderer, module.name, x+2, y+2, module.enabled ? 0x55FFFF : 0xFFFFFF, false);
|
||||
}
|
||||
|
||||
public boolean hovered(int mouseX, int mouseY)
|
||||
{
|
||||
return mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + height;
|
||||
}
|
||||
|
||||
public boolean mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
if (hovered(mouseX, mouseY))
|
||||
{
|
||||
if (button == 0)
|
||||
{
|
||||
module.toggle();
|
||||
}
|
||||
else if (button == 1)
|
||||
{
|
||||
// HUDModule Settings coming Soon TM
|
||||
//MinecraftClient.getInstance().setScreen(new SettingsScreen(module));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue