This commit is contained in:
BruceChen 2022-12-11 16:30:45 +08:00
parent 127978615c
commit 94a3c92b36
62 changed files with 371 additions and 297 deletions

View file

@ -12,7 +12,7 @@ namespace MinecraftClient.Commands
public override string CmdUsage { get { return "useblock <x> <y> <z>"; } }
public override string CmdDesc { get { return Translations.cmd_useblock_desc; } }
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
{
dispatcher.Register(l => l.Literal("help")
.Then(l => l.Literal(CmdName)
@ -22,7 +22,7 @@ namespace MinecraftClient.Commands
dispatcher.Register(l => l.Literal(CmdName)
.Then(l => l.Argument("Location", MccArguments.Location())
.Executes(r => UseBlockAtLocation(r.Source, handler, MccArguments.GetLocation(r, "Location"))))
.Executes(r => UseBlockAtLocation(r.Source, MccArguments.GetLocation(r, "Location"))))
.Then(l => l.Literal("_help")
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
);
@ -38,8 +38,9 @@ namespace MinecraftClient.Commands
});
}
private int UseBlockAtLocation(CmdResult r, McClient handler, Location block)
private int UseBlockAtLocation(CmdResult r, Location block)
{
McClient handler = CmdResult.currentHandler!;
if (!handler.GetTerrainEnabled())
return r.SetAndReturn(Status.FailNeedTerrain);