mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Added slab handling 1.13-1.19.4
This commit is contained in:
parent
4ff7712f20
commit
c7597e8822
5 changed files with 713 additions and 239 deletions
|
|
@ -6,10 +6,9 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
public class Sneak : Command
|
||||
{
|
||||
private bool sneaking = false;
|
||||
public override string CmdName { get { return "sneak"; } }
|
||||
public override string CmdUsage { get { return "sneak"; } }
|
||||
public override string CmdDesc { get { return Translations.cmd_sneak_desc; } }
|
||||
public override string CmdName => "sneak";
|
||||
public override string CmdUsage => "sneak";
|
||||
public override string CmdDesc => Translations.cmd_sneak_desc;
|
||||
|
||||
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||
{
|
||||
|
|
@ -39,27 +38,22 @@ namespace MinecraftClient.Commands
|
|||
|
||||
private int DoSneak(CmdResult r)
|
||||
{
|
||||
McClient handler = CmdResult.currentHandler!;
|
||||
if (sneaking)
|
||||
var handler = CmdResult.currentHandler!;
|
||||
|
||||
if (handler.IsSneaking)
|
||||
{
|
||||
var result = handler.SendEntityAction(Protocol.EntityActionType.StopSneaking);
|
||||
if (result)
|
||||
sneaking = false;
|
||||
if (result)
|
||||
return r.SetAndReturn(CmdResult.Status.Done, Translations.cmd_sneak_off);
|
||||
else
|
||||
return r.SetAndReturn(CmdResult.Status.Fail);
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = handler.SendEntityAction(Protocol.EntityActionType.StartSneaking);
|
||||
if (result)
|
||||
sneaking = true;
|
||||
if (result)
|
||||
return r.SetAndReturn(CmdResult.Status.Done, Translations.cmd_sneak_on);
|
||||
else
|
||||
if (!handler.SendEntityAction(Protocol.EntityActionType.StopSneaking))
|
||||
return r.SetAndReturn(CmdResult.Status.Fail);
|
||||
|
||||
handler.IsSneaking = false;
|
||||
return r.SetAndReturn(CmdResult.Status.Done, Translations.cmd_sneak_off);
|
||||
}
|
||||
|
||||
if (!handler.SendEntityAction(Protocol.EntityActionType.StartSneaking))
|
||||
return r.SetAndReturn(CmdResult.Status.Fail);
|
||||
|
||||
handler.IsSneaking = true;
|
||||
return r.SetAndReturn(CmdResult.Status.Done, Translations.cmd_sneak_on);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue