mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
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:
parent
b2e6953075
commit
cf9bc4c3d5
12 changed files with 249 additions and 23 deletions
|
|
@ -63,6 +63,8 @@ namespace MinecraftClient
|
|||
// player health and hunger
|
||||
private float playerHealth;
|
||||
private int playerFoodSaturation;
|
||||
private int playerLevel;
|
||||
private int playerTotalExperience;
|
||||
private byte CurrentSlot = 0;
|
||||
|
||||
// Entity handling
|
||||
|
|
@ -83,6 +85,8 @@ namespace MinecraftClient
|
|||
public Double GetServerTPS() { return serverTPS; }
|
||||
public float GetHealth() { return playerHealth; }
|
||||
public int GetSaturation() { return playerFoodSaturation; }
|
||||
public int GetLevel() { return playerLevel; }
|
||||
public int GetTotalExperience() { return playerTotalExperience; }
|
||||
public byte GetCurrentSlot() { return CurrentSlot; }
|
||||
|
||||
// get bots list for unloading them by commands
|
||||
|
|
@ -1261,6 +1265,23 @@ namespace MinecraftClient
|
|||
OnSpawnEntity(playerEntity);
|
||||
}
|
||||
|
||||
/// <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 void OnGamemodeUpdate(Guid uuid, int gamemode)
|
||||
{
|
||||
string playerName = null;
|
||||
if (onlinePlayers.ContainsKey(uuid))
|
||||
{
|
||||
playerName = onlinePlayers[uuid];
|
||||
foreach (ChatBot bot in bots.ToArray())
|
||||
bot.OnGamemodeUpdate(playerName, uuid, gamemode);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when entities dead/despawn.
|
||||
/// </summary>
|
||||
|
|
@ -1529,7 +1550,22 @@ namespace MinecraftClient
|
|||
//WORK IN PROGRESS. MAY NOT WORK YET
|
||||
if (Settings.DebugMessages)
|
||||
ConsoleIO.WriteLogLine(location.ToString());
|
||||
return handler.SendPlayerBlockPlacement(0, location, 1, 0.5f, 0.5f, 0.5f, false);
|
||||
Location placelocation = new Location(location.X, location.Y - 1, location.Z);
|
||||
return handler.SendPlayerBlockPlacement(0, placelocation, 1, 0.5f, 0.5f, 0.5f, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dig block - WORK IN PROGRESS - MAY NOT WORK YET
|
||||
/// </summary>
|
||||
/// <param name="status"></param>
|
||||
/// <param name="location"></param>
|
||||
/// <param name="face"></param>
|
||||
public bool DigBlock(int status, Location location, byte Face)
|
||||
{
|
||||
if (Settings.DebugMessages)
|
||||
ConsoleIO.WriteLogLine(location.ToString());
|
||||
Location placelocation = new Location(location.X, location.Y, location.Z);
|
||||
return handler.SendPlayerDigging(status, placelocation, 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1549,7 +1585,7 @@ namespace MinecraftClient
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Called when client player's health changed, e.g. getting attack
|
||||
/// </summary>
|
||||
|
|
@ -1574,6 +1610,38 @@ namespace MinecraftClient
|
|||
bot.OnHealthUpdate(health, food);
|
||||
}
|
||||
|
||||
/// <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 void OnSetExperience(float Experiencebar, int Level, int TotalExperience)
|
||||
{
|
||||
playerLevel = Level;
|
||||
playerTotalExperience = TotalExperience;
|
||||
foreach (ChatBot bot in bots.ToArray())
|
||||
bot.OnSetExperience(Experiencebar, Level, TotalExperience);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when and explosion occurs on the server
|
||||
/// </summary>
|
||||
/// <param name="location">Explosion location</param>
|
||||
/// <param name="strength">Explosion strength</param>
|
||||
/// <param name="affectedBlocks">Amount of affected blocks</param>
|
||||
public void OnExplosion(Location location, float strength, int affectedBlocks)
|
||||
{
|
||||
foreach (ChatBot bot in bots.ToArray())
|
||||
bot.OnExplosion(explode, strength, ExplosionRecordCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when Experience bar is updated
|
||||
/// </summary>
|
||||
/// <param name="Experiencebar">Experience bar level</param>
|
||||
/// <param name="Level">Player Level</param>
|
||||
/// <param name="TotalExperience">Total experience</param>
|
||||
public void OnHeldItemChange(byte slot)
|
||||
{
|
||||
foreach (ChatBot bot in bots.ToArray())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue