Add SendPlaceBlock, PlayerDigging, OnExplosion, OnGamemodeUpdate, OnSetExperience (#1027)

* Update ChatBot.cs

+ PlaceBlock

* Update AutoAttack.cs

+ HitAnimation

* Update PacketIncomingType.cs

+ Explosion,

* Update McTcpClient.cs

+ OnExplosion

* Update ChatBot.cs

+ OnExplosion

* Update IMinecraftComHandler.cs

+ OnExplosion

* Update Protocol18PacketTypes.cs

+ PacketIncomingType.Explosion

* Update ChatBot.cs

+ Fix

* Update AutoAttack.cs

+ Fix

* Update ChatBot.cs

+ Fix

* Update Protocol18PacketTypes.cs

+ Old versions

* Update Protocol18PacketTypes.cs

+ 1.7 - 1.8 Explosion ID

* Update Protocol18PacketTypes.cs

+ Fix

* Update McTcpClient.cs

+ int ExplosionRecordCount

* Update ChatBot.cs

+ recordcount

* Update IMinecraftComHandler.cs

+ ExplosionRecordCount

* Update Protocol18.cs

* Update CSharpRunner.cs

+ using MinecraftClient.Inventory;

* add OnGamemodeUpdate

+ OnGamemodeUpdate

* + OnGamemodeUpdate(playername, uuid, gamemode)

+ OnGamemodeUpdate

* Update Protocol18.cs

* Update IMinecraftComHandler.cs

* Update McTcpClient.cs

Fix

* Update McTcpClient.cs

* Update Protocol18.cs

+ Location explodelocation

* Update McTcpClient.cs

+ Location explode

* Update ChatBot.cs

+ Fix

* Update ChatBot.cs

Remove excess +

* Update Plays animation

* Improve documentation

* ItemType fix

* OnExplosion(Location explod);

* Update PacketIncomingType.cs add SetExperience,

* + Old versions

* Update IMinecraftComHandler.cs

* Update McTcpClient.cs

* Update Protocol18.cs

* add GetLevel & GetTotalExperience

* Fix

* add GetLevel & GetTotalExperience

* OnSetExpience

* Update ChatBot.cs

Fix

* Update McTcpClient.cs

+ bot.OnSetExperience

* Update Protocol18.cs

+ Fix

* Update McTcpClient.cs

+ PlayerDigging

* Update PacketOutgoingType.cs

+ PlayerDigging

* Update Protocol18PacketTypes.cs

+ case PacketOutgoingType.PlayerDigging

* Update Protocol18.cs

+ SendPlayerDigging

* Update IMinecraftCom.cs

+ SendPlayerDigging

* Update McTcpClient.cs

+ PlayerDigging

* Update Protocol16.cs

+ SendPlayerDigging

* Update ChatBot.cs

+ PlayerDigging

* Update ChatBot.cs

+ Fix

* Update McTcpClient.cs

+ Fix

* Update ChatBot.cs

Add WindowAction

* ChatBot.cs Fixes

* Further ChatBot.cs fixes

* Further ChatBot.cs fixes

* Protocol Handler fixes

* Protocol Handler fixes

* IMinecraftCom fixes

* documentation fixes

Co-authored-by: ORelio <oreliogitantispam.l0gin@spamgourmet.com>
This commit is contained in:
Рома Данилов 2020-05-29 23:18:34 +05:00 committed by GitHub
parent b2e6953075
commit cf9bc4c3d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 249 additions and 23 deletions

View file

@ -6,6 +6,7 @@ using System.IO;
using System.Threading;
using System.Text.RegularExpressions;
using MinecraftClient.Inventory;
using MinecraftClient.Mapping;
namespace MinecraftClient
{
@ -156,7 +157,13 @@ namespace MinecraftClient
/// <param name="entity">Entity with updated location</param>
public virtual void OnEntityMove(Mapping.Entity entity) { }
public virtual void OnInternalCommand(string commandName,string commandParams, string Result) { }
/// <summary>
/// Called after an internal MCC command has been performed
/// </summary>
/// <param name="commandName">MCC Command Name</param>
/// <param name="commandParams">MCC Command Parameters</param>
/// <param name="Result">MCC command result</param>
public virtual void OnInternalCommand(string commandName, string commandParams, string Result) { }
/// <summary>
/// Called when an entity spawned nearby
@ -183,6 +190,29 @@ namespace MinecraftClient
/// <param name="food">New food level</param>
public virtual void OnHealthUpdate(float health, int food) { }
/// <summary>
/// Called when an explosion occurs on the server
/// </summary>
/// <param name="explode">Explosion location</param>
/// <param name="recordcount">Amount of blocks blown up</param>
public virtual void OnExplosion(Location explode, float strength, int recordcount) { }
/// <summary>
/// Called when experience updates
/// </summary>
/// <param name="Experiencebar">Between 0 and 1</param>
/// <param name="Level">Level</param>
/// <param name="TotalExperience">Total Experience</param>
public virtual void OnSetExperience(float Experiencebar, int Level, int TotalExperience) { }
/// <summary>
/// Called when the Game Mode has been updated for a player
/// </summary>
/// <param name="playername">Player Name</param>
/// <param name="uuid">Player UUID</param>
/// <param name="gamemode">New Game Mode (0: Survival, 1: Creative, 2: Adventure, 3: Spectator).</param>
public virtual void OnGamemodeUpdate(string playername, Guid uuid, int gamemode) { }
/* =================================================================== */
/* ToolBox - Methods below might be useful while creating your bot. */
/* You should not need to interact with other classes of the program. */
@ -667,6 +697,7 @@ namespace MinecraftClient
{
return SendEntityAction(on ? Protocol.EntityActionType.StartSneaking : Protocol.EntityActionType.StopSneaking);
}
/// <summary>
/// Send Entity Action
/// </summary>
@ -674,6 +705,18 @@ namespace MinecraftClient
{
return Handler.sendEntityAction(entityAction);
}
/// <summary>
/// Dig block - WORK IN PROGRESS - MAY NOT WORK
/// </summary>
/// <param name="status"></param>
/// <param name="location"></param>
/// <param name="face"></param>
protected void DigBlock(int status, Location location, byte face)
{
Handler.DigBlock(status, location, face);
}
/// <summary>
/// SetSlot
/// </summary>
@ -871,7 +914,7 @@ namespace MinecraftClient
/// </summary>
/// <param name="EntityID"></param>
/// <param name="type">0: interact, 1: attack, 2: interact at</param>
/// <returns></returns>
/// <returns>TRUE in case of success</returns>
protected bool InteractEntity(int EntityID, int type)
{
return Handler.InteractEntity(EntityID, type);
@ -881,6 +924,7 @@ namespace MinecraftClient
/// Give Creative Mode items into regular/survival Player Inventory
/// </summary>
/// <remarks>(obviously) requires to be in creative mode</remarks>
/// </summary>
/// <param name="slot">Destination inventory slot</param>
/// <param name="itemType">Item type</param>
/// <param name="count">Item count</param>
@ -894,7 +938,7 @@ namespace MinecraftClient
/// Plays animation (Player arm swing)
/// </summary>
/// <param name="animation">0 for left arm, 1 for right arm</param>
/// <returns>TRUE if animation successfully done</returns>
/// <returns>TRUE in case of success</returns>
protected bool SendAnimation(int animation)
{
return Handler.DoAnimation(animation);
@ -903,7 +947,7 @@ namespace MinecraftClient
/// <summary>
/// Use item currently in the player's hand (active inventory bar slot)
/// </summary>
/// <returns></returns>
/// <returns>TRUE if successful</returns>
protected bool UseItemInHand()
{
return Handler.UseItemOnHand();
@ -912,12 +956,22 @@ namespace MinecraftClient
/// <summary>
/// Check inventory handling enable status
/// </summary>
/// <returns></returns>
/// <returns>TRUE if inventory handling is enabled</returns>
public bool GetInventoryEnabled()
{
return Handler.GetInventoryEnabled();
}
/// <summary>
/// Place block
/// </summary>
/// <param name="location">Block location</param>
/// <returns></returns>
protected bool SendPlaceBlock(Location location)
{
return Handler.PlaceBlock(location);
}
/// <summary>
/// Get the player's inventory. Do not write to it, will not have any effect server-side.
/// </summary>
@ -937,6 +991,18 @@ namespace MinecraftClient
return Handler.GetInventories();
}
/// <summary>
/// Perform inventory action
/// </summary>
/// <param name="inventoryId">Inventory ID</param>
/// <param name="slot">Slot ID</param>
/// <param name="actionType">Action Type</param>
/// <returns>TRUE in case of success</returns>
protected bool WindowAction(int inventoryId, int slot, WindowActionType actionType)
{
return Handler.DoWindowAction(inventoryId, slot, actionType);
}
/// <summary>
/// Change player selected hotbar slot
/// </summary>