/// <summary> /// Handles the food game logic. /// </summary> public virtual void OnUpdate(EntityPlayer par1EntityPlayer) { int i = par1EntityPlayer.WorldObj.DifficultySetting; PrevFoodLevel = FoodLevel; if (FoodExhaustionLevel > 4F) { FoodExhaustionLevel -= 4F; if (FoodSaturationLevel > 0.0F) { FoodSaturationLevel = Math.Max(FoodSaturationLevel - 1.0F, 0.0F); } else if (i > 0) { FoodLevel = Math.Max(FoodLevel - 1, 0); } } if (FoodLevel >= 18 && par1EntityPlayer.ShouldHeal()) { FoodTimer++; if (FoodTimer >= 80) { par1EntityPlayer.Heal(1); FoodTimer = 0; } } else if (FoodLevel <= 0) { FoodTimer++; if (FoodTimer >= 80) { if (par1EntityPlayer.GetHealth() > 10 || i >= 3 || par1EntityPlayer.GetHealth() > 1 && i >= 2) { par1EntityPlayer.AttackEntityFrom(DamageSource.Starve, 1); } FoodTimer = 0; } } else { FoodTimer = 0; } }