Compare commits

..

11 commits
v0.3.0 ... main

Author SHA1 Message Date
KawaiiZenbo
995f452c2f
Merge pull request #4 from kawaiizenbo/v0.4.0
V0.4.0
2025-01-25 11:31:23 -07:00
kawaiizenbo
faf56e1e16 1.21.4 2025-01-25 11:26:20 -07:00
kawaiizenbo
72ec2869b8 fix the shit that broke 2024-11-09 19:10:46 -07:00
KawaiiZenbo
75c83f0ca7
fuck it we ball
1.21.3 for 0.4.0
2024-11-09 18:09:27 -08:00
KawaiiZenbo
8abcd7341e
Merge branch 'v0.4.0' into v0.4.0-1.21.3 2024-11-09 18:07:54 -08:00
kawaiizenbo
2e01a65ab4 clean up ci 2024-11-09 18:55:24 -07:00
kawaiizenbo
8f9a6005f5 1.21.3 support 2024-11-09 18:47:28 -07:00
KawaiiZenbo
1b0729658d
Merge pull request #2 from kawaiizenbo/theme-test
make indexsetting visually distinct from stringsetting
2024-09-09 19:15:37 -07:00
kawaiizenbo
fd96ca5d42 make indexsetting visually distinct from stringsetting 2024-09-09 19:13:25 -07:00
kawaiizenbo
bd5573c48f many major changes, see store for details
- bump version to v0.4.0
- add theme support
- add high contrast and light themes
- remove settingcommand (broken)
- add icon variants for certain themes
- remove text shadows from interfaces other than the hud
2024-09-09 18:04:47 -07:00
KawaiiZenbo
854ce7201c
Merge pull request #1 from kawaiizenbo/v0.3.0
v0.3.0
2024-09-09 13:14:31 -07:00
47 changed files with 264 additions and 218 deletions

View file

@ -1,8 +1,3 @@
# Automatically build the project and run any configured tests for every push
# and submitted pull request. This can help catch issues that only occur on
# certain platforms or Java versions, and provides a first line of defence
# against bad commits.
name: build name: build
on: [pull_request, push] on: [pull_request, push]
@ -10,12 +5,11 @@ jobs:
build: build:
strategy: strategy:
matrix: matrix:
# Use these Java versions
java: [ java: [
21, # Current Java LTS & minimum supported by Minecraft 21, # java version used since 1.20.5
] ]
# and run on both Linux and Windows # only linux
os: [ubuntu-22.04] os: [ubuntu-latest]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: checkout repository - name: checkout repository
@ -28,12 +22,10 @@ jobs:
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
distribution: 'microsoft' distribution: 'microsoft'
- name: make gradle wrapper executable - name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew run: chmod +x ./gradlew
- name: build - name: build
run: ./gradlew build run: ./gradlew build
- name: capture build artifacts - name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '21' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: Artifacts name: Artifacts

View file

@ -1,5 +1,5 @@
plugins { plugins {
id 'fabric-loom' version '1.6-SNAPSHOT' id 'fabric-loom' version '1.8-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
} }

View file

@ -4,14 +4,14 @@ org.gradle.parallel=true
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/develop # check these on https://fabricmc.net/develop
minecraft_version=1.21.1 minecraft_version=1.21.4
yarn_mappings=1.21.1+build.3 yarn_mappings=1.21.4+build.8
loader_version=0.16.3 loader_version=0.16.10
# Mod Properties # Mod Properties
mod_version = 0.3.0 mod_version = 0.4.0
maven_group = me.kawaiizenbo maven_group = me.kawaiizenbo
archives_base_name = moonlight archives_base_name = moonlight
# Dependencies # Dependencies
fabric_version=0.103.0+1.21.1 fabric_version=0.115.0+1.21.4

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View file

@ -44,6 +44,7 @@ public class Config
public void loadDefaultConfig() public void loadDefaultConfig()
{ {
ModuleManager.INSTANCE = new ModuleManager(); ModuleManager.INSTANCE = new ModuleManager();
config.put("theme", 2);
Map<String, Object> mi = new HashMap<>(); Map<String, Object> mi = new HashMap<>();
for (Module m : ModuleManager.INSTANCE.modules) for (Module m : ModuleManager.INSTANCE.modules)
{ {

View file

@ -16,6 +16,7 @@ import me.kawaiizenbo.moonlight.module.settings.IndexSetting;
import me.kawaiizenbo.moonlight.module.settings.KeycodeSetting; import me.kawaiizenbo.moonlight.module.settings.KeycodeSetting;
import me.kawaiizenbo.moonlight.module.settings.Setting; import me.kawaiizenbo.moonlight.module.settings.Setting;
import me.kawaiizenbo.moonlight.module.settings.StringSetting; import me.kawaiizenbo.moonlight.module.settings.StringSetting;
import me.kawaiizenbo.moonlight.theme.Theme;
import me.kawaiizenbo.moonlight.ui.clickgui.CategoryPane; import me.kawaiizenbo.moonlight.ui.clickgui.CategoryPane;
import me.kawaiizenbo.moonlight.ui.clickgui.ClickGUIScreen; import me.kawaiizenbo.moonlight.ui.clickgui.ClickGUIScreen;
import me.kawaiizenbo.moonlight.ui.hud.HUDModule; import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
@ -27,7 +28,9 @@ public class Moonlight implements ModInitializer
public static final Moonlight INSTANCE = new Moonlight(); public static final Moonlight INSTANCE = new Moonlight();
public static final Logger LOGGER = LoggerFactory.getLogger("Moonlight"); public static final Logger LOGGER = LoggerFactory.getLogger("Moonlight");
public static final String clientTag = ColorUtils.aqua + "Moonlight Meadows"; public static final String clientTag = ColorUtils.aqua + "Moonlight Meadows";
public static final String versionTag = ColorUtils.magenta + "v0.3.0"; public static final String versionTag = ColorUtils.magenta + "v0.4.0";
public static Theme THEME = Theme.DARK;
public static int THEME_IDX = 2;
public static Config CONFIG = new Config(); public static Config CONFIG = new Config();
@Override @Override
@ -44,6 +47,8 @@ public class Moonlight implements ModInitializer
{ {
LOGGER.info("Loading config..."); LOGGER.info("Loading config...");
CONFIG.load(); CONFIG.load();
THEME_IDX = ((Double)CONFIG.config.get("theme")).intValue();
THEME = Theme.THEME_LIST[THEME_IDX];
for (Module m : ModuleManager.INSTANCE.modules) for (Module m : ModuleManager.INSTANCE.modules)
{ {
m.enabled = (boolean)((Map<String, Object>)((Map<String, Object>)CONFIG.config.get("modules")).get(m.name)).get("enabled"); m.enabled = (boolean)((Map<String, Object>)((Map<String, Object>)CONFIG.config.get("modules")).get(m.name)).get("enabled");
@ -113,6 +118,7 @@ public class Moonlight implements ModInitializer
public void saveConfig() public void saveConfig()
{ {
LOGGER.info("Saving config..."); LOGGER.info("Saving config...");
CONFIG.config.put("theme", THEME_IDX);
Map<String, Object> mi = new HashMap<>(); Map<String, Object> mi = new HashMap<>();
for (Module m : ModuleManager.INSTANCE.modules) for (Module m : ModuleManager.INSTANCE.modules)
{ {

View file

@ -29,7 +29,6 @@ public class CommandManager
add(new Help()); add(new Help());
add(new Toggle()); add(new Toggle());
add(new Teleport()); add(new Teleport());
add(new SettingCommand());
add(new Reset()); add(new Reset());
add(new DeathPos()); add(new DeathPos());
commands.sort(Comparator.comparing(Command::getName)); commands.sort(Comparator.comparing(Command::getName));

View file

@ -1,115 +0,0 @@
package me.kawaiizenbo.moonlight.command.commands;
import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import me.kawaiizenbo.moonlight.command.Command;
import me.kawaiizenbo.moonlight.module.ModuleManager;
import me.kawaiizenbo.moonlight.module.settings.BooleanSetting;
import me.kawaiizenbo.moonlight.module.settings.DoubleSetting;
import me.kawaiizenbo.moonlight.module.settings.KeycodeSetting;
import me.kawaiizenbo.moonlight.module.settings.Setting;
import me.kawaiizenbo.moonlight.module.settings.StringSetting;
import me.kawaiizenbo.moonlight.util.ChatUtils;
import me.kawaiizenbo.moonlight.util.ColorUtils;
import me.kawaiizenbo.moonlight.module.Module;
import net.minecraft.command.CommandSource;
public class SettingCommand extends Command
{
public SettingCommand()
{
super("setting", "Change a setting of a module.");
}
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder)
{
builder
.then(argument("module", StringArgumentType.string())
.then(argument("setting", StringArgumentType.string())
.then(argument("value", StringArgumentType.string())
.executes(context ->
{
String m = context.getArgument("module", String.class);
String s = context.getArgument("setting", String.class);
String v = context.getArgument("value", String.class);
Module module = ModuleManager.INSTANCE.getModuleByName(m);
if (module == null)
{
ChatUtils.sendMsg(ColorUtils.red + "Invalid Module Name");
return 0;
}
Setting setting = module.getSettingByName(s);
if (setting == null)
{
ChatUtils.sendMsg(ColorUtils.red + "Invalid Setting Name");
return 0;
}
if (setting instanceof BooleanSetting)
{
try
{
((BooleanSetting)setting).value = Boolean.parseBoolean(v);
}
catch (Exception e)
{
ChatUtils.sendMsg(ColorUtils.red + "Invalid Value, expected boolean");
return 0;
}
}
else if (setting instanceof DoubleSetting)
{
try
{
((DoubleSetting)setting).value = Double.parseDouble(v);
}
catch (Exception e)
{
ChatUtils.sendMsg(ColorUtils.red + "Invalid Value, expected Double");
return 0;
}
}
else if (setting instanceof StringSetting)
{
try
{
((StringSetting)setting).value = v;
}
catch (Exception e)
{
ChatUtils.sendMsg(ColorUtils.red + "Invalid Value, expected String");
return 0;
}
}
else if (setting instanceof KeycodeSetting)
{
try
{
int kv = Integer.parseInt(v);
if (kv > 348)
{
ChatUtils.sendMsg(ColorUtils.red + "Keycode Value is too high, maximum is 348 (Menu)");
return 0;
}
if (kv < 0)
{
ChatUtils.sendMsg(ColorUtils.red + "Keycode Value must be positive");
return 0;
}
((KeycodeSetting)setting).value = kv;
}
catch (Exception e)
{
ChatUtils.sendMsg(ColorUtils.red + "Invalid Value, expected Keycode (integer)");
return 0;
}
}
return SINGLE_SUCCESS;
}))));
}
}

View file

@ -14,6 +14,6 @@ public class NoFall extends Module
@Override @Override
public void tick() public void tick()
{ {
if(mc.player.fallDistance >= 2.5) mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(true)); if(mc.player.fallDistance >= 2.5) mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(true, false));
} }
} }

View file

@ -23,22 +23,22 @@ public class Reach extends Module
public void onEnable() public void onEnable()
{ {
super.onEnable(); super.onEnable();
oldBe = mc.player.getAttributeInstance(EntityAttributes.PLAYER_BLOCK_INTERACTION_RANGE).getBaseValue(); oldBe = mc.player.getAttributeInstance(EntityAttributes.BLOCK_INTERACTION_RANGE).getBaseValue();
oldEe = mc.player.getAttributeInstance(EntityAttributes.PLAYER_ENTITY_INTERACTION_RANGE).getBaseValue(); oldEe = mc.player.getAttributeInstance(EntityAttributes.ENTITY_INTERACTION_RANGE).getBaseValue();
} }
@Override @Override
public void tick() public void tick()
{ {
mc.player.getAttributeInstance(EntityAttributes.PLAYER_BLOCK_INTERACTION_RANGE).setBaseValue(blockRange.value); mc.player.getAttributeInstance(EntityAttributes.BLOCK_INTERACTION_RANGE).setBaseValue(blockRange.value);
mc.player.getAttributeInstance(EntityAttributes.PLAYER_ENTITY_INTERACTION_RANGE).setBaseValue(entityRange.value); mc.player.getAttributeInstance(EntityAttributes.ENTITY_INTERACTION_RANGE).setBaseValue(entityRange.value);
} }
@Override @Override
public void onDisable() public void onDisable()
{ {
super.onDisable(); super.onDisable();
mc.player.getAttributeInstance(EntityAttributes.PLAYER_BLOCK_INTERACTION_RANGE).setBaseValue(oldBe); mc.player.getAttributeInstance(EntityAttributes.BLOCK_INTERACTION_RANGE).setBaseValue(oldBe);
mc.player.getAttributeInstance(EntityAttributes.PLAYER_ENTITY_INTERACTION_RANGE).setBaseValue(oldEe); mc.player.getAttributeInstance(EntityAttributes.ENTITY_INTERACTION_RANGE).setBaseValue(oldEe);
} }
} }

View file

@ -20,20 +20,20 @@ public class Speed extends Module
public void onEnable() public void onEnable()
{ {
super.onEnable(); super.onEnable();
old = mc.player.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED).getBaseValue(); old = mc.player.getAttributeInstance(EntityAttributes.MOVEMENT_SPEED).getBaseValue();
} }
@Override @Override
public void tick() public void tick()
{ {
mc.player.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED).setBaseValue(speed.value/10d); mc.player.getAttributeInstance(EntityAttributes.MOVEMENT_SPEED).setBaseValue(speed.value/10d);
} }
@Override @Override
public void onDisable() public void onDisable()
{ {
super.onDisable(); super.onDisable();
mc.player.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED).setBaseValue(old); mc.player.getAttributeInstance(EntityAttributes.MOVEMENT_SPEED).setBaseValue(old);
} }
} }

View file

@ -20,19 +20,19 @@ public class Step extends Module
public void onEnable() public void onEnable()
{ {
super.onEnable(); super.onEnable();
old = mc.player.getAttributeInstance(EntityAttributes.GENERIC_STEP_HEIGHT).getBaseValue(); old = mc.player.getAttributeInstance(EntityAttributes.STEP_HEIGHT).getBaseValue();
} }
@Override @Override
public void tick() public void tick()
{ {
mc.player.getAttributeInstance(EntityAttributes.GENERIC_STEP_HEIGHT).setBaseValue(stepHeight.value); mc.player.getAttributeInstance(EntityAttributes.STEP_HEIGHT).setBaseValue(stepHeight.value);
} }
@Override @Override
public void onDisable() public void onDisable()
{ {
super.onDisable(); super.onDisable();
mc.player.getAttributeInstance(EntityAttributes.GENERIC_STEP_HEIGHT).setBaseValue(old); mc.player.getAttributeInstance(EntityAttributes.STEP_HEIGHT).setBaseValue(old);
} }
} }

View file

@ -1,5 +1,6 @@
package me.kawaiizenbo.moonlight.module.settings; package me.kawaiizenbo.moonlight.module.settings;
import me.kawaiizenbo.moonlight.Moonlight;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.text.Text; import net.minecraft.text.Text;
@ -18,10 +19,10 @@ public class BooleanSetting extends Setting
public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer) public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer)
{ {
super.render(drawContext, x, y, mouseX, mouseY, textRenderer); super.render(drawContext, x, y, mouseX, mouseY, textRenderer);
drawContext.drawTextWithShadow(textRenderer, Text.literal(name), x+2, y+8, 0xFFFFFF); drawContext.drawText(textRenderer, Text.literal(name), x+2, y+8, Moonlight.THEME.text.getRGB(), false);
drawContext.fill(x+180, y+7, x+190, y+17, 0xFFFFFFFF); drawContext.fill(x+180, y+7, x+190, y+17, Moonlight.THEME.border.getRGB());
drawContext.fill(x+181, y+8, x+189, y+16, 0xFF222222); drawContext.fill(x+181, y+8, x+189, y+16, Moonlight.THEME.background.getRGB());
drawContext.fill(x+182, y+9, x+188, y+15, value ? 0xFF55FFFF : 0xFF222222); drawContext.fill(x+182, y+9, x+188, y+15, value ? Moonlight.THEME.accent.getRGB() : Moonlight.THEME.background.getRGB());
} }
@Override @Override

View file

@ -1,5 +1,6 @@
package me.kawaiizenbo.moonlight.module.settings; package me.kawaiizenbo.moonlight.module.settings;
import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.util.MathUtils; import me.kawaiizenbo.moonlight.util.MathUtils;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
@ -26,7 +27,7 @@ public class DoubleSetting extends Setting
public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer) public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer)
{ {
super.render(drawContext, x, y, mouseX, mouseY, textRenderer); super.render(drawContext, x, y, mouseX, mouseY, textRenderer);
drawContext.drawTextWithShadow(textRenderer, Text.literal(name), x+2, y+4, 0xFFFFFF); drawContext.drawText(textRenderer, Text.literal(name), x+2, y+4, Moonlight.THEME.text.getRGB(), false);
double diff = Math.min(100, Math.max(0, (mouseX - x)/1.9)); double diff = Math.min(100, Math.max(0, (mouseX - x)/1.9));
if (sliding) if (sliding)
@ -43,11 +44,11 @@ public class DoubleSetting extends Setting
} }
String valueString = ""+MathUtils.round(value, roundingPlace); String valueString = ""+MathUtils.round(value, roundingPlace);
drawContext.drawTextWithShadow(textRenderer, Text.literal(valueString), (x+190)-textRenderer.getWidth(valueString), y+4, 0xFFFFFF); drawContext.drawText(textRenderer, Text.literal(valueString), (x+190)-textRenderer.getWidth(valueString), y+4, Moonlight.THEME.text.getRGB(), false);
drawContext.fill(x+2, y+16, x+190, y+18, 0xFF666666); drawContext.fill(x+2, y+16, x+190, y+18, 0xFF777777);
int scaledValue = (int)((value/max)*190); int scaledValue = (int)((value/max)*190);
drawContext.fill(x+2, y+16, (x+2)+scaledValue, y+18, 0xFF55FFFF); drawContext.fill(x+2, y+16, (x+2)+scaledValue, y+18, Moonlight.THEME.accent.getRGB());
drawContext.fill(x+2+(scaledValue-1), y+14, x+2+(scaledValue+1), y+20, 0xFFFFFFFF); drawContext.fill(x+2+(scaledValue-1), y+14, x+2+(scaledValue+1), y+20, Moonlight.THEME.border.getRGB());
} }
@Override @Override

View file

@ -1,7 +1,10 @@
package me.kawaiizenbo.moonlight.module.settings; package me.kawaiizenbo.moonlight.module.settings;
import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.util.DrawUtils;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.text.Text; import net.minecraft.text.Text;
public class IndexSetting extends Setting public class IndexSetting extends Setting
@ -20,10 +23,11 @@ public class IndexSetting extends Setting
public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer) public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer)
{ {
super.render(drawContext, x, y, mouseX, mouseY, textRenderer); super.render(drawContext, x, y, mouseX, mouseY, textRenderer);
drawContext.drawTextWithShadow(textRenderer, Text.literal(name), x+2, y+8, 0xFFFFFF); drawContext.drawText(textRenderer, Text.literal(name), x+2, y+8, Moonlight.THEME.text.getRGB(), false);
drawContext.fill(x+96, y+5, x+190, y+19, 0xFFFFFFFF); drawContext.fill(x+96, y+5, x+190, y+19, Moonlight.THEME.border.getRGB());
drawContext.fill(x+97, y+6, x+189, y+18, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222); drawContext.fill(x+97, y+6, x+189, y+18, hovered(mouseX, mouseY) ? Moonlight.THEME.hover.getRGB() : Moonlight.THEME.background.getRGB());
drawContext.drawTextWithShadow(textRenderer, elements[index], x+98, y+8, 0xFFFFFF); drawContext.drawText(textRenderer, elements[index], x+98, y+8, Moonlight.THEME.text.getRGB(), false);
drawContext.drawGuiTexture(RenderLayer::getGuiTextured, DrawUtils.getThemedGUIIcon("updown", Moonlight.THEME.background), x+177, y+6, 12, 12);
} }
@Override @Override

View file

@ -2,6 +2,7 @@ package me.kawaiizenbo.moonlight.module.settings;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.util.KeycodeUtils; import me.kawaiizenbo.moonlight.util.KeycodeUtils;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
@ -36,19 +37,19 @@ public class KeycodeSetting extends Setting
public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer) public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer)
{ {
super.render(drawContext, x, y, mouseX, mouseY, textRenderer); super.render(drawContext, x, y, mouseX, mouseY, textRenderer);
drawContext.drawTextWithShadow(textRenderer, Text.literal(name), x+2, y+8, 0xFFFFFF); drawContext.drawText(textRenderer, Text.literal(name), x+2, y+8, Moonlight.THEME.text.getRGB(), false);
if (isWaiting) if (isWaiting)
{ {
String waiting = "Press any key."; String waiting = "Press any key.";
int twwidth = textRenderer.getWidth(waiting); int twwidth = textRenderer.getWidth(waiting);
drawContext.drawTextWithShadow(textRenderer, waiting, x+190-twwidth, y+8, 0xFFFFFF); drawContext.drawText(textRenderer, waiting, x+190-twwidth, y+8, Moonlight.THEME.text.getRGB(), false);
} }
else else
{ {
String key = KeycodeUtils.keyTable[value]; String key = KeycodeUtils.keyTable[value];
if (value == GLFW.GLFW_KEY_UNKNOWN) key = ""; if (value == GLFW.GLFW_KEY_UNKNOWN) key = "";
int twidth = textRenderer.getWidth(key); int twidth = textRenderer.getWidth(key);
drawContext.drawTextWithShadow(textRenderer, key, x+190-twidth, y+8, 0xFFFFFF); drawContext.drawText(textRenderer, key, x+190-twidth, y+8, Moonlight.THEME.text.getRGB(), false);
} }
} }

View file

@ -1,5 +1,6 @@
package me.kawaiizenbo.moonlight.module.settings; package me.kawaiizenbo.moonlight.module.settings;
import me.kawaiizenbo.moonlight.Moonlight;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
@ -12,7 +13,7 @@ public class Setting
{ {
this.x = x; this.x = x;
this.y = y; this.y = y;
drawContext.fill(x, y, x+192, y+24, hovered(mouseX, mouseY) ? 0xFF444444: 0xFF222222); drawContext.fill(x, y, x+192, y+24, hovered(mouseX, mouseY) ? Moonlight.THEME.hover.getRGB(): Moonlight.THEME.background.getRGB());
} }

View file

@ -1,5 +1,6 @@
package me.kawaiizenbo.moonlight.module.settings; package me.kawaiizenbo.moonlight.module.settings;
import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.util.KeycodeUtils; import me.kawaiizenbo.moonlight.util.KeycodeUtils;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
@ -20,13 +21,13 @@ public class StringSetting extends Setting
public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer) public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer)
{ {
super.render(drawContext, x, y, mouseX, mouseY, textRenderer); super.render(drawContext, x, y, mouseX, mouseY, textRenderer);
drawContext.drawTextWithShadow(textRenderer, Text.literal(name), x+2, y+8, 0xFFFFFF); drawContext.drawText(textRenderer, Text.literal(name), x+2, y+8, Moonlight.THEME.text.getRGB(), false);
int twidth = textRenderer.getWidth(value); int twidth = textRenderer.getWidth(value);
drawContext.fill(x+96, y+5, x+190, y+19, 0xFFFFFFFF); drawContext.fill(x+96, y+5, x+190, y+19, Moonlight.THEME.border.getRGB());
drawContext.fill(x+97, y+6, x+189, y+18, 0xFF222222); drawContext.fill(x+97, y+6, x+189, y+18, Moonlight.THEME.background.getRGB());
int cursorPos = x+98+twidth; int cursorPos = x+98+twidth;
if (focused) drawContext.fill(cursorPos, y+7, cursorPos+1, y+17, 0xFF55FFFF); if (focused) drawContext.fill(cursorPos, y+7, cursorPos+1, y+17, Moonlight.THEME.accent.getRGB());
drawContext.drawTextWithShadow(textRenderer, value, x+98, y+8, 0xFFFFFF); drawContext.drawText(textRenderer, value, x+98, y+8, Moonlight.THEME.text.getRGB(), false);
} }
@Override @Override

View file

@ -0,0 +1,81 @@
package me.kawaiizenbo.moonlight.theme;
public class Theme
{
public static final Theme LIGHT = new Theme(
"Light",
new ThemeColor(0x222222),
new ThemeColor(0xFFFFFF),
new ThemeColor(0xFFFFFF),
new ThemeColor(0xDDDDDD),
new ThemeColor(0x00AAAA),
new ThemeColor(0x55FFFF),
new ThemeColor(0x222222),
false,
false
);
public static final Theme HIGHCONTRAST = new Theme(
"High Contrast",
new ThemeColor(0x000000),
new ThemeColor(0xFFFFFF),
new ThemeColor(0xFFFFFF),
new ThemeColor(0x777777),
new ThemeColor(0x00AAAA),
new ThemeColor(0xFFFFFF),
new ThemeColor(0x000000),
false,
true
);
public static final Theme DARK = new Theme(
"Dark",
new ThemeColor(0xFFFFFF),
new ThemeColor(0xFFFFFF),
new ThemeColor(0x222222),
new ThemeColor(0x333333),
new ThemeColor(0x55FFFF),
new ThemeColor(0x55FFFF),
new ThemeColor(0xFFFFFF),
false,
false
);
public static final Theme[] THEME_LIST =
{
LIGHT, HIGHCONTRAST, DARK
};
public String name;
public ThemeColor text;
public ThemeColor headerText;
public ThemeColor background;
public ThemeColor hover;
public ThemeColor accent;
public ThemeColor hudAccent;
public ThemeColor border;
public boolean useDarkIcons;
public boolean themedWindowBorders;
public Theme(
String name,
ThemeColor text,
ThemeColor headerText,
ThemeColor background,
ThemeColor hover,
ThemeColor accent,
ThemeColor hudAccent,
ThemeColor border,
boolean useDarkIcons,
boolean themedWindowBorders
)
{
this.name = name;
this.text = text;
this.headerText = headerText;
this.background = background;
this.hover = hover;
this.accent = accent;
this.hudAccent = hudAccent;
this.border = border;
this.useDarkIcons = useDarkIcons;
this.themedWindowBorders = themedWindowBorders;
}
}

View file

@ -0,0 +1,32 @@
package me.kawaiizenbo.moonlight.theme;
public class ThemeColor
{
public int r, g, b;
public ThemeColor(int r, int g, int b)
{
this.r = r;
this.g = g;
this.b = b;
}
public ThemeColor(int RGBcolor)
{
this.r = (RGBcolor&0x00FF0000)>>16;
this.g = (RGBcolor&0x0000FF00)>>8;
this.b = (RGBcolor&0x000000FF)>>0;
}
public int getRGB()
{
return ((255&0x0ff)<<24)|((r&0x0ff)<<16)|((g&0x0ff)<<8)|(b&0x0ff);
}
public void setRGB(int RGBcolor)
{
this.r = RGBcolor&0x00FF0000;
this.g = RGBcolor&0x0000FF00;
this.b = RGBcolor&0x000000FF;
}
}

View file

@ -1,5 +1,6 @@
package me.kawaiizenbo.moonlight.ui; package me.kawaiizenbo.moonlight.ui;
import me.kawaiizenbo.moonlight.Moonlight;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
@ -10,14 +11,13 @@ public class SetScreenButton
{ {
String text; String text;
Screen screen; Screen screen;
int x, y, color, width; int x, y, width;
public SetScreenButton(String text, int x, int y, int color, Screen screen) public SetScreenButton(String text, int x, int y, Screen screen)
{ {
this.text = text; this.text = text;
this.x = x; this.x = x;
this.y = y; this.y = y;
this.color = color;
this.screen = screen; this.screen = screen;
} }
@ -26,8 +26,8 @@ public class SetScreenButton
this.x = x; this.x = x;
this.y = y; this.y = y;
width = textRenderer.getWidth(text); width = textRenderer.getWidth(text);
drawContext.fill(x-1, y-1, x + width + 1, y + 10, hovered(mouseX, mouseY) ? 0x55FFFFFF : 0); drawContext.fill(x-1, y-1, x + width + 1, y + 10, hovered(mouseX, mouseY) ? 0x22222222 : 0);
drawContext.drawText(textRenderer, Text.literal(text), x, y, color, true); drawContext.drawText(textRenderer, Text.literal(text), x, y, Moonlight.THEME.headerText.getRGB(), false);
} }
public boolean hovered(int mouseX, int mouseY) public boolean hovered(int mouseX, int mouseY)

View file

