mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Implement OnMapData, OnTitle, UpdateSign, OnEntityEquipment, Useblock (#1071)
* + Fix null PlayerInventory + Fix null PlayerInventory * Update Protocol18.cs * Update McTcpClient.cs + Fix https://github.com/ORelio/Minecraft-Console-Client/issues/1022 * Update Protocol18.cs + MapData * Update PacketIncomingType.cs + MapData * Update Protocol18PacketTypes.cs * Update IMinecraftComHandler.cs + OnMapData * Update McTcpClient.cs + OnMapData * Update ChatBot.cs + OnMapData * Update Protocol18.cs * Update Protocol18PacketTypes.cs + Fix * Update PacketIncomingType.cs + Title * Update Protocol18PacketTypes.cs * Update Protocol18.cs * Update IMinecraftComHandler.cs + OnTitle * Update McTcpClient.cs * Update ChatBot.cs + OnTitle * Update Protocol18.cs Fix * Update IMinecraftComHandler.cs * Update McTcpClient.cs * add ClearInventories() * add ClearInventories() * Update McTcpClient.cs + OnTitle * Preparing to Add BlockAction * Update PacketOutgoingType.cs * Update PacketOutgoingType.cs * Update Protocol18.cs + SendUpdateSign * Update Protocol16.cs + SendUpdateSign * Update IMinecraftCom.cs + SendUpdateSign * Update McTcpClient.cs + UpdateSign * Update ChatBot.cs + UpdateSign * Update McTcpClient.cs Update PlaceBlock * Update ChatBot.cs * Update McTcpClient.cs * add SendCreativeInventoryAction nbt add SendCreativeInventoryAction nbt * Update Protocol18.cs * Update Protocol16.cs * Update McTcpClient.cs * Update ChatBot.cs * Update Inventory.cs * Update Protocol18PacketTypes.cs * Update PacketIncomingType.cs * Update Protocol18PacketTypes.cs * Update Protocol18PacketTypes.cs Fix * Update Protocol18PacketTypes.cs Fix * Update IMinecraftComHandler.cs * Update IMinecraftComHandler.cs * Update ChatBot.cs * Update McTcpClient.cs + OnEntityEquipment * Update Protocol18.cs * Update McTcpClient.cs * Update McTcpClient.cs * Update McTcpClient.cs * Update ChatBot.cs * Update McTcpClient.cs * Update McTcpClient.cs * Update ChatBot.cs * Update McTcpClient.cs * Update McTcpClient.cs * Update ChatBot.cs * Update McTcpClient.cs * Update McTcpClient.cs * Update Protocol18.cs * Update McTcpClient.cs * Update ChatBot.cs * Update ChatBot.cs * Update McTcpClient.cs * Update McTcpClient.cs * Update McTcpClient.cs * Update Protocol18.cs * Create Useblock.cs * Update MinecraftClient.csproj * Update McTcpClient.cs
This commit is contained in:
parent
eddf7ad063
commit
b52435f0ce
12 changed files with 419 additions and 36 deletions
|
|
@ -221,6 +221,36 @@ namespace MinecraftClient
|
||||||
/// <param name="latency">Latency.</param>
|
/// <param name="latency">Latency.</param>
|
||||||
public virtual void OnLatencyUpdate(string playername, Guid uuid, int latency) { }
|
public virtual void OnLatencyUpdate(string playername, Guid uuid, int latency) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called map data
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mapid"></param>
|
||||||
|
/// <param name="scale"></param>
|
||||||
|
/// <param name="trackingposition"></param>
|
||||||
|
/// <param name="locked"></param>
|
||||||
|
/// <param name="iconcount"></param>
|
||||||
|
public virtual void OnMapData(int mapid, byte scale, bool trackingposition, bool locked, int iconcount) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Received some Title from the server
|
||||||
|
/// <param name="action"> 0 = set title, 1 = set subtitle, 3 = set action bar, 4 = set times and display, 4 = hide, 5 = reset</param>
|
||||||
|
/// <param name="titletext"> title text</param>
|
||||||
|
/// <param name="subtitletext"> suntitle text</param>
|
||||||
|
/// <param name="actionbartext"> action bar text</param>
|
||||||
|
/// <param name="fadein"> Fade In</param>
|
||||||
|
/// <param name="stay"> Stay</param>
|
||||||
|
/// <param name="fadeout"> Fade Out</param>
|
||||||
|
/// <param name="json"> json text</param>
|
||||||
|
public virtual void OnTitle(int action, string titletext, string subtitletext, string actionbartext, int fadein, int stay, int fadeout, string json) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called on Entity Equipment
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"> Entity</param>
|
||||||
|
/// <param name="slot"> Equipment slot. 0: main hand, 1: off hand, 2–5: armor slot (2: boots, 3: leggings, 4: chestplate, 5: helmet)</param>
|
||||||
|
/// <param name="item"> Item)</param>
|
||||||
|
public virtual void OnEntityEquipment(Entity entity, int slot, Item item) { }
|
||||||
|
|
||||||
/* =================================================================== */
|
/* =================================================================== */
|
||||||
/* ToolBox - Methods below might be useful while creating your bot. */
|
/* ToolBox - Methods below might be useful while creating your bot. */
|
||||||
/* You should not need to interact with other classes of the program. */
|
/* You should not need to interact with other classes of the program. */
|
||||||
|
|
@ -947,9 +977,9 @@ namespace MinecraftClient
|
||||||
/// <param name="itemType">Item type</param>
|
/// <param name="itemType">Item type</param>
|
||||||
/// <param name="count">Item count</param>
|
/// <param name="count">Item count</param>
|
||||||
/// <returns>TRUE if item given successfully</returns>
|
/// <returns>TRUE if item given successfully</returns>
|
||||||
protected bool CreativeGive(int slot, ItemType itemType, int count)
|
protected bool CreativeGive(int slot, ItemType itemType, int count, Dictionary<string, object> NBT = null)
|
||||||
{
|
{
|
||||||
return Handler.DoCreativeGive(slot, itemType, count);
|
return Handler.DoCreativeGive(slot, itemType, count, NBT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -985,9 +1015,9 @@ namespace MinecraftClient
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="location">Block location</param>
|
/// <param name="location">Block location</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected bool SendPlaceBlock(Location location)
|
protected bool SendPlaceBlock(Location location, int face)
|
||||||
{
|
{
|
||||||
return Handler.PlaceBlock(location);
|
return Handler.PlaceBlock(location, face);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -1039,5 +1069,27 @@ namespace MinecraftClient
|
||||||
{
|
{
|
||||||
return Handler.GetCurrentSlot();
|
return Handler.GetCurrentSlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean all inventory
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>TRUE if the uccessfully clear</returns>
|
||||||
|
protected bool ClearInventories()
|
||||||
|
{
|
||||||
|
return Handler.ClearInventories();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update sign text
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="location"> sign location</param>
|
||||||
|
/// <param name="line1"> text one</param>
|
||||||
|
/// <param name="line2"> text two</param>
|
||||||
|
/// <param name="line3"> text three</param>
|
||||||
|
/// <param name="line4"> text1 four</param>
|
||||||
|
protected bool UpdateSign(Location location, string line1, string line2, string line3, string line4)
|
||||||
|
{
|
||||||
|
return Handler.UpdateSign(location, line1, line2, line3, line4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ namespace MinecraftClient.Commands
|
||||||
if (handler.GetGamemode() == 1)
|
if (handler.GetGamemode() == 1)
|
||||||
{
|
{
|
||||||
int count = int.Parse(args[3]);
|
int count = int.Parse(args[3]);
|
||||||
if (handler.DoCreativeGive(slot, itemType, count))
|
if (handler.DoCreativeGive(slot, itemType, count, null))
|
||||||
return "Requested " + itemType + " x" + count + " in slot #" + slot;
|
return "Requested " + itemType + " x" + count + " in slot #" + slot;
|
||||||
else return "Failed to request Creative Give";
|
else return "Failed to request Creative Give";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
32
MinecraftClient/Commands/Useblock.cs
Normal file
32
MinecraftClient/Commands/Useblock.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
using MinecraftClient.Mapping;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace MinecraftClient.Commands
|
||||||
|
{
|
||||||
|
class Useblock : Command
|
||||||
|
{
|
||||||
|
public override string CMDName { get { return "useblock"; } }
|
||||||
|
public override string CMDDesc { get { return "useblock <x> <y> <z>: use block"; } }
|
||||||
|
|
||||||
|
public override string Run(McTcpClient handler, string command, Dictionary<string, object> localVars)
|
||||||
|
{
|
||||||
|
if (!handler.GetTerrainEnabled()) return "Please enable TerrainHandling in the config file first.";
|
||||||
|
if (hasArg(command))
|
||||||
|
{
|
||||||
|
string[] args = getArgs(command);
|
||||||
|
if (args.Length >= 3)
|
||||||
|
{
|
||||||
|
int x = Convert.ToInt32(args[0]);
|
||||||
|
int y = Convert.ToInt32(args[1]);
|
||||||
|
int z = Convert.ToInt32(args[2]);
|
||||||
|
handler.PlaceBlock(new Location(x, y, z), 0);
|
||||||
|
}
|
||||||
|
else { return CMDDesc; }
|
||||||
|
}
|
||||||
|
return CMDDesc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1285,6 +1285,32 @@ namespace MinecraftClient
|
||||||
OnSpawnEntity(playerEntity);
|
OnSpawnEntity(playerEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called on Entity Equipment
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entityid"> Entity ID</param>
|
||||||
|
/// <param name="slot"> Equipment slot. 0: main hand, 1: off hand, 2–5: armor slot (2: boots, 3: leggings, 4: chestplate, 5: helmet)</param>
|
||||||
|
/// <param name="item"> Item)</param>
|
||||||
|
public void OnEntityEquipment(int entityid, int slot, Item item)
|
||||||
|
{
|
||||||
|
foreach (ChatBot bot in bots.ToArray())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (entities.ContainsKey(entityid))
|
||||||
|
bot.OnEntityEquipment(entities[entityid], slot, item);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
if (!(e2 is ThreadAbortException))
|
||||||
|
{
|
||||||
|
ConsoleIO.WriteLogLine("OnEntityEquipment: Got error from " + bot.ToString() + ": " + e.ToString());
|
||||||
|
}
|
||||||
|
else throw; //ThreadAbortException should not be caught
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when the Game Mode has been updated for a player
|
/// Called when the Game Mode has been updated for a player
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -1524,10 +1550,11 @@ namespace MinecraftClient
|
||||||
/// <param name="slot">Destination inventory slot</param>
|
/// <param name="slot">Destination inventory slot</param>
|
||||||
/// <param name="itemType">Item type</param>
|
/// <param name="itemType">Item type</param>
|
||||||
/// <param name="count">Item count</param>
|
/// <param name="count">Item count</param>
|
||||||
|
/// <param name="NBT">Item NBT</param>
|
||||||
/// <returns>TRUE if item given successfully</returns>
|
/// <returns>TRUE if item given successfully</returns>
|
||||||
public bool DoCreativeGive(int slot, ItemType itemType, int count)
|
public bool DoCreativeGive(int slot, ItemType itemType, int count, Dictionary<string, object> NBT = null)
|
||||||
{
|
{
|
||||||
return handler.SendCreativeInventoryAction(slot, itemType, count);
|
return handler.SendCreativeInventoryAction(slot, itemType, count, NBT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -1555,6 +1582,21 @@ namespace MinecraftClient
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean all inventory
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>TRUE if the uccessfully clear</returns>
|
||||||
|
public bool ClearInventories()
|
||||||
|
{
|
||||||
|
if (inventoryHandlingEnabled)
|
||||||
|
{
|
||||||
|
inventories.Clear();
|
||||||
|
inventories[0] = new Container(0, ContainerType.PlayerInventory, "Player Inventory");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interact with an entity
|
/// Interact with an entity
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -1570,14 +1612,38 @@ namespace MinecraftClient
|
||||||
/// Place the block at hand in the Minecraft world
|
/// Place the block at hand in the Minecraft world
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="location">Location to place block to</param>
|
/// <param name="location">Location to place block to</param>
|
||||||
|
/// <param name="blockface">Block face</param>
|
||||||
/// <returns>TRUE if successfully placed</returns>
|
/// <returns>TRUE if successfully placed</returns>
|
||||||
public bool PlaceBlock(Location location)
|
public bool PlaceBlock(Location location, int blockface)
|
||||||
{
|
{
|
||||||
//WORK IN PROGRESS. MAY NOT WORK YET
|
|
||||||
if (Settings.DebugMessages)
|
if (Settings.DebugMessages)
|
||||||
ConsoleIO.WriteLogLine(location.ToString());
|
ConsoleIO.WriteLogLine(location.ToString());
|
||||||
Location placelocation = new Location(location.X, location.Y - 1, location.Z);
|
Location placelocation;
|
||||||
return handler.SendPlayerBlockPlacement(0, placelocation, 1, 0.5f, 0.5f, 0.5f, false);
|
if (blockface == 1)
|
||||||
|
{
|
||||||
|
placelocation = new Location(location.X, location.Y - 1, location.Z);
|
||||||
|
}
|
||||||
|
else if (blockface == 2)
|
||||||
|
{
|
||||||
|
placelocation = new Location(location.X, location.Y, location.Z + 1);
|
||||||
|
}
|
||||||
|
else if (blockface == 3)
|
||||||
|
{
|
||||||
|
placelocation = new Location(location.X, location.Y, location.Z - 1);
|
||||||
|
}
|
||||||
|
else if (blockface == 4)
|
||||||
|
{
|
||||||
|
placelocation = new Location(location.X + 1, location.Y, location.Z);
|
||||||
|
}
|
||||||
|
else if (blockface == 5)
|
||||||
|
{
|
||||||
|
placelocation = new Location(location.X - 1, location.Y, location.Z);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
placelocation = location;
|
||||||
|
}
|
||||||
|
return handler.SendPlayerBlockPlacement(0, placelocation, blockface, 0.5f, 0.5f, 0.5f, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -1731,11 +1797,9 @@ namespace MinecraftClient
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when Experience bar is updated
|
/// Called when held item change
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Experiencebar">Experience bar level</param>
|
/// <param name="slot"> item slot</param>
|
||||||
/// <param name="Level">Player Level</param>
|
|
||||||
/// <param name="TotalExperience">Total experience</param>
|
|
||||||
public void OnHeldItemChange(byte slot)
|
public void OnHeldItemChange(byte slot)
|
||||||
{
|
{
|
||||||
foreach (ChatBot bot in bots.ToArray())
|
foreach (ChatBot bot in bots.ToArray())
|
||||||
|
|
@ -1755,5 +1819,76 @@ namespace MinecraftClient
|
||||||
}
|
}
|
||||||
CurrentSlot = slot;
|
CurrentSlot = slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called map data
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mapid"></param>
|
||||||
|
/// <param name="scale"></param>
|
||||||
|
/// <param name="trackingposition"></param>
|
||||||
|
/// <param name="locked"></param>
|
||||||
|
/// <param name="iconcount"></param>
|
||||||
|
public void OnMapData(int mapid, byte scale, bool trackingposition, bool locked, int iconcount)
|
||||||
|
{
|
||||||
|
foreach (ChatBot bot in bots.ToArray())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bot.OnMapData(mapid, scale, trackingposition, locked, iconcount);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
if (!(e is ThreadAbortException))
|
||||||
|
{
|
||||||
|
ConsoleIO.WriteLogLine("OnMapData: Got error from " + bot.ToString() + ": " + e.ToString());
|
||||||
|
}
|
||||||
|
else throw; //ThreadAbortException should not be caught
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Received some Title from the server
|
||||||
|
/// <param name="action"> 0 = set title, 1 = set subtitle, 3 = set action bar, 4 = set times and display, 4 = hide, 5 = reset</param>
|
||||||
|
/// <param name="titletext"> title text</param>
|
||||||
|
/// <param name="subtitletext"> suntitle text</param>
|
||||||
|
/// <param name="actionbartext"> action bar text</param>
|
||||||
|
/// <param name="fadein"> Fade In</param>
|
||||||
|
/// <param name="stay"> Stay</param>
|
||||||
|
/// <param name="fadeout"> Fade Out</param>
|
||||||
|
/// <param name="json"> json text</param>
|
||||||
|
public void OnTitle(int action, string titletext, string subtitletext, string actionbartext, int fadein, int stay, int fadeout, string json)
|
||||||
|
{
|
||||||
|
foreach (ChatBot bot in bots.ToArray())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bot.OnTitle(action, titletext, subtitletext, actionbartext, fadein, stay, fadeout, json);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
if (!(e is ThreadAbortException))
|
||||||
|
{
|
||||||
|
ConsoleIO.WriteLogLine("OnTitle: Got error from " + bot.ToString() + ": " + e.ToString());
|
||||||
|
}
|
||||||
|
else throw; //ThreadAbortException should not be caught
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update sign text
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="location"> sign location</param>
|
||||||
|
/// <param name="line1"> text one</param>
|
||||||
|
/// <param name="line2"> text two</param>
|
||||||
|
/// <param name="line3"> text three</param>
|
||||||
|
/// <param name="line4"> text1 four</param>
|
||||||
|
public bool UpdateSign(Location location, string line1, string line2, string line3, string line4)
|
||||||
|
{
|
||||||
|
if (line1.Length <= 23 & line2.Length <= 23 & line3.Length <= 23 & line4.Length <= 23)
|
||||||
|
return handler.SendUpdateSign(location, line1, line2, line3, line4);
|
||||||
|
else { return false; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,7 @@
|
||||||
<Compile Include="Commands\Set.cs" />
|
<Compile Include="Commands\Set.cs" />
|
||||||
<Compile Include="Commands\Health.cs" />
|
<Compile Include="Commands\Health.cs" />
|
||||||
<Compile Include="Commands\Sneak.cs" />
|
<Compile Include="Commands\Sneak.cs" />
|
||||||
|
<Compile Include="Commands\Useblock.cs" />
|
||||||
<Compile Include="Commands\UseItem.cs" />
|
<Compile Include="Commands\UseItem.cs" />
|
||||||
<Compile Include="Inventory\Container.cs" />
|
<Compile Include="Inventory\Container.cs" />
|
||||||
<Compile Include="Inventory\ContainerType.cs" />
|
<Compile Include="Inventory\ContainerType.cs" />
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,15 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
EntityPositionAndRotation,
|
EntityPositionAndRotation,
|
||||||
EntityProperties,
|
EntityProperties,
|
||||||
EntityTeleport,
|
EntityTeleport,
|
||||||
|
EntityEquipment,
|
||||||
|
EntityVelocity,
|
||||||
TimeUpdate,
|
TimeUpdate,
|
||||||
UpdateHealth,
|
UpdateHealth,
|
||||||
SetExperience,
|
SetExperience,
|
||||||
HeldItemChange,
|
HeldItemChange,
|
||||||
Explosion,
|
Explosion,
|
||||||
|
MapData,
|
||||||
|
Title,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a packet not implemented in MCC.
|
/// Represents a packet not implemented in MCC.
|
||||||
|
|
|
||||||
|
|
@ -34,5 +34,6 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
CreativeInventoryAction,
|
CreativeInventoryAction,
|
||||||
Animation,
|
Animation,
|
||||||
PlayerDigging,
|
PlayerDigging,
|
||||||
|
UpdateSign,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -653,6 +653,11 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
catch (SocketException) { return false; }
|
catch (SocketException) { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool SendUpdateSign(Location location, string line1, string line2, string line3, string line4)
|
||||||
|
{
|
||||||
|
return false; //Currently not implemented
|
||||||
|
}
|
||||||
|
|
||||||
public bool SendBrandInfo(string brandInfo)
|
public bool SendBrandInfo(string brandInfo)
|
||||||
{
|
{
|
||||||
return false; //Only supported since MC 1.7
|
return false; //Only supported since MC 1.7
|
||||||
|
|
@ -698,7 +703,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
return false; //Currently not implemented
|
return false; //Currently not implemented
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SendCreativeInventoryAction(int slot, ItemType item, int count)
|
public bool SendCreativeInventoryAction(int slot, ItemType item, int count, Dictionary<string, object> NBT)
|
||||||
{
|
{
|
||||||
return false; //Currently not implemented
|
return false; //Currently not implemented
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -316,6 +316,75 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case PacketIncomingType.MapData:
|
||||||
|
int mapid = dataTypes.ReadNextVarInt(packetData);
|
||||||
|
byte scale = dataTypes.ReadNextByte(packetData);
|
||||||
|
bool trackingposition = dataTypes.ReadNextBool(packetData);
|
||||||
|
bool locked = false;
|
||||||
|
if (protocolversion >= MC114Version)
|
||||||
|
{
|
||||||
|
locked = dataTypes.ReadNextBool(packetData);
|
||||||
|
}
|
||||||
|
int iconcount = dataTypes.ReadNextVarInt(packetData);
|
||||||
|
handler.OnMapData(mapid, scale, trackingposition, locked, iconcount);
|
||||||
|
break;
|
||||||
|
case PacketIncomingType.Title:
|
||||||
|
if (protocolversion >= MC18Version)
|
||||||
|
{
|
||||||
|
int action2 = dataTypes.ReadNextVarInt(packetData);
|
||||||
|
string titletext = String.Empty;
|
||||||
|
string subtitletext = String.Empty;
|
||||||
|
string actionbartext = String.Empty;
|
||||||
|
string json = String.Empty;
|
||||||
|
int fadein = -1;
|
||||||
|
int stay = -1;
|
||||||
|
int fadeout = -1;
|
||||||
|
if (protocolversion >= MC110Version)
|
||||||
|
{
|
||||||
|
if (action2 == 0)
|
||||||
|
{
|
||||||
|
json = titletext;
|
||||||
|
titletext = ChatParser.ParseText(dataTypes.ReadNextString(packetData));
|
||||||
|
}
|
||||||
|
else if (action2 == 1)
|
||||||
|
{
|
||||||
|
json = subtitletext;
|
||||||
|
subtitletext = ChatParser.ParseText(dataTypes.ReadNextString(packetData));
|
||||||
|
}
|
||||||
|
else if (action2 == 2)
|
||||||
|
{
|
||||||
|
json = actionbartext;
|
||||||
|
actionbartext = ChatParser.ParseText(dataTypes.ReadNextString(packetData));
|
||||||
|
}
|
||||||
|
else if (action2 == 3)
|
||||||
|
{
|
||||||
|
fadein = dataTypes.ReadNextInt(packetData);
|
||||||
|
stay = dataTypes.ReadNextInt(packetData);
|
||||||
|
fadeout = dataTypes.ReadNextInt(packetData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (action2 == 0)
|
||||||
|
{
|
||||||
|
json = titletext;
|
||||||
|
titletext = ChatParser.ParseText(dataTypes.ReadNextString(packetData));
|
||||||
|
}
|
||||||
|
else if (action2 == 1)
|
||||||
|
{
|
||||||
|
json = subtitletext;
|
||||||
|
subtitletext = ChatParser.ParseText(dataTypes.ReadNextString(packetData));
|
||||||
|
}
|
||||||
|
else if (action2 == 2)
|
||||||
|
{
|
||||||
|
fadein = dataTypes.ReadNextInt(packetData);
|
||||||
|
stay = dataTypes.ReadNextInt(packetData);
|
||||||
|
fadeout = dataTypes.ReadNextInt(packetData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handler.OnTitle(action2, titletext, subtitletext, actionbartext, fadein, stay, fadeout, json);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case PacketIncomingType.MultiBlockChange:
|
case PacketIncomingType.MultiBlockChange:
|
||||||
if (handler.GetTerrainEnabled())
|
if (handler.GetTerrainEnabled())
|
||||||
{
|
{
|
||||||
|
|
@ -589,6 +658,15 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
handler.OnSpawnEntity(entity);
|
handler.OnSpawnEntity(entity);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case PacketIncomingType.EntityEquipment:
|
||||||
|
if (handler.GetEntityHandlingEnabled())
|
||||||
|
{
|
||||||
|
int entityid = dataTypes.ReadNextVarInt(packetData);
|
||||||
|
int slot2 = dataTypes.ReadNextVarInt(packetData);
|
||||||
|
Item item = dataTypes.ReadNextItemSlot(packetData);
|
||||||
|
handler.OnEntityEquipment(entityid, slot2, item);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case PacketIncomingType.SpawnLivingEntity:
|
case PacketIncomingType.SpawnLivingEntity:
|
||||||
if (handler.GetEntityHandlingEnabled())
|
if (handler.GetEntityHandlingEnabled())
|
||||||
{
|
{
|
||||||
|
|
@ -1424,13 +1502,13 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
catch (ObjectDisposedException) { return false; }
|
catch (ObjectDisposedException) { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SendCreativeInventoryAction(int slot, ItemType itemType, int count)
|
public bool SendCreativeInventoryAction(int slot, ItemType itemType, int count, Dictionary<string, object> NBT)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<byte> packet = new List<byte>();
|
List<byte> packet = new List<byte>();
|
||||||
packet.AddRange(dataTypes.GetShort((short)slot));
|
packet.AddRange(dataTypes.GetShort((short)slot));
|
||||||
packet.AddRange(dataTypes.GetItemSlot(new Item((int)itemType, count, null)));
|
packet.AddRange(dataTypes.GetItemSlot(new Item((int)itemType, count, NBT)));
|
||||||
SendPacket(PacketOutgoingType.CreativeInventoryAction, packet);
|
SendPacket(PacketOutgoingType.CreativeInventoryAction, packet);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1489,5 +1567,22 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
catch (System.IO.IOException) { return false; }
|
catch (System.IO.IOException) { return false; }
|
||||||
catch (ObjectDisposedException) { return false; }
|
catch (ObjectDisposedException) { return false; }
|
||||||
}
|
}
|
||||||
|
public bool SendUpdateSign(Location sign, string line1, string line2, string line3, string line4)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<byte> packet = new List<byte>();
|
||||||
|
packet.AddRange(dataTypes.GetLocation(sign));
|
||||||
|
packet.AddRange(dataTypes.GetString(line1));
|
||||||
|
packet.AddRange(dataTypes.GetString(line2));
|
||||||
|
packet.AddRange(dataTypes.GetString(line3));
|
||||||
|
packet.AddRange(dataTypes.GetString(line4));
|
||||||
|
SendPacket(PacketOutgoingType.UpdateSign, packet);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (SocketException) { return false; }
|
||||||
|
catch (System.IO.IOException) { return false; }
|
||||||
|
catch (ObjectDisposedException) { return false; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,11 +57,15 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
case 0x17: return PacketIncomingType.EntityPositionAndRotation;
|
case 0x17: return PacketIncomingType.EntityPositionAndRotation;
|
||||||
case 0x20: return PacketIncomingType.EntityProperties;
|
case 0x20: return PacketIncomingType.EntityProperties;
|
||||||
case 0x18: return PacketIncomingType.EntityTeleport;
|
case 0x18: return PacketIncomingType.EntityTeleport;
|
||||||
|
case 0x12: return PacketIncomingType.EntityVelocity;
|
||||||
|
case 0x04: return PacketIncomingType.EntityEquipment;
|
||||||
case 0x03: return PacketIncomingType.TimeUpdate;
|
case 0x03: return PacketIncomingType.TimeUpdate;
|
||||||
case 0x06: return PacketIncomingType.UpdateHealth;
|
case 0x06: return PacketIncomingType.UpdateHealth;
|
||||||
case 0x1F: return PacketIncomingType.SetExperience;
|
case 0x1F: return PacketIncomingType.SetExperience;
|
||||||
case 0x09: return PacketIncomingType.HeldItemChange;
|
case 0x09: return PacketIncomingType.HeldItemChange;
|
||||||
case 0x27: return PacketIncomingType.Explosion;
|
case 0x27: return PacketIncomingType.Explosion;
|
||||||
|
case 0x34: return PacketIncomingType.MapData;
|
||||||
|
case 0x45: return PacketIncomingType.Title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (protocol <= Protocol18Handler.MC1112Version) // MC 1.9, 1.10 and 1.11
|
else if (protocol <= Protocol18Handler.MC1112Version) // MC 1.9, 1.10 and 1.11
|
||||||
|
|
@ -97,11 +101,15 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
case 0x26: return PacketIncomingType.EntityPositionAndRotation;
|
case 0x26: return PacketIncomingType.EntityPositionAndRotation;
|
||||||
case 0x4A: return PacketIncomingType.EntityProperties;
|
case 0x4A: return PacketIncomingType.EntityProperties;
|
||||||
case 0x49: return PacketIncomingType.EntityTeleport;
|
case 0x49: return PacketIncomingType.EntityTeleport;
|
||||||
|
case 0x3B: return PacketIncomingType.EntityVelocity;
|
||||||
|
case 0x3C: return PacketIncomingType.EntityEquipment;
|
||||||
case 0x44: return PacketIncomingType.TimeUpdate;
|
case 0x44: return PacketIncomingType.TimeUpdate;
|
||||||
case 0x3E: return PacketIncomingType.UpdateHealth;
|
case 0x3E: return PacketIncomingType.UpdateHealth;
|
||||||
case 0x3D: return PacketIncomingType.SetExperience;
|
case 0x3D: return PacketIncomingType.SetExperience;
|
||||||
case 0x37: return PacketIncomingType.HeldItemChange;
|
case 0x37: return PacketIncomingType.HeldItemChange;
|
||||||
case 0x1C: return PacketIncomingType.Explosion;
|
case 0x1C: return PacketIncomingType.Explosion;
|
||||||
|
case 0x24: return PacketIncomingType.MapData;
|
||||||
|
case 0x45: return PacketIncomingType.Title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (protocol <= Protocol18Handler.MC112Version) // MC 1.12.0
|
else if (protocol <= Protocol18Handler.MC112Version) // MC 1.12.0
|
||||||
|
|
@ -137,11 +145,15 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
case 0x27: return PacketIncomingType.EntityPositionAndRotation;
|
case 0x27: return PacketIncomingType.EntityPositionAndRotation;
|
||||||
case 0x4D: return PacketIncomingType.EntityProperties;
|
case 0x4D: return PacketIncomingType.EntityProperties;
|
||||||
case 0x4B: return PacketIncomingType.EntityTeleport;
|
case 0x4B: return PacketIncomingType.EntityTeleport;
|
||||||
|
case 0x3D: return PacketIncomingType.EntityVelocity;
|
||||||
|
case 0x3E: return PacketIncomingType.EntityEquipment;
|
||||||
case 0x46: return PacketIncomingType.TimeUpdate;
|
case 0x46: return PacketIncomingType.TimeUpdate;
|
||||||
case 0x40: return PacketIncomingType.UpdateHealth;
|
case 0x40: return PacketIncomingType.UpdateHealth;
|
||||||
case 0x3F: return PacketIncomingType.SetExperience;
|
case 0x3F: return PacketIncomingType.SetExperience;
|
||||||
case 0x39: return PacketIncomingType.HeldItemChange;
|
case 0x39: return PacketIncomingType.HeldItemChange;
|
||||||
case 0x1C: return PacketIncomingType.Explosion;
|
case 0x1C: return PacketIncomingType.Explosion;
|
||||||
|
case 0x24: return PacketIncomingType.MapData;
|
||||||
|
case 0x47: return PacketIncomingType.Title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (protocol <= Protocol18Handler.MC1122Version) // MC 1.12.2
|
else if (protocol <= Protocol18Handler.MC1122Version) // MC 1.12.2
|
||||||
|
|
@ -177,11 +189,15 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
case 0x27: return PacketIncomingType.EntityPositionAndRotation;
|
case 0x27: return PacketIncomingType.EntityPositionAndRotation;
|
||||||
case 0x4E: return PacketIncomingType.EntityProperties;
|
case 0x4E: return PacketIncomingType.EntityProperties;
|
||||||
case 0x4C: return PacketIncomingType.EntityTeleport;
|
case 0x4C: return PacketIncomingType.EntityTeleport;
|
||||||
|
case 0x3E: return PacketIncomingType.EntityVelocity;
|
||||||
|
case 0x3F: return PacketIncomingType.EntityEquipment;
|
||||||
case 0x47: return PacketIncomingType.TimeUpdate;
|
case 0x47: return PacketIncomingType.TimeUpdate;
|
||||||
case 0x41: return PacketIncomingType.UpdateHealth;
|
case 0x41: return PacketIncomingType.UpdateHealth;
|
||||||
case 0x40: return PacketIncomingType.SetExperience;
|
case 0x40: return PacketIncomingType.SetExperience;
|
||||||
case 0x3A: return PacketIncomingType.HeldItemChange;
|
case 0x3A: return PacketIncomingType.HeldItemChange;
|
||||||
case 0x1C: return PacketIncomingType.Explosion;
|
case 0x1C: return PacketIncomingType.Explosion;
|
||||||
|
case 0x25: return PacketIncomingType.MapData;
|
||||||
|
case 0x48: return PacketIncomingType.Title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (protocol < Protocol18Handler.MC114Version) // MC 1.13 to 1.13.2
|
else if (protocol < Protocol18Handler.MC114Version) // MC 1.13 to 1.13.2
|
||||||
|
|
@ -217,11 +233,15 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
case 0x29: return PacketIncomingType.EntityPositionAndRotation;
|
case 0x29: return PacketIncomingType.EntityPositionAndRotation;
|
||||||
case 0x52: return PacketIncomingType.EntityProperties;
|
case 0x52: return PacketIncomingType.EntityProperties;
|
||||||
case 0x50: return PacketIncomingType.EntityTeleport;
|
case 0x50: return PacketIncomingType.EntityTeleport;
|
||||||
|
case 0x41: return PacketIncomingType.EntityVelocity;
|
||||||
|
case 0x42: return PacketIncomingType.EntityEquipment;
|
||||||
case 0x4A: return PacketIncomingType.TimeUpdate;
|
case 0x4A: return PacketIncomingType.TimeUpdate;
|
||||||
case 0x44: return PacketIncomingType.UpdateHealth;
|
case 0x44: return PacketIncomingType.UpdateHealth;
|
||||||
case 0x43: return PacketIncomingType.SetExperience;
|
case 0x43: return PacketIncomingType.SetExperience;
|
||||||
case 0x3D: return PacketIncomingType.HeldItemChange;
|
case 0x3D: return PacketIncomingType.HeldItemChange;
|
||||||
case 0x1E: return PacketIncomingType.Explosion;
|
case 0x1E: return PacketIncomingType.Explosion;
|
||||||
|
case 0x26: return PacketIncomingType.MapData;
|
||||||
|
case 0x4B: return PacketIncomingType.Title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (protocol < Protocol18Handler.MC115Version) // MC 1.14 to 1.14.4
|
else if (protocol < Protocol18Handler.MC115Version) // MC 1.14 to 1.14.4
|
||||||
|
|
@ -257,11 +277,15 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
case 0x29: return PacketIncomingType.EntityPositionAndRotation;
|
case 0x29: return PacketIncomingType.EntityPositionAndRotation;
|
||||||
case 0x58: return PacketIncomingType.EntityProperties;
|
case 0x58: return PacketIncomingType.EntityProperties;
|
||||||
case 0x56: return PacketIncomingType.EntityTeleport;
|
case 0x56: return PacketIncomingType.EntityTeleport;
|
||||||
|
case 0x41: return PacketIncomingType.EntityVelocity;
|
||||||
|
case 0x42: return PacketIncomingType.EntityEquipment;
|
||||||
case 0x4E: return PacketIncomingType.TimeUpdate;
|
case 0x4E: return PacketIncomingType.TimeUpdate;
|
||||||
case 0x48: return PacketIncomingType.UpdateHealth;
|
case 0x48: return PacketIncomingType.UpdateHealth;
|
||||||
case 0x47: return PacketIncomingType.SetExperience;
|
case 0x45: return PacketIncomingType.SetExperience;
|
||||||
case 0x3F: return PacketIncomingType.HeldItemChange;
|
case 0x3F: return PacketIncomingType.HeldItemChange;
|
||||||
case 0x1C: return PacketIncomingType.Explosion;
|
case 0x1C: return PacketIncomingType.Explosion;
|
||||||
|
case 0x26: return PacketIncomingType.MapData;
|
||||||
|
case 0x4F: return PacketIncomingType.Title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // MC 1.15
|
else // MC 1.15
|
||||||
|
|
@ -297,11 +321,15 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
case 0x2A: return PacketIncomingType.EntityPositionAndRotation;
|
case 0x2A: return PacketIncomingType.EntityPositionAndRotation;
|
||||||
case 0x59: return PacketIncomingType.EntityProperties;
|
case 0x59: return PacketIncomingType.EntityProperties;
|
||||||
case 0x57: return PacketIncomingType.EntityTeleport;
|
case 0x57: return PacketIncomingType.EntityTeleport;
|
||||||
|
case 0x46: return PacketIncomingType.EntityVelocity;
|
||||||
|
case 0x47: return PacketIncomingType.EntityEquipment;
|
||||||
case 0x4F: return PacketIncomingType.TimeUpdate;
|
case 0x4F: return PacketIncomingType.TimeUpdate;
|
||||||
case 0x49: return PacketIncomingType.UpdateHealth;
|
case 0x49: return PacketIncomingType.UpdateHealth;
|
||||||
case 0x48: return PacketIncomingType.SetExperience;
|
case 0x48: return PacketIncomingType.SetExperience;
|
||||||
case 0x40: return PacketIncomingType.HeldItemChange;
|
case 0x40: return PacketIncomingType.HeldItemChange;
|
||||||
case 0x1D: return PacketIncomingType.Explosion;
|
case 0x1D: return PacketIncomingType.Explosion;
|
||||||
|
case 0x27: return PacketIncomingType.MapData;
|
||||||
|
case 0x50: return PacketIncomingType.Title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -346,6 +374,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
case PacketOutgoingType.CreativeInventoryAction: return 0x10;
|
case PacketOutgoingType.CreativeInventoryAction: return 0x10;
|
||||||
case PacketOutgoingType.Animation: return 0x0A;
|
case PacketOutgoingType.Animation: return 0x0A;
|
||||||
case PacketOutgoingType.PlayerDigging: return 0x07;
|
case PacketOutgoingType.PlayerDigging: return 0x07;
|
||||||
|
case PacketOutgoingType.UpdateSign: return 0x12;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (protocol <= Protocol18Handler.MC1112Version) // MC 1.9, 1,10 and 1.11
|
else if (protocol <= Protocol18Handler.MC1112Version) // MC 1.9, 1,10 and 1.11
|
||||||
|
|
@ -372,6 +401,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
case PacketOutgoingType.CreativeInventoryAction: return 0x18;
|
case PacketOutgoingType.CreativeInventoryAction: return 0x18;
|
||||||
case PacketOutgoingType.Animation: return 0x1A;
|
case PacketOutgoingType.Animation: return 0x1A;
|
||||||
case PacketOutgoingType.PlayerDigging: return 0x13;
|
case PacketOutgoingType.PlayerDigging: return 0x13;
|
||||||
|
case PacketOutgoingType.UpdateSign: return 0x19;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (protocol <= Protocol18Handler.MC112Version) // MC 1.12
|
else if (protocol <= Protocol18Handler.MC112Version) // MC 1.12
|
||||||
|
|
@ -398,6 +428,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
case PacketOutgoingType.CreativeInventoryAction: return 0x1B;
|
case PacketOutgoingType.CreativeInventoryAction: return 0x1B;
|
||||||
case PacketOutgoingType.Animation: return 0x1D;
|
case PacketOutgoingType.Animation: return 0x1D;
|
||||||
case PacketOutgoingType.PlayerDigging: return 0x14;
|
case PacketOutgoingType.PlayerDigging: return 0x14;
|
||||||
|
case PacketOutgoingType.UpdateSign: return 0x1C;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (protocol <= Protocol18Handler.MC1122Version) // 1.12.2
|
else if (protocol <= Protocol18Handler.MC1122Version) // 1.12.2
|
||||||
|
|
@ -424,6 +455,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
case PacketOutgoingType.CreativeInventoryAction: return 0x1B;
|
case PacketOutgoingType.CreativeInventoryAction: return 0x1B;
|
||||||
case PacketOutgoingType.Animation: return 0x1D;
|
case PacketOutgoingType.Animation: return 0x1D;
|
||||||
case PacketOutgoingType.PlayerDigging: return 0x14;
|
case PacketOutgoingType.PlayerDigging: return 0x14;
|
||||||
|
case PacketOutgoingType.UpdateSign: return 0x1C;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (protocol < Protocol18Handler.MC114Version) // MC 1.13 to 1.13.2
|
else if (protocol < Protocol18Handler.MC114Version) // MC 1.13 to 1.13.2
|
||||||
|
|
@ -450,6 +482,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
case PacketOutgoingType.CreativeInventoryAction: return 0x24;
|
case PacketOutgoingType.CreativeInventoryAction: return 0x24;
|
||||||
case PacketOutgoingType.Animation: return 0x27;
|
case PacketOutgoingType.Animation: return 0x27;
|
||||||
case PacketOutgoingType.PlayerDigging: return 0x18;
|
case PacketOutgoingType.PlayerDigging: return 0x18;
|
||||||
|
case PacketOutgoingType.UpdateSign: return 0x26;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // MC 1.14 to 1.15
|
else // MC 1.14 to 1.15
|
||||||
|
|
@ -476,6 +509,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
case PacketOutgoingType.CreativeInventoryAction: return 0x26;
|
case PacketOutgoingType.CreativeInventoryAction: return 0x26;
|
||||||
case PacketOutgoingType.Animation: return 0x2A;
|
case PacketOutgoingType.Animation: return 0x2A;
|
||||||
case PacketOutgoingType.PlayerDigging: return 0x1A;
|
case PacketOutgoingType.PlayerDigging: return 0x1A;
|
||||||
|
case PacketOutgoingType.UpdateSign: return 0x29;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ namespace MinecraftClient.Protocol
|
||||||
/// <param name="itemType">Item type</param>
|
/// <param name="itemType">Item type</param>
|
||||||
/// <param name="count">Item count</param>
|
/// <param name="count">Item count</param>
|
||||||
/// <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, Dictionary<string, object> NBT);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Plays animation
|
/// Plays animation
|
||||||
|
|
@ -194,5 +194,6 @@ namespace MinecraftClient.Protocol
|
||||||
/// <param name="face">Block face: 0 = bottom, 1 = top, etc (see wiki)</param>
|
/// <param name="face">Block face: 0 = bottom, 1 = top, etc (see wiki)</param>
|
||||||
/// <returns>True if packet was succcessfully sent</returns>
|
/// <returns>True if packet was succcessfully sent</returns>
|
||||||
bool SendPlayerDigging(int status, Location location, byte face);
|
bool SendPlayerDigging(int status, Location location, byte face);
|
||||||
|
bool SendUpdateSign(Location location, string line1, string line2, string line3, string line4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,11 @@ namespace MinecraftClient.Protocol
|
||||||
/// <param name="isJson">TRUE if the text is JSON-Encoded</param>
|
/// <param name="isJson">TRUE if the text is JSON-Encoded</param>
|
||||||
void OnTextReceived(string text, bool isJson);
|
void OnTextReceived(string text, bool isJson);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This method is called when the protocol handler receives a title
|
||||||
|
/// </summary>
|
||||||
|
void OnTitle(int action, string titletext, string subtitletext, string actionbartext, int fadein, int stay, int fadeout, string json);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when receiving a connection keep-alive from the server
|
/// Called when receiving a connection keep-alive from the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -136,6 +141,14 @@ namespace MinecraftClient.Protocol
|
||||||
/// <param name="entity">Spawned entity</param>
|
/// <param name="entity">Spawned entity</param>
|
||||||
void OnSpawnEntity(Entity entity);
|
void OnSpawnEntity(Entity entity);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when an entity has spawned
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entityid">Entity id</param>
|
||||||
|
/// <param name="slot">Equipment slot. 0: main hand, 1: off hand, 2–5: armor slot (2: boots, 3: leggings, 4: chestplate, 5: helmet)/param>
|
||||||
|
/// <param name="item">Item/param>
|
||||||
|
void OnEntityEquipment(int entityid, int slot, Item item);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when a player spawns or enters the client's render distance
|
/// Called when a player spawns or enters the client's render distance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -245,6 +258,16 @@ namespace MinecraftClient.Protocol
|
||||||
/// <param name="slot"></param>
|
/// <param name="slot"></param>
|
||||||
void OnHeldItemChange(byte slot);
|
void OnHeldItemChange(byte slot);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called map data
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mapid"></param>
|
||||||
|
/// <param name="scale"></param>
|
||||||
|
/// <param name="trackingposition"></param>
|
||||||
|
/// <param name="locked"></param>
|
||||||
|
/// <param name="iconcount"></param>
|
||||||
|
void OnMapData(int mapid, byte scale, bool trackingposition, bool locked, int iconcount);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when the Player entity ID has been received from the server
|
/// Called when the Player entity ID has been received from the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue