use of com.almuradev.almura.asm.mixin.accessors.util.FoodStatsAccessor in project Almura by AlmuraDev.
the class FoodLevelChangeApply method apply0.
@Override
public void apply0(final EntityPlayer entity, final ItemApplyContext context) {
final ItemStack usedStack = context.item();
if (usedStack.getItem() instanceof ItemFood) {
final ItemFood food = (ItemFood) usedStack.getItem();
final int currentFoodLevel = ((FoodStatsAccessor) entity.getFoodStats()).accessor$getFoodLevel();
((FoodStatsAccessor) entity.getFoodStats()).accessor$setFoodLevel(Math.min(currentFoodLevel + food.getHealAmount(usedStack), 20));
}
}
Aggregations