Skip to content
This repository has been archived by the owner on Feb 9, 2025. It is now read-only.

Commit

Permalink
Merge pull request #4 from kawaiizenbo/v0.4.0
Browse files Browse the repository at this point in the history
V0.4.0
  • Loading branch information
kawaiizenbo authored Jan 25, 2025
2 parents 2e01a65 + faf56e1 commit 995f452
Show file tree
Hide file tree
Showing 40 changed files with 238 additions and 187 deletions.
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.3
yarn_mappings=1.21.3+build.2
loader_version=0.16.9
minecraft_version=1.21.4
yarn_mappings=1.21.4+build.8
loader_version=0.16.10

# Mod Properties
mod_version = 0.3.1
mod_version = 0.4.0
maven_group = me.kawaiizenbo
archives_base_name = moonlight

# Dependencies
fabric_version=0.107.3+1.21.3
fabric_version=0.115.0+1.21.4
1 change: 1 addition & 0 deletions src/main/java/me/kawaiizenbo/moonlight/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public boolean doesConfigExist()
public void loadDefaultConfig()
{
ModuleManager.INSTANCE = new ModuleManager();
config.put("theme", 2);
Map<String, Object> mi = new HashMap<>();
for (Module m : ModuleManager.INSTANCE.modules)
{
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/me/kawaiizenbo/moonlight/Moonlight.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
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.theme.Theme;
import me.kawaiizenbo.moonlight.ui.clickgui.CategoryPane;
import me.kawaiizenbo.moonlight.ui.clickgui.ClickGUIScreen;
import me.kawaiizenbo.moonlight.ui.hud.HUDModule;
Expand All @@ -27,7 +28,9 @@ public class Moonlight implements ModInitializer
public static final Moonlight INSTANCE = new Moonlight();
public static final Logger LOGGER = LoggerFactory.getLogger("Moonlight");
public static final String clientTag = ColorUtils.aqua + "Moonlight Meadows";
public static final String versionTag = ColorUtils.magenta + "v0.3.1";
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();

@Override
Expand All @@ -44,6 +47,8 @@ public void loadConfig()
{
LOGGER.info("Loading config...");
CONFIG.load();
THEME_IDX = ((Double)CONFIG.config.get("theme")).intValue();
THEME = Theme.THEME_LIST[THEME_IDX];
for (Module m : ModuleManager.INSTANCE.modules)
{
m.enabled = (boolean)((Map<String, Object>)((Map<String, Object>)CONFIG.config.get("modules")).get(m.name)).get("enabled");
Expand Down Expand Up @@ -113,6 +118,7 @@ else if (s instanceof IndexSetting)
public void saveConfig()
{
LOGGER.info("Saving config...");
CONFIG.config.put("theme", THEME_IDX);
Map<String, Object> mi = new HashMap<>();
for (Module m : ModuleManager.INSTANCE.modules)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ private CommandManager() {
add(new Help());
add(new Toggle());
add(new Teleport());
add(new SettingCommand());
add(new Reset());
add(new DeathPos());
commands.sort(Comparator.comparing(Command::getName));
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.kawaiizenbo.moonlight.module.settings;

import me.kawaiizenbo.moonlight.Moonlight;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.text.Text;
Expand All @@ -18,10 +19,10 @@ public BooleanSetting(String name, boolean value)
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);
drawContext.fill(x+180, y+7, x+190, y+17, 0xFFFFFFFF);
drawContext.fill(x+181, y+8, x+189, y+16, 0xFF222222);
drawContext.fill(x+182, y+9, x+188, y+15, value ? 0xFF55FFFF : 0xFF222222);
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, Moonlight.THEME.border.getRGB());
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 ? Moonlight.THEME.accent.getRGB() : Moonlight.THEME.background.getRGB());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.kawaiizenbo.moonlight.module.settings;

import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.util.MathUtils;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
Expand All @@ -26,7 +27,7 @@ public DoubleSetting(String name, double value, double min, double max, int roun
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+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));

if (sliding)
Expand All @@ -43,11 +44,11 @@ public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY
}

String valueString = ""+MathUtils.round(value, roundingPlace);
drawContext.drawTextWithShadow(textRenderer, Text.literal(valueString), (x+190)-textRenderer.getWidth(valueString), y+4, 0xFFFFFF);
drawContext.fill(x+2, y+16, x+190, y+18, 0xFF666666);
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, 0xFF777777);
int scaledValue = (int)((value/max)*190);
drawContext.fill(x+2, y+16, (x+2)+scaledValue, y+18, 0xFF55FFFF);
drawContext.fill(x+2+(scaledValue-1), y+14, x+2+(scaledValue+1), y+20, 0xFFFFFFFF);
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, Moonlight.THEME.border.getRGB());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
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.gui.DrawContext;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.text.Text;

public class IndexSetting extends Setting
Expand All @@ -20,10 +23,11 @@ public IndexSetting(String name, int index, String... elements)
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);
drawContext.fill(x+96, y+5, x+190, y+19, 0xFFFFFFFF);
drawContext.fill(x+97, y+6, x+189, y+18, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222);
drawContext.drawTextWithShadow(textRenderer, elements[index], x+98, 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, Moonlight.THEME.border.getRGB());
drawContext.fill(x+97, y+6, x+189, y+18, hovered(mouseX, mouseY) ? Moonlight.THEME.hover.getRGB() : Moonlight.THEME.background.getRGB());
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.lwjgl.glfw.GLFW;

import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.util.KeycodeUtils;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
Expand Down Expand Up @@ -36,19 +37,19 @@ public void mouseClicked(double mouseX, double mouseY, int button)
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);
drawContext.drawText(textRenderer, Text.literal(name), x+2, y+8, Moonlight.THEME.text.getRGB(), false);
if (isWaiting)
{
String waiting = "Press any key.";
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
{
String key = KeycodeUtils.keyTable[value];
if (value == GLFW.GLFW_KEY_UNKNOWN) 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);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.kawaiizenbo.moonlight.module.settings;

import me.kawaiizenbo.moonlight.Moonlight;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;

Expand All @@ -12,7 +13,7 @@ public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY
{
this.x = x;
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());

}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.kawaiizenbo.moonlight.module.settings;

import me.kawaiizenbo.moonlight.Moonlight;
import me.kawaiizenbo.moonlight.util.KeycodeUtils;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
Expand All @@ -20,13 +21,13 @@ public StringSetting(String name, String value)
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);
drawContext.drawText(textRenderer, Text.literal(name), x+2, y+8, Moonlight.THEME.text.getRGB(), false);
int twidth = textRenderer.getWidth(value);
drawContext.fill(x+96, y+5, x+190, y+19, 0xFFFFFFFF);
drawContext.fill(x+97, y+6, x+189, y+18, 0xFF222222);
drawContext.fill(x+96, y+5, x+190, y+19, Moonlight.THEME.border.getRGB());
drawContext.fill(x+97, y+6, x+189, y+18, Moonlight.THEME.background.getRGB());
int cursorPos = x+98+twidth;
if (focused) drawContext.fill(cursorPos, y+7, cursorPos+1, y+17, 0xFF55FFFF);
drawContext.drawTextWithShadow(textRenderer, value, x+98, y+8, 0xFFFFFF);
if (focused) drawContext.fill(cursorPos, y+7, cursorPos+1, y+17, Moonlight.THEME.accent.getRGB());
drawContext.drawText(textRenderer, value, x+98, y+8, Moonlight.THEME.text.getRGB(), false);
}

@Override
Expand Down
Loading

0 comments on commit 995f452

Please sign in to comment.