workshopping some stuff atm, doesnt work
This commit is contained in:
parent
ce8dd2ebed
commit
48547a2c66
6 changed files with 92 additions and 2 deletions
|
@ -3,6 +3,7 @@ package me.kawaiizenbo.moonlight.module;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import me.kawaiizenbo.moonlight.module.settings.BooleanSetting;
|
||||
import me.kawaiizenbo.moonlight.module.settings.KeycodeSetting;
|
||||
import me.kawaiizenbo.moonlight.module.settings.Setting;
|
||||
import me.kawaiizenbo.moonlight.ui.ModulesListOverlay;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
@ -19,6 +20,7 @@ public abstract class Module_
|
|||
public ArrayList<Setting> settings;
|
||||
|
||||
public BooleanSetting showInModulesList = new BooleanSetting("Show in Modules List", true);
|
||||
public KeycodeSetting keybind = new KeycodeSetting("Keybind", 0);
|
||||
|
||||
public Module_(String name, String description, Category category)
|
||||
{
|
||||
|
@ -27,6 +29,7 @@ public abstract class Module_
|
|||
this.category = category;
|
||||
settings = new ArrayList<>();
|
||||
settings.add(showInModulesList);
|
||||
settings.add(keybind);
|
||||
}
|
||||
|
||||
public void onEnable() { ModulesListOverlay.INSTANCE.update(); }
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.text.Text;
|
|||
|
||||
public class ColorSetting extends Setting
|
||||
{
|
||||
// this is unfinished, please use 3 DoubleSettings instead
|
||||
public int value;
|
||||
public int r;
|
||||
public int g;
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package me.kawaiizenbo.moonlight.module.settings;
|
||||
|
||||
import me.kawaiizenbo.moonlight.ui.clickgui.KeybindScreen;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
public class KeycodeSetting extends Setting
|
||||
{
|
||||
public int value;
|
||||
|
||||
public KeycodeSetting(String name, int value)
|
||||
{
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(double mouseX, double mouseY, int button)
|
||||
{
|
||||
if (hovered((int)mouseX, (int)mouseY) && button == 0)
|
||||
{
|
||||
KeybindScreen kbs = new KeybindScreen();
|
||||
MinecraftClient.getInstance().setScreen(kbs);
|
||||
this.value = kbs.returnedKeycode;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer)
|
||||
{
|
||||
super.render(drawContext, x, y, mouseX, mouseY, textRenderer);
|
||||
drawContext.drawTextWithShadow(textRenderer, Text.literal(name), x+2, y+8, 0xFFFFFF);
|
||||
String key = java.awt.event.KeyEvent.getKeyText(value);
|
||||
if (value == 0) key = "";
|
||||
int twidth = textRenderer.getWidth(key);
|
||||
drawContext.drawTextWithShadow(textRenderer, key, x+190-twidth, y+8, 0xFFFFFF);
|
||||
}
|
||||
}
|
|
@ -2,5 +2,11 @@ package me.kawaiizenbo.moonlight.module.settings;
|
|||
|
||||
public class StringSetting extends Setting
|
||||
{
|
||||
|
||||
public String value;
|
||||
|
||||
public StringSetting(String name, String value)
|
||||
{
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue