diff --git a/gradle.properties b/gradle.properties index 4ef2816..7ee8ad1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/src/main/java/me/kawaiizenbo/moonlight/Moonlight.java b/src/main/java/me/kawaiizenbo/moonlight/Moonlight.java index 784d21e..ad1d6dc 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/Moonlight.java +++ b/src/main/java/me/kawaiizenbo/moonlight/Moonlight.java @@ -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; diff --git a/src/main/java/me/kawaiizenbo/moonlight/command/CommandManager.java b/src/main/java/me/kawaiizenbo/moonlight/command/CommandManager.java index 8713ec2..c824b9e 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/command/CommandManager.java +++ b/src/main/java/me/kawaiizenbo/moonlight/command/CommandManager.java @@ -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)); } diff --git a/src/main/java/me/kawaiizenbo/moonlight/command/commands/DeathPos.java b/src/main/java/me/kawaiizenbo/moonlight/command/commands/DeathPos.java new file mode 100644 index 0000000..665f609 --- /dev/null +++ b/src/main/java/me/kawaiizenbo/moonlight/command/commands/DeathPos.java @@ -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 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; + }); + } +} diff --git a/src/main/java/me/kawaiizenbo/moonlight/command/commands/Help.java b/src/main/java/me/kawaiizenbo/moonlight/command/commands/Help.java index d4ccae3..c1601fa 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/command/commands/Help.java +++ b/src/main/java/me/kawaiizenbo/moonlight/command/commands/Help.java @@ -14,19 +14,19 @@ public class Help extends Command { super("help", "Gives you a list of all of the commands"); } - + @Override public void build(LiteralArgumentBuilder builder) { 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; - }); - + }); } - } diff --git a/src/main/java/me/kawaiizenbo/moonlight/command/commands/Toggle.java b/src/main/java/me/kawaiizenbo/moonlight/command/commands/Toggle.java index a63f810..7153f76 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/command/commands/Toggle.java +++ b/src/main/java/me/kawaiizenbo/moonlight/command/commands/Toggle.java @@ -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; })); diff --git a/src/main/java/me/kawaiizenbo/moonlight/mixin/KeyboardMixin.java b/src/main/java/me/kawaiizenbo/moonlight/mixin/KeyboardMixin.java index 647fe00..079b1f5 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/mixin/KeyboardMixin.java +++ b/src/main/java/me/kawaiizenbo/moonlight/mixin/KeyboardMixin.java @@ -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(); } diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/Category.java b/src/main/java/me/kawaiizenbo/moonlight/module/Category.java index da15fac..ad4ad63 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/module/Category.java +++ b/src/main/java/me/kawaiizenbo/moonlight/module/Category.java @@ -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; diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/modules/Reach.java b/src/main/java/me/kawaiizenbo/moonlight/module/modules/Reach.java new file mode 100644 index 0000000..a767d55 --- /dev/null +++ b/src/main/java/me/kawaiizenbo/moonlight/module/modules/Reach.java @@ -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(). + } +} diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/modules/Speed.java b/src/main/java/me/kawaiizenbo/moonlight/module/modules/Speed.java index c9a934e..d77ad24 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/module/modules/Speed.java +++ b/src/main/java/me/kawaiizenbo/moonlight/module/modules/Speed.java @@ -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); } diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/CategoryPane.java b/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/CategoryPane.java index 695e3f0..bea9360 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/CategoryPane.java +++ b/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/CategoryPane.java @@ -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 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(); + 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; diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/ClickGUIScreen.java b/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/ClickGUIScreen.java index 8430540..423b2ff 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/ClickGUIScreen.java +++ b/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/ClickGUIScreen.java @@ -22,6 +22,7 @@ public class ClickGUIScreen extends Screen Map panePos = ((Map)Moonlight.CONFIG.config.get("panes")); for (Category category : Category.values()) { + if(category.name == "Special") continue; int xOffset = MathUtils.d2iSafe(((Map)panePos.get(category.name)).get("x")); int yOffset = MathUtils.d2iSafe(((Map)panePos.get(category.name)).get("y")); boolean collapsed = (boolean)((Map)panePos.get(category.name)).get("collapsed"); diff --git a/src/main/resources/assets/moonlight/chat.png b/src/main/resources/assets/moonlight/chat.png deleted file mode 100644 index 87aadee..0000000 Binary files a/src/main/resources/assets/moonlight/chat.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/combat.png b/src/main/resources/assets/moonlight/combat.png deleted file mode 100644 index 82fee53..0000000 Binary files a/src/main/resources/assets/moonlight/combat.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/player.png b/src/main/resources/assets/moonlight/player.png deleted file mode 100644 index 4cabe2e..0000000 Binary files a/src/main/resources/assets/moonlight/player.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/render.png b/src/main/resources/assets/moonlight/render.png deleted file mode 100644 index 08257ab..0000000 Binary files a/src/main/resources/assets/moonlight/render.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/chat.png b/src/main/resources/assets/moonlight/textures/gui/sprites/chat.png new file mode 100644 index 0000000..09aaee2 Binary files /dev/null and b/src/main/resources/assets/moonlight/textures/gui/sprites/chat.png differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/combat.png b/src/main/resources/assets/moonlight/textures/gui/sprites/combat.png new file mode 100644 index 0000000..1c3c01c Binary files /dev/null and b/src/main/resources/assets/moonlight/textures/gui/sprites/combat.png differ diff --git a/src/main/resources/assets/moonlight/movement.png b/src/main/resources/assets/moonlight/textures/gui/sprites/movement.png similarity index 100% rename from src/main/resources/assets/moonlight/movement.png rename to src/main/resources/assets/moonlight/textures/gui/sprites/movement.png diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/player.png b/src/main/resources/assets/moonlight/textures/gui/sprites/player.png new file mode 100644 index 0000000..514dfdb Binary files /dev/null and b/src/main/resources/assets/moonlight/textures/gui/sprites/player.png differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/render.png b/src/main/resources/assets/moonlight/textures/gui/sprites/render.png new file mode 100644 index 0000000..4124739 Binary files /dev/null and b/src/main/resources/assets/moonlight/textures/gui/sprites/render.png differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/world.png b/src/main/resources/assets/moonlight/textures/gui/sprites/world.png new file mode 100644 index 0000000..1ef0a88 Binary files /dev/null and b/src/main/resources/assets/moonlight/textures/gui/sprites/world.png differ diff --git a/src/main/resources/assets/moonlight/world.png b/src/main/resources/assets/moonlight/world.png deleted file mode 100644 index e1bef72..0000000 Binary files a/src/main/resources/assets/moonlight/world.png and /dev/null differ diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index cf8ea5c..e5bc7bd 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -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.",