mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
new command /animation (#1026)
This commit is contained in:
parent
23870711a0
commit
87b2d3bf4a
9 changed files with 409 additions and 311 deletions
|
|
@ -899,6 +899,16 @@ namespace MinecraftClient
|
||||||
return Handler.DoCreativeGive(slot, itemType, count);
|
return Handler.DoCreativeGive(slot, itemType, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Plays animation
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="animation"> <0|1></param>
|
||||||
|
/// <returns>TRUE animation done</returns>
|
||||||
|
protected bool SendAnimation(int animation)
|
||||||
|
{
|
||||||
|
return Handler.DoAnimation(animation);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Use item currently in the player's hand (active inventory bar slot)
|
/// Use item currently in the player's hand (active inventory bar slot)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
43
MinecraftClient/Commands/Animation.cs
Normal file
43
MinecraftClient/Commands/Animation.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Commands
|
||||||
|
{
|
||||||
|
public class Animation : Command
|
||||||
|
{
|
||||||
|
public override string CMDName { get { return "animation"; } }
|
||||||
|
public override string CMDDesc { get { return "animation <<mainhand|offhand>|<0|1>>"; } }
|
||||||
|
|
||||||
|
public override string Run(McTcpClient handler, string command, Dictionary<string, object> localVars)
|
||||||
|
{
|
||||||
|
if (hasArg(command))
|
||||||
|
{
|
||||||
|
string[] args = getArgs(command);
|
||||||
|
if (args.Length > 0)
|
||||||
|
{
|
||||||
|
if (args[0] == "mainhand" || args[0] == "0")
|
||||||
|
{
|
||||||
|
handler.DoAnimation(0);
|
||||||
|
return "Done";
|
||||||
|
}
|
||||||
|
else if (args[0] == "offhand" || args[0] == "1")
|
||||||
|
{
|
||||||
|
handler.DoAnimation(1);
|
||||||
|
return "Done";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return CMDDesc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return CMDDesc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else return CMDDesc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1483,6 +1483,16 @@ namespace MinecraftClient
|
||||||
return handler.SendCreativeInventoryAction(slot, itemType, count);
|
return handler.SendCreativeInventoryAction(slot, itemType, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Plays animation
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="animation"> <0|1></param>
|
||||||
|
/// <returns>TRUE if item given successfully</returns>
|
||||||
|
public bool DoAnimation(int animation)
|
||||||
|
{
|
||||||
|
return handler.SendAnimation(animation);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Close the specified inventory window
|
/// Close the specified inventory window
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@
|
||||||
<Compile Include="ChatBots\TestBot.cs" />
|
<Compile Include="ChatBots\TestBot.cs" />
|
||||||
<Compile Include="ChatBot.cs" />
|
<Compile Include="ChatBot.cs" />
|
||||||
<Compile Include="Command.cs" />
|
<Compile Include="Command.cs" />
|
||||||
|
<Compile Include="Commands\Animation.cs" />
|
||||||
<Compile Include="Commands\ChangeSlot.cs" />
|
<Compile Include="Commands\ChangeSlot.cs" />
|
||||||
<Compile Include="Commands\Connect.cs" />
|
<Compile Include="Commands\Connect.cs" />
|
||||||
<Compile Include="Commands\Debug.cs" />
|
<Compile Include="Commands\Debug.cs" />
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
ClickWindow,
|
ClickWindow,
|
||||||
CloseWindow,
|
CloseWindow,
|
||||||
PlayerBlockPlacement,
|
PlayerBlockPlacement,
|
||||||
CreativeInventoryAction
|
CreativeInventoryAction,
|
||||||
|
Animation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -692,7 +692,10 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
{
|
{
|
||||||
return false; //Currently not implemented
|
return false; //Currently not implemented
|
||||||
}
|
}
|
||||||
|
public bool SendAnimation(int animation)
|
||||||
|
{
|
||||||
|
return false; //Currently not implemented
|
||||||
|
}
|
||||||
public bool SendCreativeInventoryAction(int slot, ItemType item, int count)
|
public bool SendCreativeInventoryAction(int slot, ItemType item, int count)
|
||||||
{
|
{
|
||||||
return false; //Currently not implemented
|
return false; //Currently not implemented
|
||||||
|
|
|
||||||
|
|
@ -1391,6 +1391,28 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
catch (ObjectDisposedException) { return false; }
|
catch (ObjectDisposedException) { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool SendAnimation(int animation)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (animation == 0 || animation == 1)
|
||||||
|
{
|
||||||
|
List<byte> packet = new List<byte>();
|
||||||
|
packet.AddRange(dataTypes.GetVarInt(animation));
|
||||||
|
|
||||||
|
SendPacket(PacketOutgoingType.Animation, packet);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else;
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (SocketException) { return false; }
|
||||||
|
catch (System.IO.IOException) { return false; }
|
||||||
|
catch (ObjectDisposedException) { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
public bool SendCloseWindow(int windowId)
|
public bool SendCloseWindow(int windowId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
||||||
|
|
@ -418,6 +418,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
case PacketOutgoingType.ClickWindow: return 0x09;
|
case PacketOutgoingType.ClickWindow: return 0x09;
|
||||||
case PacketOutgoingType.CloseWindow: return 0x0A;
|
case PacketOutgoingType.CloseWindow: return 0x0A;
|
||||||
case PacketOutgoingType.EntityAction: return 0x1B;
|
case PacketOutgoingType.EntityAction: return 0x1B;
|
||||||
|
case PacketOutgoingType.Animation: return 0x2A;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,13 @@ namespace MinecraftClient.Protocol
|
||||||
/// <returns>TRUE if item given successfully</returns>
|
/// <returns>TRUE if item given successfully</returns>
|
||||||
bool SendCreativeInventoryAction(int slot, ItemType itemType, int count);
|
bool SendCreativeInventoryAction(int slot, ItemType itemType, int count);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Plays animation
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="animation"> <0|1></param>
|
||||||
|
/// <returns>TRUE if item given successfully</returns>
|
||||||
|
bool SendAnimation(int animation);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Send a close window packet to the server
|
/// Send a close window packet to the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue