Add Entity.Name & /inventory 0 creative <slot> <itemtype> <count> (#1024)

* Update Program.cs

* Update Entity.cs

Add Entity.Name

* Update Program.cs
* Update Entity.cs

Add break;

* Update Entity.cs

* Update Inventory.cs

Add /inventory 0 creative <slot> <item> <count>

* Update PacketOutgoingType.cs

+ CreativeInventoryAction

* Update Protocol16.cs

+ SendCreativeInventorAction

* Update Protocol18.cs

+ SendCreativeInventorAction

* Update IMinecraftCom.cs

+ SendCreativeInventorAction

* Update McTcpClient.cs

+ DoCreativeInventorAction

* Update ChatBot.cs

+ CreativeInventorAction

* Update McTcpClient.cs
* Update ChatBot.cs
* Update Inventory.cs

Add show count

* Update ChatBot.cs

+ ChatBot fix

* Update Inventory.cs

Inventory update and Fix

* Update Entity.cs
* Update McTcpClient.cs
* Update Program.cs
* Update Protocol16.cs
* Update Protocol18.cs
* Update IMinecraftCom.cs
* Update Entity.cs
This commit is contained in:
Рома Данилов 2020-05-26 00:16:53 +05:00 committed by GitHub
parent 65620e2e95
commit d120001d70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 110 additions and 16 deletions

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -724,7 +724,7 @@ namespace MinecraftClient.Protocol.Handlers
}
catch (Exception innerException)
{
if (innerException is SocketException || innerException.InnerException is SocketException || innerException is ThreadAbortException)
if (innerException is SocketException || innerException.InnerException is SocketException)
throw; //Connection lost rather than invalid data
throw new System.IO.InvalidDataException(
String.Format("Failed to process incoming packet of type {0}. (PacketID: {1}, Protocol: {2}, LoginPhase: {3}, InnerException: {4}).",
@ -1377,6 +1377,22 @@ namespace MinecraftClient.Protocol.Handlers
catch (ObjectDisposedException) { return false; }
}
public bool SendCreativeInventoryAction(int slot, Item item)
{
try
{
List<byte> packet = new List<byte>();
packet.AddRange(dataTypes.GetShort((short)slot));
packet.AddRange(dataTypes.GetItemSlot(item));
SendPacket(PacketOutgoingType.CreativeInventoryAction, packet);
return true;
}
catch (SocketException) { return false; }
catch (System.IO.IOException) { return false; }
catch (ObjectDisposedException) { return false; }
}
public bool SendCloseWindow(int windowId)
{
try