Added Entity Action handling, and A TSneak command that will Toggle Sneak.

This commit is contained in:
CarbonNeuron 2020-05-01 08:28:22 -05:00
parent 9dae40153c
commit 384c804e54
10 changed files with 176 additions and 5 deletions

View 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";
}
}
}
}