mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Added Entity Action handling, and A TSneak command that will Toggle Sneak.
This commit is contained in:
parent
9dae40153c
commit
384c804e54
10 changed files with 176 additions and 5 deletions
31
MinecraftClient/Commands/Sneak.cs
Normal file
31
MinecraftClient/Commands/Sneak.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MinecraftClient.Commands
|
||||
{
|
||||
public class Sneak : Command
|
||||
{
|
||||
private bool sneaking = false;
|
||||
public override string CMDName { get { return "TSneak"; } }
|
||||
public override string CMDDesc { get { return "Sneak: Toggles sneaking"; } }
|
||||
|
||||
public override string Run(McTcpClient handler, string command, Dictionary<string, object> localVars)
|
||||
{
|
||||
if (sneaking)
|
||||
{
|
||||
var result = handler.sendEntityAction(Protocol.ActionType.StopSneaking);
|
||||
sneaking = false;
|
||||
return result ? "Success" : "Fail";
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = handler.sendEntityAction(Protocol.ActionType.StartSneaking);
|
||||
sneaking = true;
|
||||
return result ? "Success" : "Fail";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue