Fix AutoEat crash (#1068)

* Fix AutoEat keep eating after player dead
* Fix null reference on GetInventory method
* Add error handle for ChatBot API events
* Fix minor mistakes
This commit is contained in:
ReinforceZwei 2020-06-14 21:14:51 +08:00 committed by GitHub
parent 09bfe92071
commit ab05d697ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 72 additions and 6 deletions

View file

@ -34,6 +34,7 @@ namespace MinecraftClient.ChatBots
public override void OnHealthUpdate(float health, int food)
{
if (health <= 0) return; // player dead
if (((food <= HungerThreshold) || (food < 20 && health < 20)) && !Eating)
{
Eating = FindFoodAndEat();