@ -2,11 +2,14 @@ package me.kawaiizenbo.moonlight.ui.clickgui;
import java.util.ArrayList; import java.util.ArrayList;
import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.module.Category; import me.kawaiizenbo.moonlight.module.Category;
import me.kawaiizenbo.moonlight.module.ModuleManager; import me.kawaiizenbo.moonlight.module.ModuleManager;
import me.kawaiizenbo.moonlight.util.DrawUtils;
import me.kawaiizenbo.moonlight.module.Module; import me.kawaiizenbo.moonlight.module.Module;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public class CategoryPane public class CategoryPane
@ -26,7 +29,7 @@ public class CategoryPane
this.y = initialY; this.y = initialY;
this.collapsed = collapsed; this.collapsed = collapsed;
moduleButtons = new ArrayList<ModuleButton>(); moduleButtons = new ArrayList<ModuleButton>();
icon = Identifier.of("moonlight", category.name.toLowerCase()); icon = DrawUtils.getThemedGUIIcon(category.name.toLowerCase());
for (Module m : ModuleManager.INSTANCE.getModulesByCategory(category)) for (Module m : ModuleManager.INSTANCE.getModulesByCategory(category))
{ {
moduleButtons.add(new ModuleButton(m)); moduleButtons.add(new ModuleButton(m));
@ -42,10 +45,10 @@ public class CategoryPane
x = mouseX - startX; x = mouseX - startX;
y = mouseY - startY; y = mouseY - startY;
} }
drawContext.fill(x, y, x+width, collapsed ? y+16 : y+height, category.color); drawContext.fill(x, y, x+width, collapsed ? y+16 : y+height, Moonlight.THEME.themedWindowBorders ? Moonlight.THEME.border.getRGB() : category.color);
drawContext.fill(x+2, y+2, x+(width-2), y+14, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222); //drawContext.fill(x+2, y+2, x+(width-2), y+14, hovered(mouseX, mouseY) ? Moonlight.THEME.hover.getRGB() : Moonlight.THEME.background.getRGB());
drawContext.drawGuiTexture(icon, x+2, y+2, 12, 12); drawContext.drawGuiTexture(RenderLayer::getGuiTextured, icon, x+2, y+2, 12, 12);
drawContext.drawText(textRenderer, category.name, x+16, y+4, 0xFFFFFFFF, false); drawContext.drawText(textRenderer, category.name, x+16, y+4, Moonlight.THEME.headerText.getRGB(), false);
if (!collapsed) if (!collapsed)
{ {
int buttonYOffset = y+16; int buttonYOffset = y+16;

View file

@ -5,6 +5,7 @@ import java.util.Map;
import me.kawaiizenbo.moonlight.Moonlight; import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.module.Category; import me.kawaiizenbo.moonlight.module.Category;
import me.kawaiizenbo.moonlight.theme.Theme;
import me.kawaiizenbo.moonlight.util.MathUtils; import me.kawaiizenbo.moonlight.util.MathUtils;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
@ -35,6 +36,9 @@ public class ClickGUIScreen extends Screen
public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) public void render(DrawContext drawContext, int mouseX, int mouseY, float delta)
{ {
this.renderBackground(drawContext, mouseX, mouseY, delta); this.renderBackground(drawContext, mouseX, mouseY, delta);
drawContext.fill(width-80, height-16, width, height, Moonlight.THEME.border.getRGB());
drawContext.fill(width-78, height-14, width-2, height-2, (mouseX > width-80 && mouseY > height-16) ? Moonlight.THEME.hover.getRGB() : Moonlight.THEME.background.getRGB());
drawContext.drawText(textRenderer, "Change Theme", width-75, height-12, Moonlight.THEME.text.getRGB(), false);
for (CategoryPane category : categoryPanes) for (CategoryPane category : categoryPanes)
{ {
category.render(drawContext, mouseX, mouseY, delta, textRenderer); category.render(drawContext, mouseX, mouseY, delta, textRenderer);
@ -48,6 +52,12 @@ public class ClickGUIScreen extends Screen
{ {
category.mouseClicked((int) mouseX, (int) mouseY, button); category.mouseClicked((int) mouseX, (int) mouseY, button);
} }
if (mouseX > width-80 && mouseY > height-16)
{
if (Moonlight.THEME_IDX >= Theme.THEME_LIST.length-1) Moonlight.THEME_IDX = 0;
else Moonlight.THEME_IDX++;
Moonlight.THEME = Theme.THEME_LIST[Moonlight.THEME_IDX];
}
return super.mouseClicked(mouseX, mouseY, button); return super.mouseClicked(mouseX, mouseY, button);
} }

View file

@ -1,5 +1,6 @@
package me.kawaiizenbo.moonlight.ui.clickgui; package me.kawaiizenbo.moonlight.ui.clickgui;
import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.module.Module; import me.kawaiizenbo.moonlight.module.Module;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
@ -21,8 +22,8 @@ public class ModuleButton
{ {
this.x = x; this.x = x;
this.y = y; this.y = y;
drawContext.fill(x, y, x + width, y + height, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222); drawContext.fill(x, y, x + width, y + height, hovered(mouseX, mouseY) ? Moonlight.THEME.hover.getRGB() : Moonlight.THEME.background.getRGB());
drawContext.drawText(textRenderer, module.name, x+2, y+2, module.enabled ? 0x55FFFF : 0xFFFFFF, false); drawContext.drawText(textRenderer, module.name, x+2, y+2, module.enabled ? Moonlight.THEME.accent.getRGB() : Moonlight.THEME.text.getRGB(), false);
} }
public boolean hovered(int mouseX, int mouseY) public boolean hovered(int mouseX, int mouseY)

View file

@ -1,5 +1,6 @@
package me.kawaiizenbo.moonlight.ui.clickgui; package me.kawaiizenbo.moonlight.ui.clickgui;
import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.module.Module; import me.kawaiizenbo.moonlight.module.Module;
import me.kawaiizenbo.moonlight.module.settings.Setting; import me.kawaiizenbo.moonlight.module.settings.Setting;
import me.kawaiizenbo.moonlight.ui.SetScreenButton; import me.kawaiizenbo.moonlight.ui.SetScreenButton;
@ -21,8 +22,8 @@ public class SettingsScreen extends Screen
public SettingsScreen(Module module) public SettingsScreen(Module module)
{ {
super(Text.literal("Settings")); super(Text.literal("Settings"));
backButton = new SetScreenButton(ColorUtils.underline + "< Back", x+4, y+4, 0xFFFFFF, ClickGUIScreen.INSTANCE); backButton = new SetScreenButton(ColorUtils.underline + "< Back", x+4, y+4, ClickGUIScreen.INSTANCE);
editButton = new SetScreenButton(ColorUtils.underline + "Edit", x+windowWidth-22, y+4, 0xFFFFFF, HUDEditorScreen.INSTANCE); editButton = new SetScreenButton(ColorUtils.underline + "Edit", x+windowWidth-22, y+4, HUDEditorScreen.INSTANCE);
this.module = module; this.module = module;
} }
@ -37,11 +38,12 @@ public class SettingsScreen extends Screen
x = mouseX - startX; x = mouseX - startX;
y = mouseY - startY; y = mouseY - startY;
} }
drawContext.fill(x, y, x+windowWidth, y+windowHeight, 0xFF222222); drawContext.fill(x, y, x+windowWidth, y+windowHeight, Moonlight.THEME.themedWindowBorders ? Moonlight.THEME.border.getRGB() : module.category.color);
drawContext.fill(x, y, x+windowWidth, y+16, module.category.color); drawContext.fill(x+2, y+2, x+windowWidth-2, y+windowHeight-2, Moonlight.THEME.background.getRGB());
drawContext.fill(x+2, y+2, x+(windowWidth-2), y+14, 0xFF222222); drawContext.fill(x, y, x+windowWidth, y+16, Moonlight.THEME.themedWindowBorders ? Moonlight.THEME.border.getRGB() : module.category.color);
drawContext.drawCenteredTextWithShadow(textRenderer, module.name, x+(windowWidth/2), y+4, 0xFFFFFF); //drawContext.fill(x+2, y+2, x+(windowWidth-2), y+14, Moonlight.THEME.background.getRGB());
drawContext.drawText(textRenderer, module.description, x+8, y+24, 0xFFFFFF, true); drawContext.drawText(textRenderer, module.name, x+((windowWidth/2)-(textRenderer.getWidth(module.name)/2)), y+4, Moonlight.THEME.headerText.getRGB(), false);
drawContext.drawText(textRenderer, module.description, x+8, y+24, Moonlight.THEME.text.getRGB(), false);
backButton.render(drawContext, textRenderer, mouseX, mouseY, x+4, y+4); backButton.render(drawContext, textRenderer, mouseX, mouseY, x+4, y+4);
if (module.showEditButton) editButton.render(drawContext, textRenderer, mouseX, mouseY, x+windowWidth-22, y+4); if (module.showEditButton) editButton.render(drawContext, textRenderer, mouseX, mouseY, x+windowWidth-22, y+4);
int yOffset = y+40; int yOffset = y+40;

View file

@ -2,6 +2,7 @@ package me.kawaiizenbo.moonlight.ui.hud;
import java.util.ArrayList; import java.util.ArrayList;
import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.module.settings.Setting; import me.kawaiizenbo.moonlight.module.settings.Setting;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
@ -35,7 +36,7 @@ public abstract class HUDModule
x = mouseX - startX; x = mouseX - startX;
y = mouseY - startY; y = mouseY - startY;
} }
drawContext.fill(x-1, y-1, x+width+1, y+height+1, enabled ? 0xFF55FFFF : 0xFF555555); drawContext.fill(x-1, y-1, x+width+1, y+height+1, enabled ? Moonlight.THEME.accent.getRGB() : 0xFF555555);
drawContext.fill(x, y, x+width, y+height, 0xFF222222); drawContext.fill(x, y, x+width, y+height, 0xFF222222);
} }
} }

View file

@ -1,9 +1,11 @@
package me.kawaiizenbo.moonlight.ui.hud.editor; package me.kawaiizenbo.moonlight.ui.hud.editor;
import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.ui.hud.HUDModule; import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public class HUDModuleButton public class HUDModuleButton
@ -22,9 +24,9 @@ public class HUDModuleButton
{ {
this.x = x; this.x = x;
this.y = y; this.y = y;
drawContext.fill(x, y, x + width, y + height, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222); drawContext.fill(x, y, x + width, y + height, hovered(mouseX, mouseY) ? Moonlight.THEME.hover.getRGB() : Moonlight.THEME.background.getRGB());
drawContext.drawText(textRenderer, module.name, x+2, y+2, module.enabled ? 0x55FFFF : 0xFFFFFF, false); drawContext.drawText(textRenderer, module.name, x+2, y+2, module.enabled ? Moonlight.THEME.accent.getRGB() : Moonlight.THEME.text.getRGB(), false);
if (!module.settings.isEmpty()) drawContext.drawGuiTexture(Identifier.of("moonlight", "settings"), x+width-12, y, 12, 12); if (!module.settings.isEmpty()) drawContext.drawGuiTexture(RenderLayer::getGuiTextured, Identifier.of("moonlight", "settings"), x+width-12, y, 12, 12);
} }
public boolean hovered(int mouseX, int mouseY) public boolean hovered(int mouseX, int mouseY)

View file

@ -2,10 +2,13 @@ package me.kawaiizenbo.moonlight.ui.hud.editor;
import java.util.ArrayList; import java.util.ArrayList;
import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.ui.hud.HUDModule; import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
import me.kawaiizenbo.moonlight.ui.hud.HUDModuleManager; import me.kawaiizenbo.moonlight.ui.hud.HUDModuleManager;
import me.kawaiizenbo.moonlight.util.DrawUtils;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public class HUDModuleList public class HUDModuleList
@ -37,10 +40,10 @@ public class HUDModuleList
x = mouseX - startX; x = mouseX - startX;
y = mouseY - startY; y = mouseY - startY;
} }
drawContext.fill(x, y, x+width, collapsed ? y+16 : y+height, 0xFF55FFFF); drawContext.fill(x, y, x+width, collapsed ? y+16 : y+height, Moonlight.THEME.themedWindowBorders ? Moonlight.THEME.border.getRGB() : Moonlight.THEME.accent.getRGB());
drawContext.fill(x+2, y+2, x+(width-2), y+14, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222); //drawContext.fill(x+2, y+2, x+(width-2), y+14, hovered(mouseX, mouseY) ? Moonlight.THEME.hover.getRGB() : Moonlight.THEME.background.getRGB());
drawContext.drawGuiTexture(Identifier.of("moonlight", "hud"), x+2, y+2, 12, 12); drawContext.drawGuiTexture(RenderLayer::getGuiTextured, DrawUtils.getThemedGUIIcon("hud"), x+2, y+2, 12, 12);
drawContext.drawText(textRenderer, "HUD Modules", x+16, y+4, 0xFFFFFFFF, false); drawContext.drawText(textRenderer, "HUD Modules", x+16, y+4, Moonlight.THEME.headerText.getRGB(), false);
if (!collapsed) if (!collapsed)
{ {
int buttonYOffset = y+16; int buttonYOffset = y+16;

View file

@ -1,5 +1,6 @@
package me.kawaiizenbo.moonlight.ui.hud.editor; package me.kawaiizenbo.moonlight.ui.hud.editor;
import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.module.settings.Setting; import me.kawaiizenbo.moonlight.module.settings.Setting;
import me.kawaiizenbo.moonlight.ui.SetScreenButton; import me.kawaiizenbo.moonlight.ui.SetScreenButton;
import me.kawaiizenbo.moonlight.ui.hud.HUDModule; import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
@ -20,7 +21,7 @@ public class HUDModuleSettingsScreen extends Screen
public HUDModuleSettingsScreen(HUDModule module) public HUDModuleSettingsScreen(HUDModule module)
{ {
super(Text.literal("Settings")); super(Text.literal("Settings"));
backButton = new SetScreenButton(ColorUtils.underline + "< Back", x+4, y+4, 0xFFFFFF, HUDEditorScreen.INSTANCE); backButton = new SetScreenButton(ColorUtils.underline + "< Back", x+4, y+4, HUDEditorScreen.INSTANCE);
this.module = module; this.module = module;
} }
@ -35,10 +36,11 @@ public class HUDModuleSettingsScreen extends Screen
x = mouseX - startX; x = mouseX - startX;
y = mouseY - startY; y = mouseY - startY;
} }
drawContext.fill(x, y, x+windowWidth, y+windowHeight, 0xFF222222); drawContext.fill(x, y, x+windowWidth, y+windowHeight, Moonlight.THEME.themedWindowBorders ? Moonlight.THEME.border.getRGB() : Moonlight.THEME.accent.getRGB());
drawContext.fill(x, y, x+windowWidth, y+16, 0xFF55FFFF); drawContext.fill(x+2, y+2, x+windowWidth-2, y+windowHeight-2, Moonlight.THEME.background.getRGB());
drawContext.fill(x+2, y+2, x+(windowWidth-2), y+14, 0xFF222222); drawContext.fill(x, y, x+windowWidth, y+16, Moonlight.THEME.themedWindowBorders ? Moonlight.THEME.border.getRGB() : Moonlight.THEME.accent.getRGB());
drawContext.drawCenteredTextWithShadow(textRenderer, module.name, x+(windowWidth/2), y+4, 0xFFFFFF); //drawContext.fill(x+2, y+2, x+(windowWidth-2), y+14, Moonlight.THEME.background.getRGB());
drawContext.drawText(textRenderer, module.name, x+((windowWidth/2)-(textRenderer.getWidth(module.name)/2)), y+4, Moonlight.THEME.headerText.getRGB(), false);
backButton.render(drawContext, textRenderer, mouseX, mouseY, x+4, y+4); backButton.render(drawContext, textRenderer, mouseX, mouseY, x+4, y+4);
int yOffset = y+24; int yOffset = y+24;
for (Setting setting : module.settings) for (Setting setting : module.settings)

View file

