0.2.0 work in progress
This commit is contained in:
parent
08031c32ba
commit
c68631010d
24 changed files with 89 additions and 14 deletions
|
@ -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;
|
||||
});
|
||||
}
|
||||
}
|
|
@ -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<CommandSource> 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;
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue