mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-29 13:04:59 +00:00
Tooltip support & Bug fix
This commit is contained in:
parent
892999ac98
commit
5e11ed3896
40 changed files with 8409 additions and 1987 deletions
|
|
@ -20,7 +20,7 @@ namespace MinecraftClient.Commands
|
|||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CmdName)
|
||||
.Then(l => l.Argument("Slot", Arguments.Integer(1, 9))
|
||||
.Then(l => l.Argument("Slot", MccArguments.HotbarSlot())
|
||||
.Executes(r => DoChangeSlot(r.Source, handler, Arguments.GetInteger(r, "Slot"))))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||
|
|
|
|||
|
|
@ -44,12 +44,12 @@ namespace MinecraftClient.Commands
|
|||
dispatcher.Register(l => l.Literal(CmdName)
|
||||
.Executes(r => ListAllInventories(r.Source, handler))
|
||||
.Then(l => l.Literal("creativegive")
|
||||
.Then(l => l.Argument("Slot", Arguments.Integer(0, 89))
|
||||
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
||||
.Then(l => l.Argument("ItemType", MccArguments.ItemType())
|
||||
.Then(l => l.Argument("Count", Arguments.Integer(min: 1))
|
||||
.Executes(r => DoCreativeGive(r.Source, handler, Arguments.GetInteger(r, "Slot"), MccArguments.GetItemType(r, "ItemType"), Arguments.GetInteger(r, "Count")))))))
|
||||
.Then(l => l.Literal("creativedelete")
|
||||
.Then(l => l.Argument("Slot", Arguments.Integer(0, 89))
|
||||
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
||||
.Executes(r => DoCreativeDelete(r.Source, handler, Arguments.GetInteger(r, "Slot")))))
|
||||
.Then(l => l.Literal("inventories")
|
||||
.Executes(r => ListAvailableInventories(r.Source, handler)))
|
||||
|
|
@ -64,12 +64,12 @@ namespace MinecraftClient.Commands
|
|||
.Then(l => l.Literal("list")
|
||||
.Executes(r => DoListAction(r.Source, handler, Arguments.GetInteger(r, "InventoryId"))))
|
||||
.Then(l => l.Literal("click")
|
||||
.Then(l => l.Argument("Slot", Arguments.Integer(0, 89))
|
||||
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
||||
.Executes(r => DoClickAction(r.Source, handler, Arguments.GetInteger(r, "InventoryId"), Arguments.GetInteger(r, "Slot"), WindowActionType.LeftClick))
|
||||
.Then(l => l.Argument("Action", MccArguments.InventoryAction())
|
||||
.Executes(r => DoClickAction(r.Source, handler, Arguments.GetInteger(r, "InventoryId"), Arguments.GetInteger(r, "Slot"), MccArguments.GetInventoryAction(r, "Action"))))))
|
||||
.Then(l => l.Literal("drop")
|
||||
.Then(l => l.Argument("Slot", Arguments.Integer(0, 89))
|
||||
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
||||
.Executes(r => DoDropAction(r.Source, handler, Arguments.GetInteger(r, "InventoryId"), Arguments.GetInteger(r, "Slot"), WindowActionType.DropItem))
|
||||
.Then(l => l.Literal("all")
|
||||
.Executes(r => DoDropAction(r.Source, handler, Arguments.GetInteger(r, "InventoryId"), Arguments.GetInteger(r, "Slot"), WindowActionType.DropItemStack))))))
|
||||
|
|
@ -77,12 +77,12 @@ namespace MinecraftClient.Commands
|
|||
.Then(l => l.Literal("list")
|
||||
.Executes(r => DoListAction(r.Source, handler, inventoryId: 0)))
|
||||
.Then(l => l.Literal("click")
|
||||
.Then(l => l.Argument("Slot", Arguments.Integer(0, 45))
|
||||
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
||||
.Executes(r => DoClickAction(r.Source, handler, inventoryId: 0, Arguments.GetInteger(r, "Slot"), WindowActionType.LeftClick))
|
||||
.Then(l => l.Argument("Action", MccArguments.InventoryAction())
|
||||
.Executes(r => DoClickAction(r.Source, handler, inventoryId: 0, Arguments.GetInteger(r, "Slot"), MccArguments.GetInventoryAction(r, "Action"))))))
|
||||
.Then(l => l.Literal("drop")
|
||||
.Then(l => l.Argument("Slot", Arguments.Integer(0, 45))
|
||||
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
||||
.Executes(r => DoDropAction(r.Source, handler, inventoryId: 0, Arguments.GetInteger(r, "Slot"), WindowActionType.DropItem))
|
||||
.Then(l => l.Literal("all")
|
||||
.Executes(r => DoDropAction(r.Source, handler, inventoryId: 0, Arguments.GetInteger(r, "Slot"), WindowActionType.DropItemStack))))))
|
||||
|
|
@ -92,12 +92,12 @@ namespace MinecraftClient.Commands
|
|||
.Then(l => l.Literal("list")
|
||||
.Executes(r => DoListAction(r.Source, handler, inventoryId: null)))
|
||||
.Then(l => l.Literal("click")
|
||||
.Then(l => l.Argument("Slot", Arguments.Integer(0, 89))
|
||||
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
||||
.Executes(r => DoClickAction(r.Source, handler, inventoryId: null, Arguments.GetInteger(r, "Slot"), WindowActionType.LeftClick))
|
||||
.Then(l => l.Argument("Action", MccArguments.InventoryAction())
|
||||
.Executes(r => DoClickAction(r.Source, handler, inventoryId: null, Arguments.GetInteger(r, "Slot"), MccArguments.GetInventoryAction(r, "Action"))))))
|
||||
.Then(l => l.Literal("drop")
|
||||
.Then(l => l.Argument("Slot", Arguments.Integer(0, 89))
|
||||
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
||||
.Executes(r => DoDropAction(r.Source, handler, inventoryId: null, Arguments.GetInteger(r, "Slot"), WindowActionType.DropItem))
|
||||
.Then(l => l.Literal("all")
|
||||
.Executes(r => DoDropAction(r.Source, handler, inventoryId: null, Arguments.GetInteger(r, "Slot"), WindowActionType.DropItemStack))))))
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using Brigadier.NET;
|
||||
using Brigadier.NET;
|
||||
using Brigadier.NET.Builder;
|
||||
using MinecraftClient.CommandHandler;
|
||||
|
||||
|
|
@ -11,7 +10,8 @@ namespace MinecraftClient.Commands
|
|||
public override string CmdUsage { get { return "upgrade [-f|check|cancel|download]"; } }
|
||||
public override string CmdDesc { get { return string.Empty; } }
|
||||
|
||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher) {
|
||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
||||
{
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CmdName)
|
||||
.Executes(r => GetUsage(r.Source, string.Empty))
|
||||
|
|
@ -41,8 +41,10 @@ namespace MinecraftClient.Commands
|
|||
);
|
||||
}
|
||||
|
||||
private int GetUsage(CmdResult r, string? cmd) {
|
||||
return r.SetAndReturn(cmd switch {
|
||||
private int GetUsage(CmdResult r, string? cmd)
|
||||
{
|
||||
return r.SetAndReturn(cmd switch
|
||||
{
|
||||
#pragma warning disable format // @formatter:off
|
||||
"cancel" => GetCmdDescTranslated(),
|
||||
"check" => GetCmdDescTranslated(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue