Rename command Status to Health

This commit is contained in:
ReinforceZwei 2020-04-04 19:18:18 +08:00 committed by ORelio
parent 975e6d4daa
commit bf86259b4b
5 changed files with 8 additions and 8 deletions

View file

@ -5,14 +5,14 @@ using System.Text;
namespace MinecraftClient.Commands
{
class Status : Command
class Health : Command
{
public override string CMDName { get { return "status"; } }
public override string CMDDesc { get { return "status: Display Health and Food saturation."; } }
public override string Run(McTcpClient handler, string command, Dictionary<string, object> localVars)
{
return "Health: " + handler.GetHealth() + "\n[MCC] Saturation: " + handler.GetSaturation(); // any good ways to print multiple lines?
return "Health: " + handler.GetHealth() + ", Saturation: " + handler.GetSaturation();
}
}
}

View file

@ -1542,10 +1542,10 @@ namespace MinecraftClient
/// Called when client player's health changed, e.g. getting attack
/// </summary>
/// <param name="health">Player current health</param>
public void OnUpdateHealth(float health, int Food)
public void OnUpdateHealth(float health, int food)
{
playerHealth = health;
playerFoodSaturation = Food;
playerFoodSaturation = food;
if (health <= 0)
{
if (Settings.AutoRespawn)

View file

@ -101,7 +101,7 @@
<Compile Include="Commands\Script.cs" />
<Compile Include="Commands\Send.cs" />
<Compile Include="Commands\Set.cs" />
<Compile Include="Commands\Status.cs" />
<Compile Include="Commands\Health.cs" />
<Compile Include="Commands\UseItem.cs" />
<Compile Include="Inventory\Container.cs" />
<Compile Include="Inventory\ContainerType.cs" />

View file

@ -725,10 +725,10 @@ namespace MinecraftClient.Protocol.Handlers
break;
case PacketIncomingType.UpdateHealth:
float health = dataTypes.ReadNextFloat(packetData);
int Food = dataTypes.ReadNextVarInt(packetData);
int food = dataTypes.ReadNextVarInt(packetData);
// Food Saturation, not useful
dataTypes.ReadNextFloat(packetData);
handler.OnUpdateHealth(health, Food);
handler.OnUpdateHealth(health, food);
break;
default:
return false; //Ignored packet

View file

@ -212,7 +212,7 @@ namespace MinecraftClient.Protocol
/// <param name="item">Item (may be null for empty slot)</param>
void OnSetSlot(byte inventoryID, short slotID, Item item);
void OnUpdateHealth(float health, int Food);
void OnUpdateHealth(float health, int food);
/// <summary>
/// Called when the Player entity ID has been received from the server