0.2.0 work in progress

This commit is contained in:
kawaiizenbo 2024-01-14 11:27:19 -07:00
parent 08031c32ba
commit c68631010d
24 changed files with 89 additions and 14 deletions

View file

@ -9,7 +9,7 @@ org.gradle.parallel=true
loader_version=0.15.1
# Mod Properties
mod_version = 0.1.1
mod_version = 0.2.0
maven_group = me.kawaiizenbo
archives_base_name = moonlight

View file

@ -24,7 +24,7 @@ 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.1.1";
public static final String versionTag = ColorUtils.magenta + "v0.2.0";
public static Config CONFIG = new Config();
public static int uiColorA = 0xFF55FFFF;
public static int uiColor = 0x55FFFF;

View file

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

View file

@ -0,0 +1,44 @@
package me.kawaiizenbo.moonlight.command.commands;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import me.kawaiizenbo.moonlight.command.Command;
import me.kawaiizenbo.moonlight.command.CommandManager;
import me.kawaiizenbo.moonlight.util.ChatUtils;
import me.kawaiizenbo.moonlight.util.ColorUtils;
import net.minecraft.command.CommandSource;
import net.minecraft.util.math.GlobalPos;
public class DeathPos extends Command
{
public DeathPos()
{
super("deathpos", "Shows your last death position.");
}
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder)
{
builder.executes(context ->
{
GlobalPos pos = null;
try
{
pos = mc.player.getLastDeathPos().get();
if (pos == null) throw new Exception();
}
catch (Exception e)
{
ChatUtils.sendMsg(ColorUtils.reset + "You have not died in this world.");
return SINGLE_SUCCESS;
}
ChatUtils.sendMsg(ColorUtils.reset + "You last died at: " +
ColorUtils.aqua + " X: " + ColorUtils.gray + pos.getPos().getX() +
ColorUtils.aqua + " Y: " + ColorUtils.gray + pos.getPos().getY() +
ColorUtils.aqua + " Z: " + ColorUtils.gray + pos.getPos().getZ()
);
return SINGLE_SUCCESS;
});
}
}

View file

@ -20,13 +20,13 @@ public class Help extends Command
{
builder.executes(context ->
{
for (Command cmd : CommandManager.get().getAll()) {
for (Command cmd : CommandManager.get().getAll())
{
ChatUtils.sendMsg(ColorUtils.aqua + "Command: " + ColorUtils.gray + cmd.getName());
ChatUtils.sendMsg(ColorUtils.gray + cmd.getDescription());
ChatUtils.sendMsg(ColorUtils.gray + "");
}
return SINGLE_SUCCESS;
});
}
}

View file

@ -6,6 +6,7 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import me.kawaiizenbo.moonlight.command.Command;
import me.kawaiizenbo.moonlight.module.ModuleManager;
import me.kawaiizenbo.moonlight.module.Module;
import net.minecraft.client.MinecraftClient;
import net.minecraft.command.CommandSource;
public class Toggle extends Command
@ -13,7 +14,7 @@ public class Toggle extends Command
public Toggle()
{
super("toggle", "Toggle a module.");
super("toggle", "Toggle a module on or off.");
}
@Override
@ -24,7 +25,7 @@ public class Toggle extends Command
{
String m = context.getArgument("module", String.class);
Module module = ModuleManager.INSTANCE.getModuleByName(m);
module.toggle();
MinecraftClient.getInstance().send(() -> module.toggle());
return SINGLE_SUCCESS;
}));

View file

@ -25,7 +25,7 @@ public abstract class KeyboardMixin
if (key == GLFW.GLFW_KEY_RIGHT_ALT) MinecraftClient.getInstance().setScreen(ClickGUIScreen.INSTANCE);
for (Module m : ModuleManager.INSTANCE.modules)
{
if (key == m.keybind.value && action == GLFW.GLFW_PRESS)
if (key == m.keybind.value && action == GLFW.GLFW_PRESS && MinecraftClient.getInstance().currentScreen == null)
{
m.toggle();
}

View file

@ -7,7 +7,8 @@ public enum Category
RENDER("Render", 0xFF5555FF),
WORLD("World", 0xFF55FF55),
PLAYER("Player", 0xFF00AAAA),
CHAT("Chat", 0xFFFFAA00);
CHAT("Chat", 0xFFFFAA00),
SPECIAL("Special", 0xFFFFFFFF);
public String name;
public int color;

View file

@ -0,0 +1,20 @@
package me.kawaiizenbo.moonlight.module.modules;
import me.kawaiizenbo.moonlight.module.Category;
import me.kawaiizenbo.moonlight.module.Module;
public class Reach extends Module
{
public Reach()
{
super("Reach", "Extends player reach.", Category.PLAYER);
}
@Override
public void onEnable()
{
super.onEnable();
// this will be completed in 1.20.5, as a new attribute will be added to make this trivial.
// mc.player.getAbilities().
}
}

View file

@ -9,10 +9,12 @@ import net.minecraft.util.math.Vec3d;
public class Speed extends Module
{
float oldSpeed;
DoubleSetting speed = new DoubleSetting("Speed", 2, 0.1, 10, 1);
public Speed()
{
super("Speed", "Allows you to move faster.", Category.MOVEMENT);
super("Speed", "Allows you to move faster. (Deprecated)", Category.MOVEMENT);
settings.add(speed);
}

View file

@ -7,6 +7,7 @@ import me.kawaiizenbo.moonlight.module.ModuleManager;
import me.kawaiizenbo.moonlight.module.Module;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.util.Identifier;
public class CategoryPane
{
@ -16,6 +17,7 @@ public class CategoryPane
boolean dragging = false;
public boolean collapsed = false;
ArrayList<ModuleButton> moduleButtons;
Identifier icon;
public CategoryPane(Category category, int initialX, int initialY, boolean collapsed)
{
@ -24,6 +26,7 @@ public class CategoryPane
this.y = initialY;
this.collapsed = collapsed;
moduleButtons = new ArrayList<ModuleButton>();
icon = new Identifier("moonlight", category.name.toLowerCase());
for (Module m : ModuleManager.INSTANCE.getModulesByCategory(category))
{
moduleButtons.add(new ModuleButton(m));
@ -41,7 +44,8 @@ public class CategoryPane
}
drawContext.fill(x, y, x+width, collapsed ? y+16 : y+height, category.color);
drawContext.fill(x+2, y+2, x+(width-2), y+14, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222);
drawContext.drawText(textRenderer, category.name, x+4, y+4, 0xFFFFFFFF, false);
drawContext.drawGuiTexture(icon, x+2, y+2, 12, 12);
drawContext.drawText(textRenderer, category.name, x+16, y+4, 0xFFFFFFFF, false);
if (!collapsed)
{
int buttonYOffset = y+16;

View file

@ -22,6 +22,7 @@ public class ClickGUIScreen extends Screen
Map<String, Object> panePos = ((Map<String, Object>)Moonlight.CONFIG.config.get("panes"));
for (Category category : Category.values())
{
if(category.name == "Special") continue;
int xOffset = MathUtils.d2iSafe(((Map<String, Object>)panePos.get(category.name)).get("x"));
int yOffset = MathUtils.d2iSafe(((Map<String, Object>)panePos.get(category.name)).get("y"));
boolean collapsed = (boolean)((Map<String, Object>)panePos.get(category.name)).get("collapsed");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

View file

Before

Width:  |  Height:  |  Size: 181 B

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

View file

@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"id": "moonlight",
"version": "v0.1.1",
"version": "v0.2.0",
"name": "Moonlight Meadows",
"description": "Utility mod with a focus on stability.",