@ -1,13 +1,9 @@
package me.kawaiizenbo.moonlight.ui.hud.modules; package me.kawaiizenbo.moonlight.ui.hud.modules;
import me.kawaiizenbo.moonlight.ui.hud.HUDModule; import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
import me.kawaiizenbo.moonlight.util.ColorUtils;
import me.kawaiizenbo.moonlight.util.MathUtils;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.math.Vec3d;
public class ArmorDisplay extends HUDModule public class ArmorDisplay extends HUDModule
{ {
@ -28,7 +24,7 @@ public class ArmorDisplay extends HUDModule
{ {
ItemStack piece = mc.player.getInventory().getStack(i); ItemStack piece = mc.player.getInventory().getStack(i);
drawContext.drawItem(piece, x, y+yOffset); drawContext.drawItem(piece, x, y+yOffset);
drawContext.drawItemInSlot(textRenderer, piece, x, y+yOffset); drawContext.drawStackOverlay(textRenderer, piece, x, y+yOffset);
yOffset += 16; yOffset += 16;
} }
} }

View file

@ -1,5 +1,6 @@
package me.kawaiizenbo.moonlight.ui.hud.modules; package me.kawaiizenbo.moonlight.ui.hud.modules;
import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.ui.hud.HUDModule; import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
import me.kawaiizenbo.moonlight.util.ColorUtils; import me.kawaiizenbo.moonlight.util.ColorUtils;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
@ -22,7 +23,7 @@ public class Coordinates extends HUDModule
drawContext.drawTextWithShadow(mc.textRenderer, drawContext.drawTextWithShadow(mc.textRenderer,
"X: " + ColorUtils.gray + String.format("%.1f", mc.player.getX()) + ColorUtils.reset + "X: " + ColorUtils.gray + String.format("%.1f", mc.player.getX()) + ColorUtils.reset +
" Y: " + ColorUtils.gray + String.format("%.1f", mc.player.getY()) + ColorUtils.reset + " Y: " + ColorUtils.gray + String.format("%.1f", mc.player.getY()) + ColorUtils.reset +
" Z: " + ColorUtils.gray + String.format("%.1f", mc.player.getZ()), x, y, 0xFF55FFFF " Z: " + ColorUtils.gray + String.format("%.1f", mc.player.getZ()), x, y, Moonlight.THEME.hudAccent.getRGB()
); );
} }
} }

View file

@ -1,5 +1,6 @@
package me.kawaiizenbo.moonlight.ui.hud.modules; package me.kawaiizenbo.moonlight.ui.hud.modules;
import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.ui.hud.HUDModule; import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
import me.kawaiizenbo.moonlight.util.ColorUtils; import me.kawaiizenbo.moonlight.util.ColorUtils;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
@ -19,6 +20,6 @@ public class FPS extends HUDModule
public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled) public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled)
{ {
super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled); super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled);
drawContext.drawTextWithShadow(mc.textRenderer, "FPS: " + ColorUtils.gray + mc.fpsDebugString.split(" ")[0], x, y, 0xFF55FFFF); drawContext.drawTextWithShadow(mc.textRenderer, "FPS: " + ColorUtils.gray + mc.fpsDebugString.split(" ")[0], x, y, Moonlight.THEME.hudAccent.getRGB());
} }
} }

View file

@ -1,5 +1,6 @@
package me.kawaiizenbo.moonlight.ui.hud.modules; package me.kawaiizenbo.moonlight.ui.hud.modules;
import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.ui.hud.HUDModule; import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
import me.kawaiizenbo.moonlight.util.ColorUtils; import me.kawaiizenbo.moonlight.util.ColorUtils;
import me.kawaiizenbo.moonlight.util.MathUtils; import me.kawaiizenbo.moonlight.util.MathUtils;
@ -21,7 +22,7 @@ public class MovementSpeed extends HUDModule
public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled) public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled)
{ {
super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled); super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled);
drawContext.drawTextWithShadow(mc.textRenderer, "Meters/s: " + ColorUtils.gray + MathUtils.round(moveSpeed(), 2), x, y, 0xFF55FFFF); drawContext.drawTextWithShadow(mc.textRenderer, "Meters/s: " + ColorUtils.gray + MathUtils.round(moveSpeed(), 2), x, y, Moonlight.THEME.hudAccent.getRGB());
} }
private double moveSpeed() private double moveSpeed()

View file

@ -1,5 +1,6 @@
package me.kawaiizenbo.moonlight.ui.hud.modules; package me.kawaiizenbo.moonlight.ui.hud.modules;
import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.ui.hud.HUDModule; import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
import me.kawaiizenbo.moonlight.util.ColorUtils; import me.kawaiizenbo.moonlight.util.ColorUtils;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
@ -19,6 +20,6 @@ public class Ping extends HUDModule
public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled) public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled)
{ {
super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled); super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled);
drawContext.drawTextWithShadow(mc.textRenderer, "Ping: " + ColorUtils.gray + (mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()) == null ? 0 : mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()).getLatency()), x, y, 0xFF55FFFF); drawContext.drawTextWithShadow(mc.textRenderer, "Ping: " + ColorUtils.gray + (mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()) == null ? 0 : mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()).getLatency()), x, y, Moonlight.THEME.hudAccent.getRGB());
} }
} }

View file

@ -1,14 +1,10 @@
package me.kawaiizenbo.moonlight.ui.hud.modules; package me.kawaiizenbo.moonlight.ui.hud.modules;
import me.kawaiizenbo.moonlight.ui.hud.HUDModule; import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
import me.kawaiizenbo.moonlight.util.ColorUtils;
import me.kawaiizenbo.moonlight.util.MathUtils;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.util.math.Vec3d;
public class TotemCounter extends HUDModule public class TotemCounter extends HUDModule
{ {

View file

@ -0,0 +1,21 @@
package me.kawaiizenbo.moonlight.util;
import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.theme.ThemeColor;
import net.minecraft.util.Identifier;
public class DrawUtils
{
public static Identifier getThemedGUIIcon(String textureName, ThemeColor invert)
{
boolean mode = ((invert.r + invert.g + invert.b) / 3) > 77;
String addition = mode ? "_light" : "";
return Identifier.of("moonlight", textureName+addition);
}
public static Identifier getThemedGUIIcon(String textureName)
{
String addition = Moonlight.THEME.useDarkIcons ? "_light" : "";
return Identifier.of("moonlight", textureName+addition);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

View file

@ -1,7 +1,7 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"id": "moonlight", "id": "moonlight",
"version": "v0.3.0", "version": "v0.4.0",
"name": "Moonlight Meadows", "name": "Moonlight Meadows",
"description": "Utility mod with a focus on stability.", "description": "Utility mod with a focus on stability.",
"authors": [ "authors": [
@ -29,9 +29,9 @@
], ],
"depends": { "depends": {
"fabricloader": ">=0.16.3", "fabricloader": ">=0.16.9",
"fabric-api": "*", "fabric-api": "*",
"minecraft": "~1.21.1", "minecraft": "~1.21.3",
"java": ">=21" "java": ">=21"
} }
} }