new command /animation (#1026)

This commit is contained in:
Рома Данилов 2020-05-26 14:02:09 +05:00 committed by GitHub
parent 23870711a0
commit 87b2d3bf4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 409 additions and 311 deletions

View file

@ -27,6 +27,7 @@ namespace MinecraftClient.Protocol.Handlers
ClickWindow,
CloseWindow,
PlayerBlockPlacement,
CreativeInventoryAction
CreativeInventoryAction,
Animation
}
}

View file

@ -692,7 +692,10 @@ namespace MinecraftClient.Protocol.Handlers
{
return false; //Currently not implemented
}
public bool SendAnimation(int animation)
{
return false; //Currently not implemented
}
public bool SendCreativeInventoryAction(int slot, ItemType item, int count)
{
return false; //Currently not implemented

View file

@ -1391,6 +1391,28 @@ namespace MinecraftClient.Protocol.Handlers
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)
{
try

View file

@ -417,7 +417,8 @@ namespace MinecraftClient.Protocol.Handlers
case PacketOutgoingType.PlayerBlockPlacement: return 0x2C;
case PacketOutgoingType.ClickWindow: return 0x09;
case PacketOutgoingType.CloseWindow: return 0x0A;
case PacketOutgoingType.EntityAction: return 0x1B;
case PacketOutgoingType.EntityAction: return 0x1B;
case PacketOutgoingType.Animation: return 0x2A;
}
}